This is the mail archive of the gcc@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]

static runtime linking and libgcc/libgcc_s


Hello,
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
that?

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? 

TIA,
Volodya





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