public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Static linking to libgcc_s and libstdc++
@ 2002-08-05  6:24 Rupert Wood
  2002-09-01 12:27 ` gcc 3.1.1, nm -C on solaris8 sparc Mark Crosland
  0 siblings, 1 reply; 2+ messages in thread
From: Rupert Wood @ 2002-08-05  6:24 UTC (permalink / raw)
  To: 'John Carter'; +Cc: gcc-help

John Carter wrote:

> Alas, it expects a sharable libstdc++ and libgcc_s.
:
> How can I convince gcc to statically link in those libraries
> (and no other sharable libraries)?

I'm on shaky ground here - I'm no ld expert - but:

   gcc <objects> -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic <rest of libs>

This should work with GNU ld but I've only tried it using Solaris ld.

Note that you're explicitly breaking GCC's C++ model object model: all
C++ binaries and shared libraries link in libgcc_s so that they all use
the same binary copy of the exception handling mechanism. If, however,
all C++ code is in your executable and all dynamic libraries are plain C
then you should get away with linking these statically.

Since you have to link libstdc++ explicitly yourself, you should use the
gcc driver and not the g++ driver. Combined with linking it before any
other libraries, this should enforce the plain-C-libraries-only
requirement at link time.

Good luck,
Rup.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-02  6:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <616BE6A276E3714788D2AC35C40CD18D7D24AE@whale.softwire.co.uk>
2002-09-01 23:28 ` gcc 3.1.1, nm -C on solaris8 sparc Rupert Wood
2002-08-05  6:24 Static linking to libgcc_s and libstdc++ Rupert Wood
2002-09-01 12:27 ` gcc 3.1.1, nm -C on solaris8 sparc Mark Crosland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).