The ELF group name for cdtors is mangled differently from the actual constructors, so that both the complete object ctor and the base object ctor are both taken from the same object file when duplicate link-once sections are discarded.
Bizzarely, one can't actually dump full group names, so one can't actually feed the output of anything into c++filt and be surprised that some of them don't get demangled. It would seem like readelf -S with extra -w (wide) options would do it, but the names are always truncated. That said, this came up in the context of trans-mem, in which we re-mangle names to their transactional-clone equivalent. It was surprising to look at the assembly output and see these names not being re-mangled "properly". This adds support for demangling these names, even if we never distinguish between them when actually outputting them. Ok for 4.7 and trans-mem branches? I see no need for this in 4.6... r~
include/ * demangle.h (enum gnu_v3_ctor_kinds): Add gnu_v3_object_ctor_group. (enum gnu_v3_dtor_kinds): Add gnu_v3_object_dtor_group. libiberty/ * cp-demangle.c (cplus_demangle_fill_ctor): Accept gnu_v3_object_ctor_group. (cplus_demangle_fill_dtor): Accept gnu_v3_object_dtor_group. (d_ctor_dtor_name): Recognize gnu_v3_object_ctor_group and gnu_v3_object_dtor_group. diff --git a/include/demangle.h b/include/demangle.h index c062455..872a6a0 100644 --- a/include/demangle.h +++ b/include/demangle.h @@ -166,7 +166,8 @@ ada_demangle (const char *mangled, int options); enum gnu_v3_ctor_kinds { gnu_v3_complete_object_ctor = 1, gnu_v3_base_object_ctor, - gnu_v3_complete_object_allocating_ctor + gnu_v3_complete_object_allocating_ctor, + gnu_v3_object_ctor_group }; /* Return non-zero iff NAME is the mangled form of a constructor name @@ -180,7 +181,8 @@ extern enum gnu_v3_ctor_kinds enum gnu_v3_dtor_kinds { gnu_v3_deleting_dtor = 1, gnu_v3_complete_object_dtor, - gnu_v3_base_object_dtor + gnu_v3_base_object_dtor, + gnu_v3_object_dtor_group }; /* Return non-zero iff NAME is the mangled form of a destructor name diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 7e951cc..b6280bc 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -731,7 +731,7 @@ cplus_demangle_fill_ctor (struct demangle_component *p, if (p == NULL || name == NULL || (int) kind < gnu_v3_complete_object_ctor - || (int) kind > gnu_v3_complete_object_allocating_ctor) + || (int) kind > gnu_v3_object_ctor_group) return 0; p->type = DEMANGLE_COMPONENT_CTOR; p->u.s_ctor.kind = kind; @@ -750,7 +750,7 @@ cplus_demangle_fill_dtor (struct demangle_component *p, if (p == NULL || name == NULL || (int) kind < gnu_v3_deleting_dtor - || (int) kind > gnu_v3_base_object_dtor) + || (int) kind > gnu_v3_object_dtor_group) return 0; p->type = DEMANGLE_COMPONENT_DTOR; p->u.s_dtor.kind = kind; @@ -1911,6 +1911,9 @@ d_ctor_dtor_name (struct d_info *di) case '3': kind = gnu_v3_complete_object_allocating_ctor; break; + case '5': + kind = gnu_v3_object_ctor_group; + break; default: return NULL; } @@ -1933,6 +1936,9 @@ d_ctor_dtor_name (struct d_info *di) case '2': kind = gnu_v3_base_object_dtor; break; + case '5': + kind = gnu_v3_object_dtor_group; + break; default: return NULL; }