aboutsummaryrefslogtreecommitdiff
path: root/libiberty
AgeCommit message (Collapse)AuthorFilesLines
2021-05-06libiberty: add htab_eq_stringTom Tromey1-0/+7
The libiberty hash table includes a helper function for strings, but no equality function. Consequently, this equality function has been reimplemented a number of times in both the gcc and binutils-gdb source trees. This patch adds the function to the libiberty hash table, as a step toward the goal of removing all the copies. One change to gcc is included here. Normally I would have put this in the next patch, but gensupport.c used the most natural name for its reimplementation of this function, and this can't coexist with the extern function in libiberty. include * hashtab.h (htab_eq_string): Declare. libiberty * hashtab.c (htab_eq_string): New function. gcc * gensupport.c (htab_eq_string): Remove.
2021-05-05Daily bump.GCC Administrator1-0/+5
2021-05-04Fix libiberty link failures in LTO mode for MinGWEric Botcazou2-3/+3
The test for the presence of variables (really symbols) does not work when you add -Ox -flto to CFLAGS: for v in $vars; do AC_MSG_CHECKING([for $v]) AC_CACHE_VAL(libiberty_cv_var_$v, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])], [eval "libiberty_cv_var_$v=yes"], [eval "libiberty_cv_var_$v=no"])]) if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED($n) else AC_MSG_RESULT(no) fi done because the assignment to 'p' is optimized away by LTO. This is visible on MinGW platforms in the form of a link failure for sys_siglist. There is another link failures for stpcpy: the symbol is both referenced by libiberty's pex-win32.c and provided by libiberty's stpcpy.c, so it needs to have a linkage to be resolved in LTO mode. libiberty/ * configure.ac: Make test for variables more robust. * configure: Regenerate. gcc/ * builtins.c (builtin_with_linkage_p): Return true for stp[n]cpy. * symtab.c (symtab_node::output_to_lto_symbol_table_p): Tidy up.
2021-05-04Daily bump.GCC Administrator1-0/+5
2021-05-03GCC_CET_HOST_FLAGS: Check if host supports multi-byte NOPsH.J. Lu1-0/+29
Sync with binutils for PR binutils/27397. Check if host supports multi-byte NOPs before enabling CET on host. config/ PR bootstrap/99703 * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte NOPs. libiberty/ PR bootstrap/99703 * configure: Regenerated.
2021-04-22Daily bump.GCC Administrator1-0/+6
2021-04-21Fix endian bug in rust demanglerAndreas Schwab1-3/+6
libiberty/ PR demangler/100177 * rust-demangle.c (demangle_const_char): Properly print the character value.
2021-04-01Daily bump.GCC Administrator1-0/+11
2021-03-30c++: Adjust mangling of __alignof__ [PR88115]Patrick Palka2-22/+29
r11-4926 made __alignof__ get mangled differently from alignof, encoding __alignof__ as a vendor extended operator. But this mangling is problematic for the reasons mentioned in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88115#c6. This patch changes our mangling of __alignof__ to instead use the new "vendor extended expression" syntax that's proposed in https://github.com/itanium-cxx-abi/cxx-abi/issues/112. Clang does the same thing already, so after this patch Clang and GCC agree about the mangling of __alignof__(type) and __alignof__(expr). gcc/cp/ChangeLog: PR c++/88115 * mangle.c (write_expression): Adjust the mangling of __alignof__. include/ChangeLog: PR c++/88115 * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_VENDOR_EXPR. libiberty/ChangeLog: PR c++/88115 * cp-demangle.c (d_dump, d_make_comp, d_expression_1) (d_count_templates_scopes): Handle DEMANGLE_COMPONENT_VENDOR_EXPR. (d_print_comp_inner): Likewise. <case DEMANGLE_COMPONENT_EXTENDED_OPERATOR>: Revert r11-4926 change. <case DEMANGLE_COMPONENT_UNARY>: Likewise. * testsuite/demangle-expected: Adjust __alignof__ tests. gcc/testsuite/ChangeLog: PR c++/88115 * g++.dg/cpp0x/alignof7.C: Adjust expected mangling.
2021-03-17Daily bump.GCC Administrator1-0/+4
2021-03-16Fix potentially undefined behaviour when computing a sha1 value.Nick Clifton1-1/+1
libiberty/ * sha1.c (sha1_process_bytes): Use memmove in place of memcpy.
2021-02-21Daily bump.GCC Administrator1-0/+11
2021-02-20libiberty: autogenerate aclocal.m4Mike Frysinger4-183/+215
Move custom macros to acinclude.m4 so we can autogenerate aclocal.m4 with aclocal. This matches every other project in the tree. libiberty/ChangeLog: * Makefile.in (ACLOCAL, ACLOCAL_AMFLAGS, $(srcdir)/aclocal.m4): Define. (configure_deps): Rename to ... (aclocal_deps): ... this. Replace aclocal.m4 with acinclude.m4. ($(srcdir)/configure): Replace $(configure_deps) with $(srcdir)/aclocal.m4. * aclocal.m4: Move libiberty macros to acinclude.m4, then regenerate. * acinclude.m4: New file. * configure: Regenerate.
2021-02-20Daily bump.GCC Administrator1-0/+4
2021-02-18[PATCH v2] libiberty(argv.c): Fix memory leak in expandargvAyush Mittal1-1/+4
libiberty: * argv.c (expandargv): free allocated buffer if read fails.
2021-02-02Daily bump.GCC Administrator1-0/+5
2021-02-01Avoid -Wstringop-truncation.Martin Sebor1-1/+1
libiberty/ChangeLog: * dyn-string.c (dyn_string_insert_cstr): Use memcpy instead of strncpy to avoid -Wstringop-truncation.
2021-01-05Daily bump.GCC Administrator1-0/+4
2021-01-04Convert 2 files to utf8.Martin Liska1-1/+1
libiberty/ChangeLog: * strverscmp.c: Convert to utf8 from iso8859. gcc/testsuite/ChangeLog: * README: Convert to utf8 from iso8859.
2021-01-04Update copyright years.Jakub Jelinek93-94/+94
2020-12-23Daily bump.GCC Administrator1-0/+11
2020-12-21c++: Fix demangling of <unresolved-name>Jason Merrill3-22/+72
The ABI for unresolved scoped names on the RHS of . and -> used to be sr <type> <unqualified-id> That changed years ago to something more complex, but G++ was never updated. This change was particularly incompatible for simple qualified-ids like A::x, which were previously mangled as sr1A1x, and now sr1AE1x. This obviously makes life hard for demanglers, which can't know whether to consume that E or not. To work around this, we now try demangling with the newer ABI, and if that fails and we saw an "sr", try again with the older ABI. libiberty/ChangeLog: PR c++/67343 * cp-demangle.h (struct d_info): Add unresolved_name_state. * cp-demangle.c (d_prefix): Add subst parm. (d_nested_name): Pass it. (d_unresolved_name): Split out from... (d_expression_1): ...here. (d_demangle_callback): Maybe retry with old sr mangling. * testsuite/demangle-expected: Add test.
2020-12-22Daily bump.GCC Administrator1-0/+11
2020-12-21c++: Fix demangling of qualified-id after '.'Jason Merrill2-4/+19
The demangler was assuming that only an unqualified-id could appear after . or ->. libiberty/ChangeLog: * cp-demangle.c (d_expression_1): Recognize qualified-id on RHS of dt/pt. * testsuite/demangle-expected: Add test.
2020-12-21c++: Fix demangling of x.operator typeJason Merrill2-1/+13
d_operator_name decides whether "cv" indicates a cast or a conversion operator based on is_expression. "on" specifies that we want the conversion operator. libiberty/ChangeLog: * cp-demangle.c (d_unqualified_name): Clear is_expression. * testsuite/demangle-expected: Add tests.
2020-11-26Daily bump.GCC Administrator1-0/+5
2020-11-25libsanitizer: Add option to bootstrap using HWASANMatthew Malcomson2-0/+2
This is an analogous option to --bootstrap-asan to configure. It allows bootstrapping GCC using HWASAN. For the same reasons as for ASAN we have to avoid using the HWASAN sanitizer when compiling libiberty and the lto-plugin. Also add a function to query whether -fsanitize=hwaddress has been passed. ChangeLog: * configure: Regenerate. * configure.ac: Add --bootstrap-hwasan option. config/ChangeLog: * bootstrap-hwasan.mk: New file. gcc/ChangeLog: * doc/install.texi: Document new option. libiberty/ChangeLog: * configure: Regenerate. * configure.ac: Avoid using sanitizer. lto-plugin/ChangeLog: * Makefile.am: Avoid using sanitizer. * Makefile.in: Regenerate.
2020-11-14Daily bump.GCC Administrator1-0/+32
2020-11-13libiberty: Support the new ("v0") mangling scheme in rust-demangleEduard-Mihai Burtescu2-11/+1133
This is the libiberty (mainly for binutils/gdb) counterpart of https://github.com/alexcrichton/rustc-demangle/pull/23. Relevant links for the new Rust mangling scheme (aka "v0"): * Rust RFC: https://github.com/rust-lang/rfcs/pull/2603 * tracking issue: https://github.com/rust-lang/rust/issues/60705 * implementation: https://github.com/rust-lang/rust/pull/57967 This implementation includes full support for UTF-8 identifiers via punycode, so I've included a testcase for that as well. libiberty/ChangeLog: * rust-demangle.c (struct rust_demangler): Add skipping_printing and bound_lifetime_depth fields. (eat): Add (v0-only). (parse_integer_62): Add (v0-only). (parse_opt_integer_62): Add (v0-only). (parse_disambiguator): Add (v0-only). (struct rust_mangled_ident): Add punycode{,_len} fields. (parse_ident): Support v0 identifiers. (print_str): Respect skipping_printing. (print_uint64): Add (v0-only). (print_uint64_hex): Add (v0-only). (print_ident): Respect skipping_printing, Support v0 identifiers. (print_lifetime_from_index): Add (v0-only). (demangle_binder): Add (v0-only). (demangle_path): Add (v0-only). (demangle_generic_arg): Add (v0-only). (demangle_type): Add (v0-only). (demangle_path_maybe_open_generics): Add (v0-only). (demangle_dyn_trait): Add (v0-only). (demangle_const): Add (v0-only). (demangle_const_uint): Add (v0-only). (basic_type): Add (v0-only). (rust_demangle_callback): Support v0 symbols. * testsuite/rust-demangle-expected: Add v0 testcases.
2020-11-13Make strstr.c in libiberty ANSI compliantSeija Kijin1-11/+5
libiberty/ * strstr.c (strstr): Make implementation ANSI/POSIX compliant.
2020-11-12Daily bump.GCC Administrator1-0/+10
2020-11-11c++: Change the mangling of __alignof__ [PR88115]Patrick Palka2-5/+27
This patch changes the mangling of __alignof__ to v111__alignof__, making its mangling distinct from that of alignof(type) and alignof(expr). How we mangle ALIGNOF_EXPR now depends on its ALIGNOF_EXPR_STD_P flag, which after the previous patch gets consistently set for alignof(type) as well as alignof(expr). gcc/c-family/ChangeLog: PR c++/88115 * c-opts.c (c_common_post_options): Update latest_abi_version. gcc/ChangeLog: PR c++/88115 * common.opt (-fabi-version): Document =15. * doc/invoke.texi (C++ Dialect Options): Likewise. gcc/cp/ChangeLog: PR c++/88115 * mangle.c (write_expression): Mangle __alignof_ differently from alignof when the ABI version is at least 15. libiberty/ChangeLog: PR c++/88115 * cp-demangle.c (d_print_comp_inner) <case DEMANGLE_COMPONENT_EXTENDED_OPERATOR>: Don't print the "operator " prefix for __alignof__. <case DEMANGLE_COMPONENT_UNARY>: Always print parens around the operand of __alignof__. * testsuite/demangle-expected: Test demangling for __alignof__. gcc/testsuite/ChangeLog: PR c++/88115 * g++.dg/abi/macro0.C: Adjust. * g++.dg/cpp0x/alignof7.C: New test. * g++.dg/cpp0x/alignof8.C: New test.
2020-11-10Daily bump.GCC Administrator1-0/+4
2020-11-09libiberty/pex-win32.c: Initialize orig_errChristophe Lyon1-1/+1
Initializing orig_err avoids a warning: "may be used uninitialized". See 97108. 2020-09-14 Torbjörn SVENSSON <torbjorn.svensson@st.com> Christophe Lyon <christophe.lyon@linaro.org> libiberty/ * pex-win32.c (pex_win32_exec_child): Initialize orig_err.
2020-10-07Daily bump.GCC Administrator1-0/+6
2020-10-06lto: fix LTO debug sections copying.Martin Liska1-4/+7
readelf -S prints: There are 81999 section headers, starting at offset 0x1f488060: Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 01404f 00 81998 0 0 [ 1] .group GROUP 0000000000000000 000040 000008 04 81995 105027 4 ... [81995] .symtab SYMTAB 0000000000000000 d5d9298 2db310 18 81997 105026 8 [81996] .symtab_shndx SYMTAB SECTION INDICES 0000000000000000 d8b45a8 079dd8 04 81995 0 4 [81997] .strtab STRTAB 0000000000000000 d92e380 80460c 00 0 0 1 ... Looking at the documentation: Table 7–15 ELF sh_link and sh_info Interpretation sh_type - sh_link SHT_SYMTAB - The section header index of the associated string table. SHT_SYMTAB_SHNDX - The section header index of the associated symbol table. As seen, sh_link of a SHT_SYMTAB always points to a .strtab and readelf confirms that. So we need to use reverse mapping taken from [81996] .symtab_shndx SYMTAB SECTION INDICES 0000000000000000 d8b45a8 079dd8 04 81995 0 4 where sh_link points to 81995. libiberty/ChangeLog: PR lto/97290 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Use sh_link of a .symtab_shndx section.
2020-09-25Daily bump.GCC Administrator1-0/+5
2020-09-24libiberty: Add get_DW_UT_name and update include/dwarf2.{def,h}Mark Wielaard1-0/+7
This adds a get_DW_UT_name function to dwarfnames using dwarf2.def for use in binutils readelf to show the unit types in a DWARF5 header. Also remove DW_CIE_VERSION which was already removed in binutils/gdb and is not used in gcc. include/ChangeLog: * dwarf2.def: Add DWARF5 Unit type header encoding macros DW_UT_FIRST, DW_UT and DW_UT_END. * dwarf2.h (enum dwarf_unit_type): Removed and define using DW_UT_FIRST, DW_UT and DW_UT_END macros. (DW_CIE_VERSION): Removed. (get_DW_UT_name): New function declaration. libiberty/ChangeLog: * dwarfnames.c (get_DW_UT_name): Define using DW_UT_FIRST, DW_UT and DW_UT_END.
2020-09-09Daily bump.GCC Administrator1-0/+31
2020-09-08floatformat.h: Add bfloat16 support.Felix Willgerodt1-1/+18
This change is motivated by a patchset that adds bfloat16 debugging support for new avx512 instructions to GDB. The gdb thread can be found here: https://sourceware.org/pipermail/gdb-patches/2020-July/170820.html include: 2020-08-17 Felix Willgerodt <felix.willgerodt@intel.com> * floatformat.h (floatformat_bfloat16_big): New. (floatformat_bfloat16_little): New. libiberty: 2020-08-17 Felix Willgerodt <felix.willgerodt@intel.com> * floatformat.c (floatformat_bfloat16_big): New. (floatformat_bfloat16_little): New.
2020-09-08ubsan: d-demangle.c:214 signed integer overflowAlan Modra2-45/+69
Running the libiberty testsuite ./test-demangle < libiberty/testsuite/d-demangle-expected libiberty/d-demangle.c:214:14: runtime error: signed integer overflow: 922337203 * 10 cannot be represented in type 'long int' On looking at silencing ubsan, I found a real bug in dlang_number. For a 32-bit long, some overflows won't be detected. For example, 21474836480. Why? Well 214748364 * 10 is 0x7FFFFFF8 (no overflow so far). Adding 8 gives 0x80000000 (which does overflow but there is no test for that overflow in the code). Then multiplying 0x80000000 * 10 = 0x500000000 = 0 won't be caught by the multiplication overflow test. The same holds for a 64-bit long using similarly crafted digit sequences. * d-demangle.c: Include limits.h. (ULONG_MAX, UINT_MAX): Provide fall-back definition. (dlang_number): Simplify and correct overflow test. Only write *ret on returning non-NULL. Make "ret" an unsigned long*. Only succeed for result of [0,UINT_MAX]. (dlang_decode_backref): Simplify and correct overflow test. Only write *ret on returning non-NULL. Only succeed for result [1,MAX_LONG]. (dlang_backref): Remove now unnecessary range check. (dlang_symbol_name_p): Likewise. (string_need): Take a size_t n arg, and use size_t tem. (string_append): Use size_t n. (string_appendn, string_prependn): Take a size_t n arg. (TEMPLATE_LENGTH_UNKNOWN): Define as -1UL. (dlang_lname, dlang_parse_template): Take an unsigned long len arg. (dlang_symbol_backref, dlang_identifier, dlang_parse_integer), (dlang_parse_integer, dlang_parse_string), (dlang_parse_arrayliteral, dlang_parse_assocarray), (dlang_parse_structlit, dlang_parse_tuple), (dlang_template_symbol_param, dlang_template_args): Use unsigned long variables. * testsuite/d-demangle-expected: Add new tests.
2020-08-27Daily bump.GCC Administrator1-0/+7
2020-08-26libiberty: Add support for `in' and `in ref' storage classes.Iain Buclaw2-9/+17
The storage class `in' is now a first-class citizen with its own mangle symbol, of which also permits `in ref'. Previously, `in' was an alias to `const [scope]', which is a type constructor. The mangle symbol repurposed for this is `I', which was originally used by identifier types. However, while TypeIdentifier is part of the grammar, it must be resolved to some other entity during the semantic passes, and so shouldn't appear anywhere in the mangled name. Old tests that are now no longer valid have been removed. libiberty/ChangeLog: * d-demangle.c (dlang_function_args): Handle 'in' and 'in ref' parameter storage classes. (dlang_type): Remove identifier type. * testsuite/d-demangle-expected: Update tests.
2020-08-04Daily bump.GCC Administrator1-0/+7
2020-08-03lto/96385 - avoid unused global UNDEFs in debug objectsRichard Biener1-0/+5
Unused global UNDEFs can have side-effects in some circumstances so the following patch avoids them by treating them the same as other to be discarded DEFs - make them local. 2020-08-03 Richard Biener <rguenther@suse.de> PR lto/96385 libiberty/ * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Localize global UNDEFs and reuse the prevailing name.
2020-07-31Daily bump.GCC Administrator1-0/+5
2020-07-30Require CET support only for the final GCC buildH.J. Lu1-4/+17
With --enable-cet, require CET support only for the final GCC build. Don't enable CET without CET support for non-bootstrap build, in stage1 nor for build support. config/ PR bootstrap/96202 * cet.m4 (GCC_CET_HOST_FLAGS): Don't enable CET without CET support in stage1 nor for build support. gcc/ PR bootstrap/96202 * configure: Regenerated. libbacktrace/ PR bootstrap/96202 * configure: Regenerated. libcc1/ PR bootstrap/96202 * configure: Regenerated. libcpp/ PR bootstrap/96202 * configure: Regenerated. libdecnumber/ PR bootstrap/96202 * configure: Regenerated. libiberty/ PR bootstrap/96202 * configure: Regenerated. lto-plugin/ PR bootstrap/96202 * configure: Regenerated.
2020-07-15Daily bump.GCC Administrator1-0/+7
2020-07-14demangler: don't treat lambda as a substitution candidateIan Lance Taylor2-8/+9
libiberty/ChangeLog: PR demangler/96143 * cp-demangle.c (d_lambda): Don't add substitution candidate. * testsuite/demangle-expected: Update a few existing test cases accordingly, and add a new test case.
2020-07-11Daily bump.GCC Administrator1-0/+8