Subject: Re: Request for help: GCC guru answers to GCC 3.3 internals
To: Joel Baker <>
From: Todd Vierling <>
List: tech-toolchain
Date: 05/20/2003 00:16:16
On Fri, 16 May 2003, Joel Baker wrote:

: For various reasons (not really related to NetBSD), I need to make sure
: that dynamically linked binaries get an explicit NEEDED statement in the
: ELF object for libc, in all cases

: (IE, I can't ensure that I just add -lc explicitly to all compiles).

This will make other things blow chunks, such as crt0.  If you're invoking
"ld" directly, the correct solution is "don't do that" (or at least tell us
why you are doing that 8-).

But in any case....

: Trying to change LIB_SPEC in gcc/config/netbsd*.h to have a stanza for
: '%{shared:-lc}' builds the compiler fine, but causes the testsuite to start
: blowing massive chunks;

First verify that you can do "cc -v -shared -o ... -lc" without
blowking chunks.  Save the -c output, if it works, because you'll need to
compare it to the below.

Then try removing the %{!shared:...} wrapper around -lc in LIB_SPEC and see
how the output of "cc -v -shared -o ..." (note no -lc) compares to
the output saved above.  The positioning of -lc in the ld link line may be
of importance here.

: in 3.2, this happened in basic_string template instantiation;

Are you using a shared libstdc++?  (This is important to know, as it may
indicate problems elsewhere, possibly related to crtbeginS/crtendS.)

-- Todd Vierling <>