This is the mail archive of the mailing list for the libstdc++ 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]

Re: __cxa_demangle sanity checks, issues, thoughts

Hash: SHA1

Benjamin Kosnik wrote:

  // Assume external symbol list computed "as if" by
  // -g == --extern-only
  // -P == --portability
  // nm -g -P | 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|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 `------------------------
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


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