libgcc_s : What links to it and why?

Jeff Blaine
Thu Nov 2 18:26:00 GMT 2006

Ian Lance Taylor wrote:
> Jeff Blaine <> writes:
>> Hi Ian, thanks for the reply.
>>>> I didn't get an answer to my previous long post about the
>>>> problem I am having, so I figured I would try asking
>>>> more direct questions:
>>>> What, in GCC, makes the determination to link in -lgcc?
>>> -lgcc is always linked in.
>>> I assume you are asking: what decides whether to link it statically
>>> or
>>> dynamically?  That is controlled by the -static-libgcc and
>>> -shared-libgcc options, q.v.
>> I forgot to mention this below -- I also tried LDFLAGS="-static-libgcc"
>> and watched it be referenced/used during my build.  It did nothing.
>> The resulting build had linked.
> I have no explanation for this behaviour.  If you run the link command
> using the -v option, does it pass -lgcc_s to the linker?  Is there any
> chance that you somewhere have a file named  (You should
> normally have libgcc.a and

Sorry, I hit send too soon.

Yes, there is a /usr/rcf/lib/ that MUST remain where it is.
I simply don't want to link to it with my *other* (production) GCC.

My production GCC is built with --disable-shared --prefix=/somewhere.
It doesn't even have its own

No matter what I do (as you have seen), it is finding and linking to
/usr/rcf/lib/ :(

-Bstatic buys me nothing.

-static-libgcc buys me nothing.

Tweaking the 'libgcc' section in 'specs' in 2 different ways
buys me nothing.

More information about the Gcc-help mailing list