This is the mail archive of the
mailing list for the GCC project.
Re: static runtime linking and libgcc/libgcc_s
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Vladimir Prus <ghost at cs dot msu dot su>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 5 Sep 2003 10:39:03 -0400
- Subject: Re: static runtime linking and libgcc/libgcc_s
- References: <firstname.lastname@example.org>
On Fri, Sep 05, 2003 at 11:04:08AM +0400, Vladimir Prus wrote:
> 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?
-static-libgcc will take care of libgcc_s.so. You'll have to handle
libstdc++ some other way.
MontaVista Software Debian GNU/Linux Developer