Subject: bin/6467: behavior of gcc -nostdlib
To: None <gnats-bugs@gnats.netbsd.org>
From: Minoura Makoto <minoura@flab.fujitsu.co.jp>
List: netbsd-bugs
Date: 11/20/1998 13:47:00
>Number:         6467
>Category:       bin
>Synopsis:       behavior of gcc -nostdlib
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 19 20:50:01 1998
>Last-Modified:
>Originator:     Minoura Makoto
>Organization:
	netbsd.org
>Release:        Nov.14, 1998
>Environment:
System: NetBSD ecology 1.3H NetBSD 1.3H (ECOLOGY) #8: Fri Nov 13 11:12:26 JST 1998 root@ecology:/usr/src/sys/arch/sparc/compile/ECOLOGY sparc


>Description:
	gcc -nostdlib passes -nostdlib option to the loader.
	This is wrong because, according to the manual page,
	the semantics of -nostdlib option are different between
	gcc(1) and ld(1):
	  gcc(1) -- do not link libc and the startup.
	  ld(1)  -- do not search for /usr/lib for libraries.
>How-To-Repeat:
	gcc -v something.o -o something -nostdlib
>Fix:
	Not tested :-p
	For EGCS, the spec is in src/gnu/dist/gcc/config/netbsd.h.
diff -crN src.ORIG/gnu/usr.bin/gcc/arch/netbsd.h src/gnu/usr.bin/gcc/arch/netbsd.h
*** src.ORIG/gnu/usr.bin/gcc/arch/netbsd.h	Fri Oct  9 20:13:21 1998
--- src/gnu/usr.bin/gcc/arch/netbsd.h	Fri Nov 20 13:31:03 1998
***************
*** 68,74 ****
  
  #undef LINK_SPEC
  #define LINK_SPEC \
!   "%{nostdlib:-nostdlib} %{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
  
  /* This defines which switch letters take arguments. */
  #undef SWITCH_TAKES_ARG
--- 68,74 ----
  
  #undef LINK_SPEC
  #define LINK_SPEC \
!   "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}"
  
  /* This defines which switch letters take arguments. */
  #undef SWITCH_TAKES_ARG

	Another fix is to correct the manual pages :-p
>Audit-Trail:
>Unformatted: