__cxa_demangle sanity checks, issues, thoughts

Ulrich Drepper drepper@redhat.com
Thu Aug 15 23:46:00 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Benjamin Kosnik wrote:

>   // Assume external symbol list computed "as if" by
>   // -g == --extern-only
>   // -P == --portability
>   // nm -g -P libstdc++.so.5.0.0 | awk '{ print $1 $2}' | sort >& symbol_file

I cannot comment on much but on this I can.

The above line will not examine the dynamic symbol table but it is the 
symbol table which is defining the DSO interface.  You would have to add 
- -D to the command line.  But this doesn't help much here due to 
limitations in nm.  It doesn't display version information.

I woulduse readelf to list the symbol table.  To get the contents of the 
dynamic symbol table run

   readelf -s libc.so|sed '/\.dynsym/,/^$/p;d'

Your command line above adds to the complete name a character describing 
whether the symbol is defined or not, and whether it is week.  Undefined 
symbols are of no interest here.  They don't add to the ABI.  It also 
makes no sense whether a symbol is defined weak or not.

What does make a difference is:

- - the type of a symbol (function, object, no type, ...)

- - for object, on some platforms (like x86) it is necessary that the size 
doesn't change.  This is because of copy relocations.

If you want a list of all exported symbols, annotated with the other 
important information, use something like

   readelf -s <DSO>|sed '/\.dynsym/,/^$/p;d'|grep -v ' LOCAL '|awk '{ if 
($4 == "FUNC" || $4 == "NOTYPE") printf "%s:%s\n", $8, $4; else if ($4 
== "OBJECT") printf "%s:%s:%s\n", $8, $3, $4;}'

- --
- ---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9XJ/J2ijCOnn/RHQRAgCPAJ47d6bEhwkkY/Nqx8PrkMiVL7uSKwCfV0Gn
mPnwDoJqmXtZ82fwBYhq6os=
=IAqb
-----END PGP SIGNATURE-----



More information about the Libstdc++ mailing list