This is the mail archive of the
mailing list for the GCC project.
static runtime linking and libgcc/libgcc_s
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 05 Sep 2003 11:04:08 +0400
- Subject: static runtime linking and libgcc/libgcc_s
suppose my application links to a number of libraries, some shared and some
static. But I'd like the C++ runtime (i.e. all the implicitly linked
libraries like libstdc++, libgcc) to be linked statically. How do I do
I'm asking on gcc list because the problem has to do with the list of
libraries gcc passes to the linker.
With gcc 2.95 I was able to add "-Wl,-Bstatic" option to the end of command
line and that option was placed in collect2 invocation before any
implicitly added libraries.
But in 3.3 I can not do it any longer. Unless there '-static' option, gcc
add "lgcc_s" library to the collect2 invocation. That library exists only
as shared object, so if I have "-Wl,-Bstatic", it's just not found.
OTOH, if I specify -static, then all libraries will be statically linked,
not only implicitly added ones.
So, does anybody knows a solution?