diff options
author | Pedro Alves <palves@redhat.com> | 2017-09-15 17:40:33 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-09-15 17:40:33 +0100 |
commit | 26a67918a501370a8fe62db18a74761a0073016f (patch) | |
tree | 28e8c49aaecca4d052bc32cbe6e3d6bb25b46a15 /libiberty | |
parent | 124aceb46dfd1f836f35d6075ead4e00e705f6f3 (diff) | |
download | gdb-26a67918a501370a8fe62db18a74761a0073016f.zip gdb-26a67918a501370a8fe62db18a74761a0073016f.tar.gz gdb-26a67918a501370a8fe62db18a74761a0073016f.tar.bz2 |
Sync libiberty/ & include/ with GCC
Note this brings in the interface files for libcc1/G++ as well, which
we will be needing in GDB soon anyway. That commit renamed a method
in the C interface and that required a small update to GDB's compile/
code, which I've included that in this patch to keep the tree
building.
include/ChangeLog:
2017-09-15 Pedro Alves <palves@redhat.com>
* ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro.
2017-09-12 Jiong Wang <jiong.wang@arm.com>
* dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP.
* dwarf2.h (DW_CFA_DUP): New define.
2017-08-21 Richard Biener <rguenther@suse.de>
* simple-object.h (simple_object_copy_lto_debug_sections): New
function.
2017-05-18 Martin Liska <mliska@suse.cz>
* ansidecl.h: Define CONSTEXPR macro.
2017-05-24 Nathan Sidwell <nathan@acm.org>
* libiberty.h (ASTRDUP): Adjust cast to avoid warning.
2017-01-30 Alexandre Oliva <aoliva@redhat.com>
Introduce C++ support in libcc1.
* gcc-c-fe.def (int_type_v0): Rename from...
(int_type): ... this. Introduce new version.
(float_type_v0): Rename from...
(float_type): ... this. Introduce new version.
(char_type): New.
* gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1.
(gcc_type_array): Move...
* gcc-interface.h: ... here.
* gcc-cp-fe.def: New.
* gcc-cp-interface.h: New.
2016-04-29 Oleg Endo <olegendo@gcc.gnu.org>
* longlong.h (umul_ppmm): Remove SHMEDIA checks.
(__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations.
2017-09-15 Yao Qi <yao.qi@linaro.org>
Pedro Alves <palves@redhat.com>
* ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro.
2017-09-12 Jiong Wang <jiong.wang@arm.com>
* dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP.
* dwarf2.h (DW_CFA_DUP): New define.
2017-08-21 Richard Biener <rguenther@suse.de>
* simple-object.h (simple_object_copy_lto_debug_sections): New
function.
2017-05-18 Martin Liska <mliska@suse.cz>
* ansidecl.h: Define CONSTEXPR macro.
2017-05-24 Nathan Sidwell <nathan@acm.org>
* libiberty.h (ASTRDUP): Adjust cast to avoid warning.
2017-01-30 Alexandre Oliva <aoliva@redhat.com>
Introduce C++ support in libcc1.
* gcc-c-fe.def (int_type_v0): Rename from...
(int_type): ... this. Introduce new version.
(float_type_v0): Rename from...
(float_type): ... this. Introduce new version.
(char_type): New.
* gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1.
(gcc_type_array): Move...
* gcc-interface.h: ... here.
* gcc-cp-fe.def: New.
* gcc-cp-interface.h: New.
2016-04-29 Oleg Endo <olegendo@gcc.gnu.org>
* longlong.h (umul_ppmm): Remove SHMEDIA checks.
(__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations.
libiberty/ChangeLog:
2017-09-15 Nathan Sidwell <nathan@acm.org>
PR demangler/82195
* cp-demangle.c (d_name): Add 'toplevel' parm. Pass to ...
(d_local_name): ... here. Parse trailing function args on nested
local_name.
(d_encoding, d_special_name, d_class_enum_type): Adjust d_name calls.
* testsuite/demangle-expected: Add tests.
2017-09-15 Richard Biener <rguenther@suse.de>
PR lto/81968
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Iterate marking dependent sections necessary.
2017-09-15 Nathan Sidwell <nathan@acm.org>
* cp-demangle.c (is_fnqual_component_type): Reimplement using
FNQUAL_COMPONENT_CASE.
(d_encoding): Hold bare_function_type in local var.
(d_local_name): Build name in both cases and build result once.
Collapse switch-if to single conditional.
(d_local_name):
* testsuite/demangle-expected: Realign blank lines with tests.
2017-09-12 Jiong Wang <jiong.wang@arm.com>
* dwarfnames.c (DW_CFA_DUP): New define.
gdb/ChangeLog:
2017-09-15 Pedro Alves <palves@redhat.com>
* compile/compile-c-types.c (convert_enum, convert_int)
(convert_float): Adjust to refer to int_type_v0 and float_type_v0.
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 30 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 110 | ||||
-rw-r--r-- | libiberty/dwarfnames.c | 2 | ||||
-rw-r--r-- | libiberty/simple-object-elf.c | 122 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 21 |
5 files changed, 179 insertions, 106 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 8c46971..7a49a6a 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,33 @@ +2017-09-15 Nathan Sidwell <nathan@acm.org> + + PR demangler/82195 + * cp-demangle.c (d_name): Add 'toplevel' parm. Pass to ... + (d_local_name): ... here. Parse trailing function args on nested + local_name. + (d_encoding, d_special_name, d_class_enum_type): Adjust d_name calls. + * testsuite/demangle-expected: Add tests. + +2017-09-15 Richard Biener <rguenther@suse.de> + + PR lto/81968 + * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): + Iterate marking dependent sections necessary. + +2017-09-15 Nathan Sidwell <nathan@acm.org> + + * cp-demangle.c (is_fnqual_component_type): Reimplement using + FNQUAL_COMPONENT_CASE. + (d_encoding): Hold bare_function_type in local var. + (d_local_name): Build name in both cases and build result once. + Collapse switch-if to single conditional. + (d_local_name): + + * testsuite/demangle-expected: Realign blank lines with tests. + +2017-09-12 Jiong Wang <jiong.wang@arm.com> + + * dwarfnames.c (DW_CFA_DUP): New define. + 2017-09-01 Martin Liska <mliska@suse.cz> * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 7b8d0b4..c330052 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -425,7 +425,7 @@ is_ctor_dtor_or_conversion (struct demangle_component *); static struct demangle_component *d_encoding (struct d_info *, int); -static struct demangle_component *d_name (struct d_info *); +static struct demangle_component *d_name (struct d_info *, int); static struct demangle_component *d_nested_name (struct d_info *); @@ -484,7 +484,7 @@ static struct demangle_component *d_expression (struct d_info *); static struct demangle_component *d_expr_primary (struct d_info *); -static struct demangle_component *d_local_name (struct d_info *); +static struct demangle_component *d_local_name (struct d_info *, int); static int d_discriminator (struct d_info *); @@ -568,22 +568,6 @@ static int d_demangle_callback (const char *, int, demangle_callbackref, void *); static char *d_demangle (const char *, int, size_t *); -/* True iff TYPE is a demangling component representing a - function-type-qualifier. */ - -static int -is_fnqual_component_type (enum demangle_component_type type) -{ - return (type == DEMANGLE_COMPONENT_RESTRICT_THIS - || type == DEMANGLE_COMPONENT_VOLATILE_THIS - || type == DEMANGLE_COMPONENT_CONST_THIS - || type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS - || type == DEMANGLE_COMPONENT_TRANSACTION_SAFE - || type == DEMANGLE_COMPONENT_NOEXCEPT - || type == DEMANGLE_COMPONENT_THROW_SPEC - || type == DEMANGLE_COMPONENT_REFERENCE_THIS); -} - #define FNQUAL_COMPONENT_CASE \ case DEMANGLE_COMPONENT_RESTRICT_THIS: \ case DEMANGLE_COMPONENT_VOLATILE_THIS: \ @@ -594,6 +578,23 @@ is_fnqual_component_type (enum demangle_component_type type) case DEMANGLE_COMPONENT_NOEXCEPT: \ case DEMANGLE_COMPONENT_THROW_SPEC +/* True iff TYPE is a demangling component representing a + function-type-qualifier. */ + +static int +is_fnqual_component_type (enum demangle_component_type type) +{ + switch (type) + { + FNQUAL_COMPONENT_CASE: + return 1; + default: + break; + } + return 0; +} + + #ifdef CP_DEMANGLE_DEBUG static void @@ -1305,9 +1306,9 @@ d_encoding (struct d_info *di, int top_level) return d_special_name (di); else { - struct demangle_component *dc; + struct demangle_component *dc, *dcr; - dc = d_name (di); + dc = d_name (di, top_level); if (dc != NULL && top_level && (di->options & DMGL_PARAMS) == 0) { @@ -1327,8 +1328,6 @@ d_encoding (struct d_info *di, int top_level) which is local to a function. */ if (dc->type == DEMANGLE_COMPONENT_LOCAL_NAME) { - struct demangle_component *dcr; - dcr = d_right (dc); while (is_fnqual_component_type (dcr->type)) dcr = d_left (dcr); @@ -1341,8 +1340,8 @@ d_encoding (struct d_info *di, int top_level) peek = d_peek_char (di); if (dc == NULL || peek == '\0' || peek == 'E') return dc; - return d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME, dc, - d_bare_function_type (di, has_return_type (dc))); + dcr = d_bare_function_type (di, has_return_type (dc)); + return d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME, dc, dcr); } } @@ -1384,7 +1383,7 @@ d_abi_tags (struct d_info *di, struct demangle_component *dc) */ static struct demangle_component * -d_name (struct d_info *di) +d_name (struct d_info *di, int top_level) { char peek = d_peek_char (di); struct demangle_component *dc; @@ -1395,7 +1394,7 @@ d_name (struct d_info *di) return d_nested_name (di); case 'Z': - return d_local_name (di); + return d_local_name (di, top_level); case 'U': return d_unqualified_name (di); @@ -2080,11 +2079,11 @@ d_special_name (struct d_info *di) case 'H': return d_make_comp (di, DEMANGLE_COMPONENT_TLS_INIT, - d_name (di), NULL); + d_name (di, 0), NULL); case 'W': return d_make_comp (di, DEMANGLE_COMPONENT_TLS_WRAPPER, - d_name (di), NULL); + d_name (di, 0), NULL); default: return NULL; @@ -2095,11 +2094,12 @@ d_special_name (struct d_info *di) switch (d_next_char (di)) { case 'V': - return d_make_comp (di, DEMANGLE_COMPONENT_GUARD, d_name (di), NULL); + return d_make_comp (di, DEMANGLE_COMPONENT_GUARD, + d_name (di, 0), NULL); case 'R': { - struct demangle_component *name = d_name (di); + struct demangle_component *name = d_name (di, 0); return d_make_comp (di, DEMANGLE_COMPONENT_REFTEMP, name, d_number_component (di)); } @@ -2935,7 +2935,7 @@ d_bare_function_type (struct d_info *di, int has_return_type) static struct demangle_component * d_class_enum_type (struct d_info *di) { - return d_name (di); + return d_name (di, 0); } /* <array-type> ::= A <(positive dimension) number> _ <(element) type> @@ -3568,9 +3568,10 @@ d_expr_primary (struct d_info *di) */ static struct demangle_component * -d_local_name (struct d_info *di) +d_local_name (struct d_info *di, int top_level) { struct demangle_component *function; + struct demangle_component *name; if (! d_check_char (di, 'Z')) return NULL; @@ -3585,13 +3586,10 @@ d_local_name (struct d_info *di) d_advance (di, 1); if (! d_discriminator (di)) return NULL; - return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function, - d_make_name (di, "string literal", - sizeof "string literal" - 1)); + name = d_make_name (di, "string literal", sizeof "string literal" - 1); } else { - struct demangle_component *name; int num = -1; if (d_peek_char (di) == 'd') @@ -3603,22 +3601,36 @@ d_local_name (struct d_info *di) return NULL; } - name = d_name (di); - if (name) - switch (name->type) - { - /* Lambdas and unnamed types have internal discriminators. */ - case DEMANGLE_COMPONENT_LAMBDA: - case DEMANGLE_COMPONENT_UNNAMED_TYPE: - break; - default: - if (! d_discriminator (di)) - return NULL; - } + name = d_name (di, 0); + + if (name + /* Lambdas and unnamed types have internal discriminators + and are not functions. */ + && name->type != DEMANGLE_COMPONENT_LAMBDA + && name->type != DEMANGLE_COMPONENT_UNNAMED_TYPE) + { + if (!top_level + && d_peek_char (di) != 0 /* Not end of string. */ + && d_peek_char (di) != 'E' /* Not end of nested encoding. */ + && d_peek_char (di) != '_') /* Not discriminator. */ + { + struct demangle_component *args; + + args = d_bare_function_type (di, has_return_type (name)); + name = d_make_comp (di, DEMANGLE_COMPONENT_TYPED_NAME, + name, args); + } + + /* Read and ignore an optional discriminator. */ + if (! d_discriminator (di)) + return NULL; + } + if (num >= 0) name = d_make_default_arg (di, num, name); - return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function, name); } + + return d_make_comp (di, DEMANGLE_COMPONENT_LOCAL_NAME, function, name); } /* <discriminator> ::= _ <number> # when number < 10 diff --git a/libiberty/dwarfnames.c b/libiberty/dwarfnames.c index e58d03c..dacd78d 100644 --- a/libiberty/dwarfnames.c +++ b/libiberty/dwarfnames.c @@ -75,6 +75,7 @@ Boston, MA 02110-1301, USA. */ #define DW_ATE(name, value) case name: return # name ; #define DW_ATE_DUP(name, value) #define DW_CFA(name, value) case name: return # name ; +#define DW_CFA_DUP(name, value) #define DW_IDX(name, value) case name: return # name ; #define DW_IDX_DUP(name, value) @@ -105,5 +106,6 @@ Boston, MA 02110-1301, USA. */ #undef DW_ATE #undef DW_ATE_DUP #undef DW_CFA +#undef DW_CFA_DUP #undef DW_IDX #undef DW_IDX_DUP diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c index 6774eb2..7eb3df8 100644 --- a/libiberty/simple-object-elf.c +++ b/libiberty/simple-object-elf.c @@ -1158,70 +1158,84 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, /* Mark sections as preserved that are required by to be preserved sections. */ - for (i = 1; i < shnum; ++i) + int changed; + do { - unsigned char *shdr; - unsigned int sh_type, sh_info, sh_link; - off_t offset; - off_t length; - - shdr = shdrs + (i - 1) * shdr_size; - sh_type = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, - shdr, sh_type, Elf_Word); - sh_info = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, - shdr, sh_info, Elf_Word); - sh_link = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, - shdr, sh_link, Elf_Word); - if (sh_type == SHT_GROUP) + changed = 0; + for (i = 1; i < shnum; ++i) { - /* Mark groups containing copied sections. */ - unsigned entsize = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, - shdr, sh_entsize, Elf_Addr); - unsigned char *ent, *buf; - int keep = 0; - offset = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, - shdr, sh_offset, Elf_Addr); - length = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, - shdr, sh_size, Elf_Addr); - buf = XNEWVEC (unsigned char, length); - if (!simple_object_internal_read (sobj->descriptor, - sobj->offset + offset, buf, - (size_t) length, &errmsg, err)) + unsigned char *shdr; + unsigned int sh_type, sh_info, sh_link; + off_t offset; + off_t length; + + shdr = shdrs + (i - 1) * shdr_size; + sh_type = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, + shdr, sh_type, Elf_Word); + sh_info = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, + shdr, sh_info, Elf_Word); + sh_link = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, + shdr, sh_link, Elf_Word); + if (sh_type == SHT_GROUP) { - XDELETEVEC (buf); - XDELETEVEC (names); - XDELETEVEC (shdrs); - return errmsg; - } - for (ent = buf + entsize; ent < buf + length; ent += entsize) - { - unsigned sec = type_functions->fetch_Elf_Word (ent); - if (pfnret[sec - 1] == 0) - keep = 1; + /* Mark groups containing copied sections. */ + unsigned entsize = ELF_FETCH_FIELD (type_functions, ei_class, + Shdr, shdr, sh_entsize, + Elf_Addr); + unsigned char *ent, *buf; + int keep = 0; + offset = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, + shdr, sh_offset, Elf_Addr); + length = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, + shdr, sh_size, Elf_Addr); + buf = XNEWVEC (unsigned char, length); + if (!simple_object_internal_read (sobj->descriptor, + sobj->offset + offset, buf, + (size_t) length, &errmsg, err)) + { + XDELETEVEC (buf); + XDELETEVEC (names); + XDELETEVEC (shdrs); + return errmsg; + } + for (ent = buf + entsize; ent < buf + length; ent += entsize) + { + unsigned sec = type_functions->fetch_Elf_Word (ent); + if (pfnret[sec - 1] == 0) + keep = 1; + } + if (keep) + { + changed |= (pfnret[sh_link - 1] == -1 + || pfnret[i - 1] == -1); + pfnret[sh_link - 1] = 0; + pfnret[i - 1] = 0; + } } - if (keep) + if (sh_type == SHT_RELA + || sh_type == SHT_REL) { - pfnret[sh_link - 1] = 0; - pfnret[i - 1] = 0; + /* Mark relocation sections and symtab of copied sections. */ + if (pfnret[sh_info - 1] == 0) + { + changed |= (pfnret[sh_link - 1] == -1 + || pfnret[i - 1] == -1); + pfnret[sh_link - 1] = 0; + pfnret[i - 1] = 0; + } } - } - if (sh_type == SHT_RELA - || sh_type == SHT_REL) - { - /* Mark relocation sections and symtab of copied sections. */ - if (pfnret[sh_info - 1] == 0) + if (sh_type == SHT_SYMTAB) { - pfnret[sh_link - 1] = 0; - pfnret[i - 1] = 0; + /* Mark strings sections of copied symtabs. */ + if (pfnret[i - 1] == 0) + { + changed |= pfnret[sh_link - 1] == -1; + pfnret[sh_link - 1] = 0; + } } } - if (sh_type == SHT_SYMTAB) - { - /* Mark strings sections of copied symtabs. */ - if (pfnret[i - 1] == 0) - pfnret[sh_link - 1] = 0; - } } + while (changed); /* Then perform the actual copying. */ for (i = 1; i < shnum; ++i) diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index f2a12b9..c1a9a73 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4720,18 +4720,33 @@ _ZdvMMMMMMMMMMMMMrrrrA_DTdvfp_fp_Eededilfdfdfdfd _Z1MA_aMMMMA_MMA_MMMMMMMMSt1MS_o11T0000000000t2M0oooozoooo _Z1MA_aMMMMA_MMA_MMMMMMMMSt1MS_o11T0000000000t2M0oooozoooo - # # demangler/80513 Test for overflow in d_number + _Z4294967297x _Z4294967297x - # # demangler/80513 Test for bogus characters after __thunk_ + __thunk_16a_$_1x __thunk_16a_$_1x - # # demangler/80513 Test for overflow in consume_count + __thunk_4294967297__$_1x __thunk_4294967297__$_1x +# +# demangler/82195 members of lambdas +--no-params +_ZZZ3FoovENKUlT_E_clIiEEfS_EN5Local2fnEv +Foo()::float {lambda(auto:1)#1}::operator()<int>(int) const::Local::fn() +Foo()::float {lambda(auto:1)#1}::operator()<int>(int) const::Local::fn +--no-params +_Z7CaptureIZZ3FoovENKUlT_E_clIiEEvS0_EUlvE_EvOS0_ +void Capture<Foo()::void {lambda(auto:1)#1}::operator()<int>(int) const::{lambda()#1}>(Foo()::void {lambda(auto:1)#1}::operator()<int>(int) const::{lambda()#1}&&) +Capture<Foo()::void {lambda(auto:1)#1}::operator()<int>(int) const::{lambda()#1}> +--no-params +_Z4FrobIZZ3FoovENKUlT_E_clIiEEvS0_EUlvE_Evv +void Frob<Foo()::void {lambda(auto:1)#1}::operator()<int>(int) const::{lambda()#1}>() +Frob<Foo()::void {lambda(auto:1)#1}::operator()<int>(int) const::{lambda()#1}> +# |