Commit Graph

1230 Commits

Author SHA1 Message Date
GCC Administrator 25b6bfea5f Daily bump. 2021-07-01 00:16:41 +00:00
Gerald Pfeifer 13eaeffde5 libiberty: No longer use /usr/tmp
/usr/tmp is antiquated and not present on decently modern systems.
Remove it from consideration when choosing a directory for temporary
files.

libiberty:

2021-06-29  Gerald Pfeifer  <gerald@pfeifer.com>

	* make-temp-file.c (usrtmp): Remove.
	(choose_tmpdir): Remove use of usrtmp.
2021-07-01 00:00:26 +02:00
GCC Administrator c8abc2058e Daily bump. 2021-06-29 00:16:42 +00:00
Indu Bhagat 9c93f6cc95 libiberty: copy over .BTF section when using LTO
libiberty/ChangeLog:

	* simple-object.c (handle_lto_debug_sections): Copy over .BTF section.
2021-06-28 18:47:21 +02:00
Indu Bhagat b7e215a8ee CTF/BTF debug formats
This commit introduces support for generating CTF debugging
information and BTF debugging information from GCC.

2021-06-28  Indu Bhagat  <indu.bhagat@oracle.com>
	    David Faust  <david.faust@oracle.com>
	    Jose E. Marchesi  <jose.marchesi@oracle.com>
	    Weimin Pan  <weimin.pan@oracle.com>

gcc/

	* Makefile.in: Add ctfc.*, ctfout.c and btfout.c files to
	GTFILES.  Add new object files.
	* common.opt: Add CTF and BTF debug info options.
	* btfout.c: New file.
	* ctfc.c: Likewise.
	* ctfc.h: Likewise.
	* ctfout.c: Likewise.
	* dwarf2ctf.c: Likewise.
	* dwarf2ctf.h: Likewise.
	* dwarf2cfi.c (dwarf2out_do_frame): Acknowledge CTF_DEBUG and
	BTF_DEBUG.
	* dwarf2out.c (dwarf2out_source_line): Likewise.
	(dwarf2out_finish): Skip emitting DWARF if CTF or BTF are to
	be generated.
	(debug_format_do_cu): New function.
	(dwarf2out_early_finish): Traverse DIEs and emit CTF/BTF for
	them if	requested.
	Include dwarf2ctf.c.
	* final.c (dwarf2_debug_info_emitted_p): Acknowledge DWARF-based debug
	formats.
	* flag-types.h (enum debug_info_type): Add CTF_DEBUG and BTF_DEBUG.
	(CTF_DEBUG): New bitmask.
	(BTF_DEBUG): Likewise.
	(enum ctf_debug_info_levels): New enum.
	* gengtype.c (open_base_files): Handle ctfc.h.
	(main): Handle uint32_t type.
	* flags.h (btf_debuginfo_p): New definition.
	(dwarf_based_debuginfo_p): Likewise.
	* opts.c (debug_type_names): Add entries for CTF and BTF.
	(btf_debuginfo_p): New function.
	(dwarf_based_debuginfo_p): Likewise.
	(common_handle_option): Handle -gctfN and -gbtf options.
	(set_debug_level): Set CTF_DEBUG, BTF_DEBUG whenever appropriate.
	* toplev.c (process_options): Inform the user and ignore -gctfLEVEL if
	frontend is not C.

include/

	* ctf.h: New file.
	* btf.h: Likewise.

libiberty/

	* simple-object.c (handle_lto_debug_sections): Copy over .ctf
	sections.
2021-06-28 18:47:20 +02:00
GCC Administrator 28c6247505 Daily bump. 2021-06-06 00:16:22 +00:00
John David Anglin a0864ce866 Use libiberty snprintf and vsnprintf on hppa*-*-hpux*.
libiberty/ChangeLog:

	PR target/100734
	* configure.ac: Use libiberty snprintf and vsnprintf on
	hppa*-*-hpux*.
	* configure: Regenerate.
2021-06-05 15:48:04 +00:00
GCC Administrator cfe82a0cbe Daily bump. 2021-05-07 00:16:33 +00:00
Tom Tromey 77380c6806 libiberty: add htab_eq_string
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-06 08:51:28 -06:00
GCC Administrator 99e8df7a4c Daily bump. 2021-05-05 00:16:54 +00:00
Eric Botcazou f418bc3cd1 Fix libiberty link failures in LTO mode for MinGW
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-04 12:53:21 +02:00
GCC Administrator e690396da7 Daily bump. 2021-05-04 00:16:53 +00:00
H.J. Lu fd7eb4bc94 GCC_CET_HOST_FLAGS: Check if host supports multi-byte NOPs
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-05-03 05:00:05 -07:00
GCC Administrator c1ef0c9234 Daily bump. 2021-04-22 00:16:32 +00:00
Andreas Schwab 53bc2e123c Fix endian bug in rust demangler
libiberty/
	PR demangler/100177
	* rust-demangle.c (demangle_const_char): Properly print the
	character value.
