Subject: bin/3606: -nostdlib option doesn't work on cc
To: None <gnats-bugs@gnats.netbsd.org>
From: None <David.Sainty@vuw.ac.nz>
List: netbsd-bugs
Date: 05/12/1997 04:00:40
>Number:         3606
>Category:       bin
>Synopsis:       -nostdlib option doesn't work on cc
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 11 09:05:00 1997
>Last-Modified:
>Originator:     Dave Sainty
>Organization:
DTSP
>Release:        May 4 sup
>Environment:
>Description:
	The -nostdlibs option needs to be passed through to ld(1) from cc(1).
	This doesn't happen.
>How-To-Repeat:
	Point DESTDIR somewhere else and compile.  Or:

	touch foo.o
	cc -v -nostdlib -o foo foo.o -lc
gcc version 2.7.2
 ld -dc -dp -o foo -L/usr/libexec foo.o -lc

>Fix:
	Here is one of many possible patches.  I'm not sure how "correct" it
	is as far as gcc internals go.  It may need to also be applied to
	netbsd.h's specific to other architectures.

	cc -v -nostdlib -o foo foo.o -lc
gcc version 2.7.2
 ld -nostdlib -dc -dp -o foo -L/usr/libexec foo.o -lc

--- src/gnu/usr.bin/gcc/arch/netbsd.h.orig      Sat Apr 27 23:14:49 1996
+++ src/gnu/usr.bin/gcc/arch/netbsd.h   Mon May 12 03:30:37 1997
@@ -58,7 +58,7 @@
 
 #undef LINK_SPEC
 #define LINK_SPEC \
-  "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
+  "%{nostdlib:-nostdlib} %{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
 
 /* This defines which switch letters take arguments. */
 #undef SWITCH_TAKES_ARG
>Audit-Trail:
>Unformatted:
System: NetBSD tequila.ext.nz 1.2D NetBSD 1.2D (TEQUILA) #20: Mon May 5 03:17:02 NZST 1997 dave@tequila.ext.nz:/vol/tequila/userC/NetBSD-current/src/sys/arch/i386/compile/TEQUILA i386