From d8efadbdd94772562fed8fba9ce553587a62550f Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 4 Jul 2022 13:57:12 +0100 Subject: [PATCH] Synchronize libbierty sources with gcc. --- ChangeLog | 13 ++++ libiberty/ChangeLog | 146 ++++++++++++++++++++++++++++++++++++-- libiberty/configure | 1 + libiberty/configure.ac | 1 + libiberty/rust-demangle.c | 46 +++++++++--- 5 files changed, 192 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6b3e58b8f0..59f70817924 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2022-07-04 Nick Clifton + + * libiberty: Synchronize with GCC. Bring in: + 2022-07-01 Nick Clifton + + PR demangler/105039 + * rust-demangle.c (demangle_const): Add recursion limit. + + 2022-06-26 Simon Marchi + + * configure.ac: Add AC_CONFIG_MACRO_DIRS call. + * configure: Re-generate. + 2022-04-12 Nick Clifton * zlib: Rebase to the 1.2.12 release. diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index de3a6eeef52..f84e4076ee5 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,7 +1,145 @@ +2022-07-01 Nick Clifton + + PR demangler/105039 + * rust-demangle.c (demangle_const): Add recursion limit. + +2022-06-26 Simon Marchi + + * configure.ac: Add AC_CONFIG_MACRO_DIRS call. + * configure: Re-generate. + +2022-05-23 Nathan Sidwell + + * cp-demangle.c (d_make_comp): Adjust. + (d_name, d_prefix): Adjust subst handling. Add module handling. + (d_maybe_module_name): New. + (d_unqualified_name): Add incoming module parm. Handle it. Adjust all callers. + (d_special_name): Add 'GI' support. + (d_count_template_scopes): Adjust. + (d_print_comp_inner): Print module. + * testsuite/demangle-expected: New test cases + +2022-05-18 Nathan Sidwell + + * cp-demangle.c (d_name): Add SUBSTABLE parameter, + push substitution if requested. Adjust unscoped name handling. + (d_prefix): Reorder main loop. Adjust all calls. + (d_unqualified_name): Add SCOPE parameter, create qualified + name here. Adjust all calls. + (cplus_demangle_type): Do not handle 'S' here, leave all + to d_class_enum_type. + (d_class_enum_type): Add SUBSTABLE parameter. + +2022-05-17 Nathan Sidwell + + * cp-demangle.c (d_make_comp): Adjust. + (d_unqualified_name): Add 'DC' support. + (d_count_template_scopes): Adjust. + (d_print_comp_inner): Add structured binding. + * testsuite/demangle-expected: Add testcases. + +2022-05-10 Martin Liska + + * regex.c: Restore comments. + +2022-05-10 Martin Liska + Alan Modra + + * hashtab.c (htab_empty): Use void * type instead of void **. + (htab_expand): Likewise. + +2022-05-10 Martin Liska + + * random.c: Remove 'define PTR'. + +2022-05-10 Martin Liska + + * alloca.c (C_alloca): Use void * instead PTR. + * calloc.c (malloc): Likewise. + (bzero): Likewise. + (calloc): Likewise. + * hashtab.c (find_empty_slot_for_expand): Likewise. + (eq_pointer): Likewise. + (htab_create_alloc_ex): Likewise. + (htab_create_typed_alloc): Likewise. + (htab_set_functions_ex): Likewise. + (htab_delete): Likewise. + (htab_empty): Likewise. + (htab_expand): Likewise. + (htab_find_with_hash): Likewise. + (htab_find): Likewise. + (htab_find_slot_with_hash): Likewise. + (htab_find_slot): Likewise. + (htab_remove_elt): Likewise. + (htab_remove_elt_with_hash): Likewise. + (htab_clear_slot): Likewise. + (htab_traverse_noresize): Likewise. + (htab_traverse): Likewise. + (htab_hash_string): Likewise. + (iterative_hash): Likewise. + (hash_pointer): Likewise. + * memchr.c (memchr): Likewise. + * memcmp.c (memcmp): Likewise. + * memcpy.c (memcpy): Likewise. + * memmove.c (memmove): Likewise. + * mempcpy.c (memcpy): Likewise. + (mempcpy): Likewise. + * memset.c (memset): Likewise. + * objalloc.c (malloc): Likewise. + (free): Likewise. + (objalloc_create): Likewise. + (_objalloc_alloc): Likewise. + (objalloc_free_block): Likewise. + * random.c (PTR): Likewise. + (void): Likewise. + (initstate): Likewise. + (setstate): Likewise. + * regex.c: Likewise. + * spaces.c (malloc): Likewise. + (free): Likewise. + * stpcpy.c (memcpy): Likewise. + * strdup.c (malloc): Likewise. + (memcpy): Likewise. + * strerror.c (malloc): Likewise. + (memset): Likewise. + * strndup.c (malloc): Likewise. + (memcpy): Likewise. + * strsignal.c (malloc): Likewise. + (memset): Likewise. + * vasprintf.c (malloc): Likewise. + * vprintf-support.c: Likewise. + * xatexit.c (malloc): Likewise. + * xmalloc.c (xmalloc): Likewise. + (xcalloc): Likewise. + (xrealloc): Likewise. + * xmemdup.c (xmemdup): Likewise. + +2022-03-19 Tiezhu Yang + + * floatformat.c (floatformat_ieee_quad_big): Renamed from + floatformat_ia64_quad_big. + (floatformat_ieee_quad_little): Similarly. + +2022-02-22 Jakub Jelinek + + PR lto/104617 + * simple-object-elf.c (simple_object_elf_match): Fix up URL + in comment. + (simple_object_elf_copy_lto_debug_sections): Remap sh_info and + sh_link even if they are in the SHN_LORESERVE .. SHN_HIRESERVE + range (inclusive). + +2022-02-17 Mark Wielaard + + * rust-demangle.c (rust_demangle_callback): Ignore everything + after '.' char in sym for v0. For legacy symbols search + backwards to find the last 'E' before any '.'. + * testsuite/rust-demangle-expected: Add new .suffix testcases. + 2022-01-31 Nick Clifton - PR 98886 - PR 99935 + PR demangler/98886 + PR demangler/99935 * rust-demangle.c (struct rust_demangler): Add a recursion counter. (demangle_path): Increment/decrement the recursion counter upon @@ -14,10 +152,6 @@ * regex.c: Suppress -Wuse-after-free. -2022-01-22 Nick Clifton - - * 2.38 release branch created. - 2021-12-30 Lancelot SIX * cp-demangle.c (d_clone_suffix): Support digits in clone tag diff --git a/libiberty/configure b/libiberty/configure index e09ddd91e58..306c07bd37e 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -2461,6 +2461,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + # This works around the fact that libtool configuration may change LD # for this particular configuration, but some shells, instead of # keeping the changes in LD private, export them just because LD is diff --git a/libiberty/configure.ac b/libiberty/configure.ac index f59f35e1f20..6c1ff9c6093 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure script AC_INIT AC_CONFIG_SRCDIR([xmalloc.c]) +AC_CONFIG_MACRO_DIRS([../config]) # This works around the fact that libtool configuration may change LD # for this particular configuration, but some shells, instead of diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c index bb58d900e27..d6daf23af27 100644 --- a/libiberty/rust-demangle.c +++ b/libiberty/rust-demangle.c @@ -126,7 +126,7 @@ parse_integer_62 (struct rust_demangler *rdm) return 0; x = 0; - while (!eat (rdm, '_')) + while (!eat (rdm, '_') && !rdm->errored) { c = next (rdm); x *= 62; @@ -1082,6 +1082,18 @@ demangle_path_maybe_open_generics (struct rust_demangler *rdm) if (rdm->errored) return open; + if (rdm->recursion != RUST_NO_RECURSION_LIMIT) + { + ++ rdm->recursion; + if (rdm->recursion > RUST_MAX_RECURSION_COUNT) + { + /* FIXME: There ought to be a way to report + that the recursion limit has been reached. */ + rdm->errored = 1; + goto end_of_func; + } + } + if (eat (rdm, 'B')) { backref = parse_integer_62 (rdm); @@ -1107,6 +1119,11 @@ demangle_path_maybe_open_generics (struct rust_demangler *rdm) } else demangle_path (rdm, 0); + + end_of_func: + if (rdm->recursion != RUST_NO_RECURSION_LIMIT) + -- rdm->recursion; + return open; } @@ -1148,6 +1165,15 @@ demangle_const (struct rust_demangler *rdm) if (rdm->errored) return; + if (rdm->recursion != RUST_NO_RECURSION_LIMIT) + { + ++ rdm->recursion; + if (rdm->recursion > RUST_MAX_RECURSION_COUNT) + /* FIXME: There ought to be a way to report + that the recursion limit has been reached. */ + goto fail_return; + } + if (eat (rdm, 'B')) { backref = parse_integer_62 (rdm); @@ -1158,7 +1184,7 @@ demangle_const (struct rust_demangler *rdm) demangle_const (rdm); rdm->next = old_next; } - return; + goto pass_return; } ty_tag = next (rdm); @@ -1167,7 +1193,7 @@ demangle_const (struct rust_demangler *rdm) /* Placeholder. */ case 'p': PRINT ("_"); - return; + goto pass_return; /* Unsigned integer types. */ case 'h': @@ -1200,18 +1226,20 @@ demangle_const (struct rust_demangler *rdm) break; default: - rdm->errored = 1; - return; + goto fail_return; } - if (rdm->errored) - return; - - if (rdm->verbose) + if (!rdm->errored && rdm->verbose) { PRINT (": "); PRINT (basic_type (ty_tag)); } + + fail_return: + rdm->errored = 1; + pass_return: + if (rdm->recursion != RUST_NO_RECURSION_LIMIT) + -- rdm->recursion; } static void -- 2.30.2