summaryrefslogtreecommitdiffstats
path: root/src/nm.c
diff options
context:
space:
mode:
authorJan Kratochvil <[email protected]>2014-01-15 21:16:57 +0100
committerJan Kratochvil <[email protected]>2014-01-15 21:16:57 +0100
commit7c6e785e6eca774080a64801f950bd61785c469e (patch)
tree4429967bfda9c63803a4180d5e52f91a731fb6f4 /src/nm.c
parente922ec4e3bcd7c164a9ce424accac4394e7d5afd (diff)
Fix corruption of non-C++ symbols by the demangler.
Signed-off-by: Jan Kratochvil <[email protected]>
Diffstat (limited to 'src/nm.c')
-rw-r--r--src/nm.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nm.c b/src/nm.c
index d434f44e..62efb2d0 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -820,8 +820,8 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char *fullname,
symstrbuf, sizeof symstrbuf);
#ifdef USE_DEMANGLE
- /* Demangle if necessary. */
- if (demangle)
+ /* Demangle if necessary. Require GNU v3 ABI by the "_Z" prefix. */
+ if (demangle && symstr[0] == '_' && symstr[1] == 'Z')
{
int status = -1;
char *dmsymstr = __cxa_demangle (symstr, demangle_buffer,
@@ -965,8 +965,8 @@ show_symbols_bsd (Elf *elf, const GElf_Ehdr *ehdr, GElf_Word strndx,
continue;
#ifdef USE_DEMANGLE
- /* Demangle if necessary. */
- if (demangle)
+ /* Demangle if necessary. Require GNU v3 ABI by the "_Z" prefix. */
+ if (demangle && symstr[0] == '_' && symstr[1] == 'Z')
{
int status = -1;
char *dmsymstr = __cxa_demangle (symstr, demangle_buffer,
@@ -1076,8 +1076,8 @@ show_symbols_posix (Elf *elf, const GElf_Ehdr *ehdr, GElf_Word strndx,
continue;
#ifdef USE_DEMANGLE
- /* Demangle if necessary. */
- if (demangle)
+ /* Demangle if necessary. Require GNU v3 ABI by the "_Z" prefix. */
+ if (demangle && symstr[0] == '_' && symstr[1] == 'Z')
{
int status = -1;
char *dmsymstr = __cxa_demangle (symstr, demangle_buffer,
@@ -1244,8 +1244,8 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn,
continue;
#ifdef USE_DEMANGLE
- /* Demangle if necessary. */
- if (demangle)
+ /* Demangle if necessary. Require GNU v3 ABI by the "_Z" prefix. */
+ if (demangle && symstr[0] == '_' && symstr[1] == 'Z')
{
int status = -1;
char *dmsymstr = __cxa_demangle (symstr, demangle_buffer,