public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Static linking to libgcc_s and libstdc++
       [not found] <616BE6A276E3714788D2AC35C40CD18D762A3B@whale.softwire.co.uk>
@ 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; 3+ 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] 3+ messages in thread

* gcc 3.1.1, nm -C on solaris8 sparc
  2002-08-05  6:24 ` Static linking to libgcc_s and libstdc++ Rupert Wood
@ 2002-09-01 12:27   ` Mark Crosland
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Crosland @ 2002-09-01 12:27 UTC (permalink / raw)
  To: gcc-help


Hello,

We are using gcc 3.1.1 on solaris8, sparc. We built it to use
/usr/ccs/bin/as and ld.

We have a tool that uses /usr/ccs/bin/nm -C to get demangled c++ symbol
names. But it doesn't seem to fully demangle them. As an example

nm -C lib.built.with.gcc.so
returns
aNamespace12aClassIN9aMethod

but

nm -C lib.built.with.sunCC.so
returns
aNamespace::aClass::aMethod

Are there any gnu tools that will fully demangle?

Thanks,
Mark Crosland

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

* RE: gcc 3.1.1, nm -C on solaris8 sparc
       [not found] <616BE6A276E3714788D2AC35C40CD18D7D24AE@whale.softwire.co.uk>
@ 2002-09-01 23:28 ` Rupert Wood
  0 siblings, 0 replies; 3+ messages in thread
From: Rupert Wood @ 2002-09-01 23:28 UTC (permalink / raw)
  To: 'Mark Crosland'; +Cc: gcc-help

Mark Crosland wrote:

> We have a tool that uses /usr/ccs/bin/nm -C to get demangled 
> c++ symbol names. But it doesn't seem to fully demangle them.

You can use the GNU nm (or objdump) from the binutils package to
demangle g++'s C++ symbols.

However, the GNU nm won't demangle Sun CC's symbols; you'll have to
stick with Sun's nm for that.

If you need both and can't choose the correct nm ahead of time, you
could write a wrapper to run G++ C++ symbols through the cp_demangle
function in libiberty (in the GCC, binutils and gdb source trees amongst
other places). All G++ manglings start '_Z'; but you can find a
definitive spec at

    http://www.codesourcery.com/cxx-abi/

Rup.

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <616BE6A276E3714788D2AC35C40CD18D762A3B@whale.softwire.co.uk>
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
     [not found] <616BE6A276E3714788D2AC35C40CD18D7D24AE@whale.softwire.co.uk>
2002-09-01 23:28 ` Rupert Wood

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).