This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libgcc_s : What links to it and why?


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 libgcc_s.so linked.

The g++ driver program always adds -shared-libgcc.  So if you link
with g++, you will normally get a shared libgcc (unless you use the
-static-libgcc option, of course).

Why am I unable to get around shared linking of -lgcc?
I have tried both of the following and neither works
if I have a libgcc_s.so

     a) In 'specs', specify "-Bstatic -lgcc -Bdynamic" for
        the 'libgcc:' directive.

     b) In 'specs', specify "/my/static/libgcc.a" for the
        'libgcc:' directive.

That is odd. It sounds like your specs file is not being read. I'm not sure why not.

Well, it finds it and opens it:


subversion-1.2.0:cairo> truss gcc 2>&1 | grep specs
access("/afs/rcf/lang/gcc/@sys/3.3.5/bin/../lib/gcc-lib/sparc-sun-solaris2.9/3.3.5/specs", 4) = 0
open("/afs/rcf/lang/gcc/@sys/3.3.5/bin/../lib/gcc-lib/sparc-sun-solaris2.9/3.3.5/specs", O_RDONLY) = 3
stat("/afs/rcf/lang/gcc/@sys/3.3.5/bin/../lib/gcc-lib/sparc-sun-solaris2.9/3.3.5/specs", 0xFFBFF3C8) = 0
access("/afs/rcf/lang/gcc/sun4x_59/3.3.5/lib/gcc-lib/sparc-sun-solaris2.9/specs", 4) Err#2 ENOENT



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]