2021-04-21 13:28:21 +02:00
GCC Administrator 95d217ab52 Daily bump. 2021-04-01 00:16:39 +00:00
Patrick Palka a3bf6ce7f2 c++: Adjust mangling of __alignof__ [PR88115]
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-30 22:57:11 -04:00
GCC Administrator bc2127767a Daily bump. 2021-03-17 00:16:25 +00:00
Nick Clifton f6e9c1c919 Fix potentially undefined behaviour when computing a sha1 value.
libiberty/
	* sha1.c (sha1_process_bytes): Use memmove in place of memcpy.
2021-03-16 14:43:17 +00:00
GCC Administrator b2a55cafa8 Daily bump. 2021-02-21 00:16:18 +00:00
Mike Frysinger 470beb9219 libiberty: autogenerate aclocal.m4
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-20 03:33:32 -05:00
GCC Administrator 50352c6cd2 Daily bump. 2021-02-20 00:16:26 +00:00
Ayush Mittal 0b2b7ef367 [PATCH v2] libiberty(argv.c): Fix memory leak in expandargv
libiberty:
	* argv.c (expandargv): free allocated buffer if read fails.
2021-02-18 22:00:06 -07:00
GCC Administrator f7884fb176 Daily bump. 2021-02-02 00:16:23 +00:00
Martin Sebor 445d6db649 Avoid -Wstringop-truncation.
libiberty/ChangeLog:

	* dyn-string.c (dyn_string_insert_cstr): Use memcpy instead of strncpy
	to avoid -Wstringop-truncation.
2021-02-01 09:00:02 -07:00
GCC Administrator 7e73f51157 Daily bump. 2021-01-05 00:16:42 +00:00
Martin Liska a40718b5fc Convert 2 files to utf8.
libiberty/ChangeLog:

	* strverscmp.c: Convert to utf8 from iso8859.

gcc/testsuite/ChangeLog:

	* README: Convert to utf8 from iso8859.
2021-01-04 11:35:17 +01:00
Jakub Jelinek 99dee82307 Update copyright years. 2021-01-04 10:26:59 +01:00
GCC Administrator 077fefbfae Daily bump. 2020-12-23 00:16:35 +00:00
Jason Merrill 58fb912c15 c++: Fix demangling of <unresolved-name>
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-21 21:13:41 -05:00
GCC Administrator 1a5e728a54 Daily bump. 2020-12-22 00:16:23 +00:00
Jason Merrill 8cd42d3cc2 c++: Fix demangling of qualified-id after '.'
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-21 16:39:48 -05:00
Jason Merrill 7169049332 c++: Fix demangling of x.operator type
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-12-21 15:46:14 -05:00
GCC Administrator 360258daf5 Daily bump. 2020-11-26 00:16:41 +00:00
Matthew Malcomson 170e618ef5 libsanitizer: Add option to bootstrap using HWASAN
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-25 16:35:37 +00:00
GCC Administrator 77f67db2a4 Daily bump. 2020-11-14 00:16:38 +00:00
Eduard-Mihai Burtescu 84096498a7 libiberty: Support the new ("v0") mangling scheme in rust-demangle
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-13 18:59:09 +00:00
Seija Kijin 16b00dc63f Make strstr.c in libiberty ANSI compliant
libiberty/

	* strstr.c (strstr): Make implementation ANSI/POSIX compliant.
2020-11-13 11:53:16 -07:00
GCC Administrator 0f5f9ed5e5 Daily bump. 2020-11-12 00:16:39 +00:00
Patrick Palka b1c9b3c340 c++: Change the mangling of __alignof__ [PR88115]
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-11 15:11:23 -05:00
GCC Administrator 2bee28dd41 Daily bump. 2020-11-10 00:16:24 +00:00
Christophe Lyon 946b73c113 libiberty/pex-win32.c: Initialize orig_err
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-11-09 07:15:15 +00:00
GCC Administrator 8e97b9052d Daily bump. 2020-10-07 00:16:35 +00:00
Martin Liska 190c04ba36 lto: fix LTO debug sections copying.
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-10-06 16:07:02 +02:00
GCC Administrator a2b7397b50 Daily bump. 2020-09-25 00:16:27 +00:00
Mark Wielaard 942ab9e9d4 libiberty: Add get_DW_UT_name and update include/dwarf2.{def,h}
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-24 22:37:10 +02:00
GCC Administrator 31a0504624 Daily bump. 2020-09-09 00:16:29 +00:00
Felix Willgerodt 87603e5656 floatformat.h: Add bfloat16 support.
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-08 17:38:12 +00:00
Alan Modra fff56ce438 ubsan: d-demangle.c:214 signed integer overflow
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-09-08 10:45:15 +09:30
GCC Administrator 57ea089421 Daily bump. 2020-08-27 00:16:27 +00:00