]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/binutils-tumbl.git/commitdiff
Properly demangle a global constructor symbol.
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 16 Nov 2010 17:58:26 +0000 (17:58 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 16 Nov 2010 17:58:26 +0000 (17:58 +0000)
2010-11-16  H.J. Lu  <hongjiu.lu@intel.com>

PR other/42670
PR binutils/11137
* cp-demangle.c (d_make_demangle_mangled_name): New.
(d_demangle_callback): Use it on DCT_GLOBAL_XTORS.

* testsuite/demangle-expected: Updated.

libiberty/ChangeLog
libiberty/cp-demangle.c
libiberty/testsuite/demangle-expected

index 4bd5b209bf3634b7716292bd4a142347cf08aa66..488fd2d094cffba04b6f60a91b7b15cc00a35a28 100644 (file)
@@ -1,3 +1,12 @@
+2010-11-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR other/42670
+       PR binutils/11137
+       * cp-demangle.c (d_make_demangle_mangled_name): New.
+       (d_demangle_callback): Use it on DCT_GLOBAL_XTORS.
+
+       * testsuite/demangle-expected: Updated.
+
 2010-11-14  Kai Tietz  <kai.tietz@onevision.com>
 
        * simple-object-coff.c (simple_object_coff_read_strtab): Fix reading
index 8b0b825099e20f2e155c907e6519293eb3db0d21..7e951cc78428ccfbc86a3ed59c2ad81d013c3dc1 100644 (file)
@@ -321,6 +321,9 @@ d_make_comp (struct d_info *, enum demangle_component_type,
 static struct demangle_component *
 d_make_name (struct d_info *, const char *, int);
 
+static struct demangle_component *
+d_make_demangle_mangled_name (struct d_info *, const char *);
+
 static struct demangle_component *
 d_make_builtin_type (struct d_info *,
                      const struct demangle_builtin_type_info *);
@@ -869,6 +872,17 @@ d_make_comp (struct d_info *di, enum demangle_component_type type,
   return p;
 }
 
+/* Add a new demangle mangled name component.  */
+
+static struct demangle_component *
+d_make_demangle_mangled_name (struct d_info *di, const char *s)
+{
+  if (d_peek_char (di) != '_' || d_peek_next_char (di) != 'Z')
+    return d_make_name (di, s, strlen (s));
+  d_advance (di, 2);
+  return d_encoding (di, 0);
+}
+
 /* Add a new name component.  */
 
 static struct demangle_component *
@@ -4823,7 +4837,7 @@ d_demangle_callback (const char *mangled, int options,
                          (type == DCT_GLOBAL_CTORS
                           ? DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS
                           : DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS),
-                         d_make_name (&di, d_str (&di), strlen (d_str (&di))),
+                         d_make_demangle_mangled_name (&di, d_str (&di)),
                          NULL);
        d_advance (&di, strlen (d_str (&di)));
        break;
index 5b154455a01397ee0d9a5b8050582714db721221..5ce0377b13bf57f6c38b2b862ff3baa9ba6d6c2f 100644 (file)
@@ -3610,8 +3610,8 @@ std::_Alloc_traits<std::basic_string<char, std::string_char_traits<char>, libcw:
 #
 --format=gnu-v3 --no-params
 _GLOBAL__I__Z2fnv
-global constructors keyed to _Z2fnv
-global constructors keyed to _Z2fnv
+global constructors keyed to fn()
+global constructors keyed to fn()
 #
 --format=gnu-v3 --no-params
 _Z1rM1GFivEMS_KFivES_M1HFivES1_4whatIKS_E5what2IS8_ES3_