Subject: Re: gcc3 "millicode" problems with sh3 (toolchain/22452)
To: Valeriy E. Ushakov <>
From: Todd Vierling <>
List: tech-toolchain
Date: 09/03/2003 12:18:18
On Wed, 3 Sep 2003, Valeriy E. Ushakov wrote:

: > This part should already be happening.  NetBSD's gcc LIBGCC_SPEC will use
: > -lgcc_pic in place of -lgcc when invoking "gcc -shared" for link.
: I don't see anything like that in our tree.  I also don't see
: -lgcc_pic in my build logs for either gcc2 or gcc3 world builds.

When you link anything with "cc -o foo ...", -lgcc is implicitly added (see
LIBGCC_SPEC in the gcc sources, or do "gcc -dumpspecs" and look at the line
after "*libgcc:").  When -shared is specified in the link, -lgcc_pic should
be used instead.  This was the case at least for gcc 2.95 as in NetBSD 1.6,
and I believe its behavior should have been carried over to gcc3.

However, may need tweaking.  I'm not up to full -current yet, and
it's possible that it now uses "cc -shared" (it used to do "ld -shared",
which doesn't get the benefit of automatic startfiles and -lgcc linkage).
Under the old "ld -shared" form, or with "cc -nostdlib", may need
to put in -lgcc_pic explicitly.

-- Todd Vierling <>