Commit Graph

1396 Commits

Author SHA1 Message Date
GCC Administrator
b563a8dd3f Daily bump. 2022-07-23 00:16:27 +00:00
Martin Liska
aaf9583d4c remove 'continue' as last statement in loop
PR other/106370

gcc/cp/ChangeLog:

	* init.cc (sort_mem_initializers): Remove continue as last stmt
	in a loop.

libiberty/ChangeLog:

	* _doprnt.c: Remove continue as last stmt
	in a loop.
2022-07-22 09:28:48 +02:00
GCC Administrator
e0e07bc762 Daily bump. 2022-07-15 00:16:22 +00:00
Martin Liska
9f7f049989 libiberty: fix docs typo
libiberty/ChangeLog:

	* functions.texi: Replace strtoul with strtoull.
2022-07-14 11:34:02 +02:00
GCC Administrator
8467574d8d Daily bump. 2022-07-05 00:16:36 +00:00
Nick Clifton
fc968115a7 Fix typo in recent code to add stack recursion limit to the Rust demangler.
libiberty
	* rust-demangle.c (demangle_const): Add a missing goto pass_return
	at the end of the function.
2022-07-04 16:31:18 +01:00
Nick Clifton
1a770b01ef Prevent another potential stack overflow issue when demangling a maliciouslt mangled Rust name.
libiberty/
	* rust-demangle.c (demangle_path_maybe_open_generics): Add
	recursion limit.
2022-07-04 11:05:03 +01:00
GCC Administrator
ed97448899 Daily bump. 2022-07-02 00:16:26 +00:00
Nick Clifton
9234cdca6e Add a recursion limit to the demangle_const function in the Rust demangler.
libiberty/
	PR demangler/105039
	* rust-demangle.c (demangle_const): Add recursion limit.
2022-07-01 16:00:06 +01:00
GCC Administrator
b2b72757b2 Daily bump. 2022-06-27 00:16:20 +00:00
Simon Marchi
1f237573ca Make it easier to rebuild configure files.
Add

  AC_CONFIG_MACRO_DIRS([../config])

So that just running:

  $ autoreconf -vf

... does the right thing (no need to specify -I ../config).

Note: I don't have access to the gcc repo, so if this patch is approved,
can somebody push it there on my behalf?  I can push it to binutils-gdb.

libiberty/ChangeLog:

	* configure.ac: Add AC_CONFIG_MACRO_DIRS call.
	* configure: Re-generate.
2022-06-26 14:43:33 -04:00
GCC Administrator
168fc8bda1 Daily bump. 2022-05-24 00:17:03 +00:00
Nathan Sidwell
b7feb71d45 demangler: C++ modules support
This adds demangling support for C++ modules.  A new 'W' component
along with augmented behaviour of 'S' components.

	include/
	* demangle.h (enum demangle_component_type): Add module components.
	libiberty/
	* 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-23 05:39:15 -07:00
GCC Administrator
1cda629f96 Daily bump. 2022-05-19 00:16:32 +00:00
Nathan Sidwell
65851d65fb demangler: Reorganize for module demangling
Module demangling requires some changes in how substitutions are
handled.  This adjusts things to make that possible.

	libiberty/
	* 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-18 03:58:55 -07:00
GCC Administrator
3d9439b1bb Daily bump. 2022-05-18 00:16:36 +00:00
Nathan Sidwell
451894cadc demangler: Structured Bindings
C++ Structured bindings have a mangling that has yet to be formally
documented.  However, it's been around for a while and shows up for
module support.

	include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_STRUCTURED_BINDING.
	libiberty/
	* 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-17 11:10:03 -07:00
GCC Administrator
e877898911 Daily bump. 2022-05-11 00:16:40 +00:00
Martin Liska
098f02aa15 libiberty: fix wrong replacent in comments
libiberty/ChangeLog:

	* regex.c: Restore comments.
2022-05-10 17:36:28 +02:00
Martin Liska
5dac43b43c libiberty: fix type in allocation
The allocation function alloc_f is called for nsize
items where each is of type void *.

libiberty/ChangeLog:

	* hashtab.c (htab_empty): Use void * type instead of void **.
	(htab_expand): Likewise.

Co-Authored-By: Alan Modra <amodra@gmail.com>
2022-05-10 17:32:44 +02:00
Martin Liska
9cb69e7884 libiberty: fix bad replacement.
libiberty/ChangeLog:

	* random.c: Remove 'define PTR'.
2022-05-10 17:00:34 +02:00
Martin Liska
50b009c5da libiberty: stop using PTR macro
include/ChangeLog:

	* hashtab.h (HTAB_EMPTY_ENTRY): Use void * instead PTR.
	(HTAB_DELETED_ENTRY): Likewise.

libiberty/ChangeLog:

	* 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-05-10 16:04:30 +02:00
GCC Administrator
d7f00da1c0 Daily bump. 2022-03-20 00:16:30 +00:00
Tiezhu Yang
b2dff6b2d9 rename floatformat_ia64_quad_{big, little} to floatformat_ieee_quad_{big, little}
I submitted a GDB patch [1] to rename floatformats_ia64_quad to
floatformats_ieee_quad to reflect the reality, and then we can
clean up the related code.

As GDB Global Maintainer Tom Tromey said [2]:

  These files are maintained in gcc and then imported into the
  binutils-gdb repository, so any changes to them will have to
  be proposed there first.

this GCC patch is preparation for the GDB patch, no functionality
change.

[1] https://sourceware.org/pipermail/gdb-patches/2022-March/186452.html
[2] https://sourceware.org/pipermail/gdb-patches/2022-March/186569.html

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>

include/
	* floatformat.h (floatformat_ieee_quad_big): Renamed from
	floatformat_ia64_quad_big.
	(floatformat_ieee_quad_little): Similarly.

libiberty/
	* floatformat.c (floatformat_ieee_quad_big): Renamed from
	floatformat_ia64_quad_big.
	(floatformat_ieee_quad_little): Similarly.
2022-03-19 13:33:40 -04:00
GCC Administrator
2cfb33fc1e Daily bump. 2022-02-23 00:16:24 +00:00
Jakub Jelinek
2f59f06761 libiberty: Fix up debug.temp.o creation if *.o has 64K+ sections [PR104617]
On
 #define A(n) int foo1##n(void) { return 1##n; }
 #define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) A(n##5) A(n##6) A(n##7) A(n##8) A(n##9)
 #define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) B(n##5) B(n##6) B(n##7) B(n##8) B(n##9)
 #define D(n) C(n##0) C(n##1) C(n##2) C(n##3) C(n##4) C(n##5) C(n##6) C(n##7) C(n##8) C(n##9)
 #define E(n) D(n##0) D(n##1) D(n##2) D(n##3) D(n##4) D(n##5) D(n##6) D(n##7) D(n##8) D(n##9)
 E(0) E(1) E(2) D(30) D(31) C(320) C(321) C(322) C(323) C(324) C(325)
 B(3260) B(3261) B(3262) B(3263) A(32640) A(32641) A(32642)
testcase with
./xgcc -B ./ -c -g -fpic -ffat-lto-objects -flto  -O0 -o foo1.o foo1.c -ffunction-sections
./xgcc -B ./ -shared -g -fpic -flto -O0 -o foo1.so foo1.o
/tmp/ccTW8mBm.debug.temp.o: file not recognized: file format not recognized
(testcase too slow to be included into testsuite).
The problem is clearly reported by readelf:
readelf: foo1.o.debug.temp.o: Warning: Section 2 has an out of range sh_link value of 65321
readelf: foo1.o.debug.temp.o: Warning: Section 5 has an out of range sh_link value of 65321
readelf: foo1.o.debug.temp.o: Warning: Section 10 has an out of range sh_link value of 65323
readelf: foo1.o.debug.temp.o: Warning: [ 2]: Link field (65321) should index a symtab section.
readelf: foo1.o.debug.temp.o: Warning: [ 5]: Link field (65321) should index a symtab section.
readelf: foo1.o.debug.temp.o: Warning: [10]: Link field (65323) should index a string section.
because simple_object_elf_copy_lto_debug_sections doesn't adjust sh_info and
sh_link fields in ElfNN_Shdr if they are in between SHN_{LO,HI}RESERVE
inclusive.  Not adjusting those is incorrect though, SHN_{LO,HI}RESERVE
range is only relevant to the 16-bit fields, mainly st_shndx in ElfNN_Sym
where if one needs >= SHN_LORESERVE section number, SHN_XINDEX should be
used instead and .symtab_shndx section should contain the real section
index, and in ElfNN_Ehdr e_shnum and e_shstrndx fields, where if >=
SHN_LORESERVE value is needed it should put those into
Shdr[0].sh_{size,link}.  But, sh_{link,info} are 32-bit fields which can
contain any section index.

Note, as simple-object-elf.c mentions, binutils from 2.12 to 2.18 (so before
2011) used to mishandle the > 63.75K sections case and assumed there is a
hole in between the sections, but what
simple_object_elf_copy_lto_debug_sections does wouldn't help in that case
for the debug temp object creation, we'd need to detect the case also in
that routine and take it into account in the remapping etc.  I think
it is not worth it given that it is over 10 years, if somebody needs
63.75K or more sections, better use more recent binutils.

2022-02-22  Jakub Jelinek  <jakub@redhat.com>

	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-22 11:33:45 +01:00
GCC Administrator
0bdb049877 Daily bump. 2022-02-18 00:16:39 +00:00
Mark Wielaard
d3b2ead595 libiberty rust-demangle, ignore .suffix
Rust symbols can have a .suffix because of compiler transformations.
These can be ignored in the demangled name. Which is what this patch
implements. By stopping at the first dot for v0 symbols and searching
backwards to the ending 'E' for legacy symbols.

An alternative implementation could be to follow what C++ does and
represent these as [clone .suffix] tagged onto the demangled name.
But this seems somewhat confusing since it results in a demangled
name that cannot be mangled again. And it would mean trying to
decode compiler internal naming.

https://bugs.kde.org/show_bug.cgi?id=445916
https://github.com/rust-lang/rust/issues/60705

libiberty/Changelog

	* 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-02-17 18:06:24 +01:00
GCC Administrator
1bb5266257 Daily bump. 2022-02-01 00:16:29 +00:00
Nick Clifton
f10bec5ffa libiberty: Fix infinite recursion in rust demangler.
libiberty/
	PR demangler/98886
	PR demangler/99935
	* rust-demangle.c (struct rust_demangler): Add a recursion
	counter.
	(demangle_path): Increment/decrement the recursion counter upon
	entry and exit.  Fail if the counter exceeds a fixed limit.
	(demangle_type): Likewise.
	(rust_demangle_callback): Initialise the recursion counter,
	disabling if requested by the option flags.
2022-01-31 14:33:34 +00:00
GCC Administrator
9248ee4147 Daily bump. 2022-01-16 00:16:26 +00:00
Martin Sebor
671a283636 Add -Wuse-after-free [PR80532].
gcc/c-family/ChangeLog

	PR tree-optimization/80532
	* c.opt (-Wuse-after-free): New options.

gcc/ChangeLog:

	PR tree-optimization/80532
	* common.opt (-Wuse-after-free): New options.
	* diagnostic-spec.c (nowarn_spec_t::nowarn_spec_t): Handle
	OPT_Wreturn_local_addr and OPT_Wuse_after_free_.
	* diagnostic-spec.h (NW_DANGLING): New enumerator.
	* doc/invoke.texi (-Wuse-after-free): Document new option.
	* gimple-ssa-warn-access.cc (pass_waccess::check_call): Rename...
	(pass_waccess::check_call_access): ...to this.
	(pass_waccess::check): Rename...
	(pass_waccess::check_block): ...to this.
	(pass_waccess::check_pointer_uses): New function.
	(pass_waccess::gimple_call_return_arg): New function.
	(pass_waccess::warn_invalid_pointer): New function.
	(pass_waccess::check_builtin): Handle free and realloc.
	(gimple_use_after_inval_p): New function.
	(get_realloc_lhs): New function.
	(maybe_warn_mismatched_realloc): New function.
	(pointers_related_p): New function.
	(pass_waccess::check_call): Call check_pointer_uses.
	(pass_waccess::execute): Compute and free dominance info.

libcpp/ChangeLog:

	* files.c (_cpp_find_file): Substitute a valid pointer for
	an invalid one to avoid -Wuse-after-free.

libiberty/ChangeLog:

	* regex.c: Suppress -Wuse-after-free.

gcc/testsuite/ChangeLog:

	PR tree-optimization/80532
	* gcc.dg/Wmismatched-dealloc-2.c: Avoid -Wuse-after-free.
	* gcc.dg/Wmismatched-dealloc-3.c: Same.
	* gcc.dg/analyzer/file-1.c: Prune expected warning.
	* gcc.dg/analyzer/file-2.c: Same.
	* gcc.dg/attr-alloc_size-6.c: Disable -Wuse-after-free.
	* gcc.dg/attr-alloc_size-7.c: Same.
	* c-c++-common/Wuse-after-free-2.c: New test.
	* c-c++-common/Wuse-after-free-3.c: New test.
	* c-c++-common/Wuse-after-free-4.c: New test.
	* c-c++-common/Wuse-after-free-5.c: New test.
	* c-c++-common/Wuse-after-free-6.c: New test.
	* c-c++-common/Wuse-after-free-7.c: New test.
	* c-c++-common/Wuse-after-free.c: New test.
	* g++.dg/warn/Wmismatched-dealloc-3.C: New test.
	* g++.dg/warn/Wuse-after-free.C: New test.
2022-01-15 16:45:24 -07:00
Jakub Jelinek
7adcbafe45 Update copyright years. 2022-01-03 10:42:10 +01:00
GCC Administrator
84790a9d4b Daily bump. 2021-12-31 00:16:26 +00:00
Lancelot SIX
be674bdd11 libiberty: support digits in cpp mangled clone names
Currently libiberty fails to demangle the name of cloned functions if
the clone-type-identifier contains numbers.

This can be observed with the following example:

    $ cat > ex.cc <<EOT
    void foo (float *, float *)
      __attribute__((target_clones("avx2,avx,sse4.1,default")));

    void foo (float *, float *) {}
    EOT
    $ gcc -c ex.cc
    $ nm -C ex.o | grep foo
    0000000000000000 i foo(float*, float*)
    0000000000000026 t foo(float*, float*) [clone .avx.1]
    0000000000000013 t _Z3fooPfS_.avx2.0
    0000000000000000 t foo(float*, float*) [clone .default.3]
    0000000000000000 W foo(float*, float*) [clone .resolver]
    0000000000000039 t _Z3fooPfS_.sse4_1.2

In this example, gcc creates clones for the FOO function, each matching
one of the specified targets.  When inspecting the binary, nm (and other
libiberty-based tools, including gdb) fails to demangle the symbol names
if the clone identifier contains numbers.

Form my understanding of the mangling convention[1], clone names are
part of vendor-specific suffixes and do not have rule preventing them
from containing digits.

This commit proposes to fix the demangling.  With this commit (ported to
binutils), nm gives the following output:

    $ nm-new -C ex.o | grep foo
    0000000000000000 i foo(float*, float*)
    0000000000000026 t foo(float*, float*) [clone .avx.1]
    0000000000000013 t foo(float*, float*) [clone .avx2.0]
    0000000000000000 t foo(float*, float*) [clone .default.3]
    0000000000000000 W foo(float*, float*) [clone .resolver]
    0000000000000039 t foo(float*, float*) [clone .sse4_1.2]

Tested on x86_86-linux with 'make check-libiberty'.

[1] https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling

libiberty/ChangeLog:

	* cp-demangle.c (d_clone_suffix): Support digits in clone tag
	names.
	* testsuite/demangle-expected: Check demangling of clone symbols
	with digits in name.
2021-12-30 11:36:52 -05:00
GCC Administrator
774269aa4b Daily bump. 2021-12-17 00:16:20 +00:00
H.J. Lu
ab18659afc Revert "Sync with binutils: GCC: Pass --plugin to AR and RANLIB"
This reverts commit bf8cdd3511.
2021-12-15 20:45:58 -08:00
GCC Administrator
8a89c39be0 Daily bump. 2021-12-16 00:16:28 +00:00
H.J. Lu
bf8cdd3511 Sync with binutils: GCC: Pass --plugin to AR and RANLIB
Sync with binutils for building binutils with LTO:

50ad1254d50 GCC: Pass --plugin to AR and RANLIB

Detect GCC LTO plugin.  Pass --plugin to AR and RANLIB to support LTO
build.

ChangeLog:

	* Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
	(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
	* configure.ac: Include config/gcc-plugin.m4.
	AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
	* libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
	RANLIB if possible.
	* Makefile.in: Regenerated.
	* configure: Likewise.

config/

	* gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.

libiberty/

	* Makefile.in (AR): Add @AR_PLUGIN_OPTION@
	(RANLIB): Add @RANLIB_PLUGIN_OPTION@.
	(configure_deps): Depend on ../config/gcc-plugin.m4.
	* configure.ac: AC_SUBST AR_PLUGIN_OPTION and
	RANLIB_PLUGIN_OPTION.
	* aclocal.m4: Regenerated.
	* configure: Likewise.

zlib/

	* configure: Regenerated.
2021-12-15 14:18:10 -08:00
GCC Administrator
87cd82c81d Daily bump. 2021-11-30 00:16:44 +00:00
Eric Gallager
909b30a17e Make etags path used by build system configurable
This commit allows users to specify a path to their "etags"
executable for use when doing "make tags".
I based this patch off of this one from upstream automake:
https://git.savannah.gnu.org/cgit/automake.git/commit/m4?id=d2ccbd7eb38d6a4277d6f42b994eb5a29b1edf29
This means that I just supplied variables that the user can override
for the tags programs, rather than having the configure scripts
actually check for them. I handle etags and ctags separately because
the intl subdirectory has separate targets for them. This commit
only affects the subdirectories that use handwritten Makefiles; the
ones that use automake will have to wait until we update the version
of automake used to be 1.16.4 or newer before they'll be fixed.

Addresses #103021

gcc/ChangeLog:

	PR other/103021
	* Makefile.in: Substitute CTAGS, ETAGS, and CSCOPE
	variables. Use ETAGS variable in TAGS target.
	* configure: Regenerate.
	* configure.ac: Allow CTAGS, ETAGS, and CSCOPE
	variables to be overridden.

gcc/ada/ChangeLog:

	PR other/103021
	* gcc-interface/Make-lang.in: Use ETAGS variable in
	TAGS target.

gcc/c/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/cp/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/d/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/fortran/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/go/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/objc/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

gcc/objcp/ChangeLog:

	PR other/103021
	* Make-lang.in: Use ETAGS variable in TAGS target.

intl/ChangeLog:

	PR other/103021
	* Makefile.in: Use ETAGS variable in TAGS target,
	CTAGS variable in CTAGS target, and MKID variable
	in ID target.
	* configure: Regenerate.
	* configure.ac: Allow CTAGS, ETAGS, and MKID
	variables to be overridden.

libcpp/ChangeLog:

	PR other/103021
	* Makefile.in: Use ETAGS variable in TAGS target.
	* configure: Regenerate.
	* configure.ac: Allow ETAGS variable to be overridden.

libiberty/ChangeLog:

	PR other/103021
	* Makefile.in: Use ETAGS variable in TAGS target.
	* configure: Regenerate.
	* configure.ac: Allow ETAGS variable to be overridden.
2021-11-29 13:24:12 -05:00
Andrew Pinski
68332ab7ec Fix PR 19089: Environment variable TMP may yield gcc: abort
Even though I cannot reproduce the ICE any more, this is still
a bug. We check already to see if we can access the directory
but never check to see if the path is actually a directory.

This adds the check and now we reject the file as not usable
as a tmp directory.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

libiberty/ChangeLog:

	* make-temp-file.c (try_dir): Check to see if the dir
	is actually a directory.
2021-11-29 00:42:45 +00:00
GCC Administrator
c2bd5d8a30 Daily bump. 2021-10-23 00:16:26 +00:00
Eric Gallager
c3e80a16af Add install-dvi Makefile targets.
Closes #102663

ChangeLog:

	PR other/102663
	* Makefile.def: Handle install-dvi target.
	* Makefile.tpl: Likewise.
	* Makefile.in: Regenerate.

c++tools/ChangeLog:

	PR other/102663
	* Makefile.in: Add dummy install-dvi target.

gcc/ChangeLog:

	PR other/102663
	* Makefile.in: Handle dvidir and install-dvi target.
	* configure: Regenerate.
	* configure.ac: Add install-dvi to target_list.

gcc/ada/ChangeLog:

	PR other/102663
	* gcc-interface/Make-lang.in: Allow dvi-formatted
	documentation to be installed.

gcc/c/ChangeLog:

	PR other/102663
	* Make-lang.in: Add dummy c.install-dvi target.

gcc/cp/ChangeLog:

	PR other/102663
	* Make-lang.in: Add dummy c++.install-dvi target.

gcc/d/ChangeLog:

	PR other/102663
	* Make-lang.in: Allow dvi-formatted documentation
	to be installed.

gcc/fortran/ChangeLog:

	PR other/102663
	* Make-lang.in: Allow dvi-formatted documentation
	to be installed.

gcc/lto/ChangeLog:

	PR other/102663
	* Make-lang.in: Add dummy lto.install-dvi target.

gcc/objc/ChangeLog:

	PR other/102663
	* Make-lang.in: Add dummy objc.install-dvi target.

gcc/objcp/ChangeLog:

	PR other/102663
	* Make-lang.in: Add dummy objc++.install-dvi target.

gnattools/ChangeLog:

	PR other/102663
	* Makefile.in: Add dummy install-dvi target.

libada/ChangeLog:

	PR other/102663
	* Makefile.in: Add dummy install-dvi target.

libcpp/ChangeLog:

	PR other/102663
	* Makefile.in: Add dummy install-dvi target.

libdecnumber/ChangeLog:

	PR other/102663
	* Makefile.in: Add dummy install-dvi target.

libiberty/ChangeLog:

	PR other/102663
	* Makefile.in: Allow dvi-formatted documentation
	to be installed.
2021-10-22 15:43:50 -07:00
GCC Administrator
f5b3743596 Daily bump. 2021-10-18 00:16:27 +00:00
Luís Ferreira
fb5b077858 [PATCH] d-demangle: properly skip anonymous symbols
libiberty/
	PR d/102618
	* d-demangle.c (dlang_parse_qualified): Handle anonymous
	symbols correctly.

	* testsuite/d-demangle-expected: New tests to cover anonymous
	symbols.
2021-10-17 18:38:10 -04:00
GCC Administrator
5d5885c99c Daily bump. 2021-10-15 00:17:02 +00:00
Luís Ferreira
e19eea30d6 libiberty: d-demangle: Add test case for function literals
libiberty/ChangeLog:

	* testsuite/d-demangle-expected: Add test case for function literals.
2021-10-14 12:24:51 -04:00
Luís Ferreira
0555b86b5e libiberty: d-demangle: add test cases for simple special mangles
libiberty/ChangeLog:

	* testsuite/d-demangle-expected: Add test cases for simple special
	mangles.
2021-10-14 12:22:57 -04:00
GCC Administrator
52055987fb Daily bump. 2021-10-13 00:16:22 +00:00
Luís Ferreira
98c0ac7e0d [PATCH v2] libiberty: d-demangle: remove parenthesis where it is not needed
libiberty/
	* d-demangle.c (dlang_parse_qualified): Remove redudant parenthesis
	around lhs and rhs of assignments.
2021-10-12 10:40:20 -04:00
GCC Administrator
9d116bcc55 Daily bump. 2021-10-02 00:16:31 +00:00
Luís Ferreira
cb4b82285b libiberty: testsuite: add missing format on d-demangle-expected
libiberty
	* testsuite/d-demangle-expected: Add missing format for new test
2021-10-01 13:26:48 -04:00
GCC Administrator
391b23e02b Daily bump. 2021-09-24 00:16:23 +00:00
Luís Ferreira
b3585c0836 libiberty: prevent null dereferencing on dlang_type
libiberty/
	* d-demangle.c (dlang_Type): Validate MANGLED is nonnull.

	* testsuite/d-demangle-expected: New test.
2021-09-23 11:54:00 -04:00
Luís Ferreira
5481040197 libiberty: prevent buffer overflow when decoding user input
libiberty/
	* d-demangle.c (dlang_symbol_backref): Ensure strlen of
	string is less than length computed by dlang_number.
2021-09-23 11:48:45 -04:00
GCC Administrator
e11c6046f9 Daily bump. 2021-09-02 00:16:59 +00:00
Iain Sandoe
fbb334a6ac libiberty, configure, Darwin: Avoid detecting deprecated sbrk.
Darwin provides an implementation of sbrk, which is detected by
the configuration process.  However, it is deprecated which leads
to build warnings.  The malloc-based implementation is more
suitable.  This patch removes sbrk from the functions searched
for Darwin.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libiberty/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Do not search for sbrk on Darwin.
	* xmalloc.c: Do not declare sbrk unless it has been found
	by configure.
2021-09-01 19:34:07 +01:00
GCC Administrator
1e77fd4f17 Daily bump. 2021-08-30 00:16:44 +00:00
Iain Buclaw
392e141079 libiberty: Add support for demangling local D template declarations
The D language now allows multiple different template declarations in
the same function that have the same mangled name.  To make the mangled
names unique, a fake parent in the form `__Sddd' is added to the symbol.
This information is not important for the user, so the demangler now
handles and ignores it.

libiberty/ChangeLog:

	* d-demangle.c (dlang_identifier): Skip over fake parent manglings.
	* testsuite/d-demangle-expected: Add tests.
2021-08-30 01:14:18 +02:00
Iain Buclaw
34f3e0657a libiberty: Add support for demangling D function literals as template value parameters
The D language now allows instantiating templates using struct literals
that have function literal fields as a value argument.

libiberty/ChangeLog:

	* d-demangle.c (dlang_parse_arrayliteral): Add 'info' parameter.
	(dlang_parse_assocarray): Likewise.
	(dlang_parse_structlit): Likewise.
	(dlang_value): Likewise.  Handle function literal symbols.
	(dlang_template_args): Pass 'info' to dlang_value.
	* testsuite/d-demangle-expected: Add new test.
2021-08-30 01:14:18 +02:00
Iain Buclaw
0e32a5aa8b libiberty: Add support for D `typeof(*null)' types
The D language has a new bottom type `typeof(*null)'.  Null types were
also incorrectly being demangled as `none', this has been fixed to be
`typeof(null)'.

libiberty/ChangeLog:

	* d-demangle.c (dlang_attributes): Handle typeof(*null).
	(dlang_type): Likewise.  Demangle 'n' as typeof(null).
	* testsuite/d-demangle-expected: Update tests.
2021-08-30 01:14:18 +02:00
GCC Administrator
38b19c5b08 Daily bump. 2021-08-24 00:17:00 +00:00
Iain Sandoe
38757aa887 libiberty, Darwin: Fix a build warning.
r12-3005-g220c410162ebece4f missed a cast for the set_32 call.
Fixed thus.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libiberty/ChangeLog:

	* simple-object-mach-o.c (simple_object_mach_o_write_segment):
	Cast the first argument to set_32 as needed.
2021-08-23 17:37:41 +01:00
GCC Administrator
6e529985d8 Daily bump. 2021-08-19 00:16:42 +00:00
Iain Sandoe
220c410162 libiberty, Darwin : Fix simple-object LTO table for cross-endian case.
We encapsulate streamed IR in three special sections with a table
that describes their entries.  The table is expected to be written
with native endianness for the target, but for cross-endian cross-
compilation the swapping was omitted.  Fixed thus.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libiberty/ChangeLog:

	* simple-object-mach-o.c (simple_object_mach_o_write_segment):
	Arrange to swap the LTO index tables where needed.
2021-08-18 19:33:49 +01:00
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
Iain Buclaw
387d0773f3 libiberty: Add support for in' and in ref' storage classes.
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-26 10:03:56 +02:00
GCC Administrator
6a1ad710ad Daily bump. 2020-08-04 00:16:24 +00:00
Richard Biener
b32c5d0b72 lto/96385 - avoid unused global UNDEFs in debug objects
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-08-03 15:09:20 +02:00
GCC Administrator
d48cca8f21 Daily bump. 2020-07-31 00:16:26 +00:00
H.J. Lu
4712bde3ca Require CET support only for the final GCC build
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-30 05:36:24 -07:00
GCC Administrator
8ca07a3072 Daily bump. 2020-07-15 00:16:35 +00:00
Ian Lance Taylor
bae45b8be5 demangler: don't treat lambda as a substitution candidate
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-14 10:25:48 -07:00
GCC Administrator
865362954f Daily bump. 2020-07-11 00:16:31 +00:00
Jason Merrill
6324c52bba c++: Support non-type template parms of union type.
Another thing newly allowed by P1907R1.  The ABI group has discussed
representing unions with designated initializers, and has separately
specified how to represent designators; this patch implements both.

gcc/cp/ChangeLog:

	* tree.c (structural_type_p): Allow unions.
	* mangle.c (write_expression): Express unions with a designator.

libiberty/ChangeLog:

	* cp-demangle.c (cplus_demangle_operators): Add di, dx, dX.
	(d_expression_1): Handle di and dX.
	(is_designated_init, d_maybe_print_designated_init): New.
	(d_print_comp_inner): Use d_maybe_print_designated_init.
	* testsuite/demangle-expected: Add designator tests.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/nontype-class-union1.C: New test.
2020-07-10 08:36:50 -04:00
GCC Administrator
c9c05f7323 Daily bump. 2020-06-27 00:16:24 +00:00
Nick Clifton
87fce92c5c This patch removes the use of the "register" keyword from the bsearch() and bsearch_r() functions supplied by libiberty. The register keyword is deprecated in C++17.
2020-06-25  Nick Clifton  <nickc@redhat.com>

include/
	* libiberty.h (bsearch_r): Remove use of the register keyword from
	the prototype.

libiberty/
	* bsearch.c (bsearch): Remove use of register keyword.
	* bsearch_r.c (bsearch_r): Likewise.
2020-06-26 10:06:48 +01:00
GCC Administrator
4543acc874 Daily bump. 2020-06-24 00:16:31 +00:00
Nick Alcock
aec24341d0 libiberty, include: add bsearch_r
libctf wants a bsearch that takes a void * arg pointer to avoid a
nonportable use of __thread.

bsearch_r is required, not optional, at this point because as far as I
can see this obvious-sounding function is not implemented by anyone's
libc.  We can easily move it to AC_LIBOBJ later if it proves necessary
to do so.

include/
	* libiberty.h (bsearch_r): New.
libiberty/
	* bsearch_r.c: New file.
	* Makefile.in (CFILES): Add bsearch_r.c.
	(REQUIRED_OFILES): Add bsearch_r.o.
	* functions.texi: Regenerate.
2020-06-23 18:39:38 +02:00
GCC Administrator
885ef72f27 Daily bump. 2020-05-30 00:16:27 +00:00
H.J. Lu
9051b54827 Avoid nested save_CFLAGS and save_LDFLAGS
Avoid nested save_CFLAGS and save_LDFLAGS by replacing save_CFLAGS and
save_LDFLAGS with cet_save_CFLAGS and cet_save_LDFLAGS in cet.m4.

config/

	PR bootstrap/95413
	* cet.m4: Replace save_CFLAGS and save_LDFLAGS with
	cet_save_CFLAGS and cet_save_LDFLAGS.

gcc/

	PR bootstrap/95413
	* configure: Regenerated.

libatomic/

	PR bootstrap/95413
	* configure: Regenerated.

libbacktrace/

	PR bootstrap/95413
	* configure: Regenerated.

libcc1/

	PR bootstrap/95413
	* configure: Regenerated.

libcpp/

	PR bootstrap/95413
	* configure: Regenerated.

libdecnumber/

	PR bootstrap/95413
	* configure: Regenerated.

libgcc/

	PR bootstrap/95413
	* configure: Regenerated.

libgfortran/

	PR bootstrap/95413
	* configure: Regenerated.

libgomp/

	PR bootstrap/95413
	* configure: Regenerated.

libiberty/

	PR bootstrap/95413
	* configure: Regenerated.

libitm/

	PR bootstrap/95413
	* configure: Regenerated.

libobjc/

	PR bootstrap/95413
	* configure: Regenerated.

libphobos/

	PR bootstrap/95413
	* configure: Regenerated.

libquadmath/

	PR bootstrap/95413
	* configure: Regenerated.

libsanitizer/

	PR bootstrap/95413
	* configure: Regenerated.

libssp/

	PR bootstrap/95413
	* configure: Regenerated.

libstdc++-v3/

	PR bootstrap/95413
	* configure: Regenerated.

libvtv/

	PR bootstrap/95413
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/95413
	* configure: Regenerated.

zlib/

	PR bootstrap/95413
	* configure: Regenerated.
2020-05-29 12:56:40 -07:00
Iain Buclaw
3a55774f0b libiberty: Handle @live attribute in D demangler.
Adds support for demangling D functions annotated with the new
ownership/borrowing system attribute.

libiberty/ChangeLog:

	* d-demangle.c (dlang_attributes): Add @live attribute.
	* testsuite/d-demangle-expected: Add new tests.
2020-05-15 10:40:47 +02:00
Iain Buclaw
3f30a27491 libiberty: Update D symbol demangling for latest ABI spec.
Some small improvements and clarifications have been done in the D ABI
specification to remove all ambiguities found in the current grammar,
this implementation now more closely resembles the spec, whilst
maintaining compatibility with the old ABI.

Three new rules have been added to the ABI.

1. Back references using 'Q', analogous to C++ substitutions, compresses
   repeated identifiers, types, and template symbol and value parameters.

2. Template aliases to externally mangled symbols are prefixed with 'X'.
   This includes any symbol that isn't extern(D), or has its name
   overriden with pragma(mangle).  This fixes an ambiguity where it was
   not clear whether 'V' was an encoded calling convention, or the next
   template value parameter.

3. Alias parameters, templates, and tuple symbols no longer encode the
   symbol length of its subpart.  Tuples are now terminated with 'Z'.
   This fixes another ambiguity where the first character of the mangled
   name can be a digit as well, so the demangler had to figure out where
   to split the two adjacent numbers by trying out each combination.

libiberty/ChangeLog:

	* d-demangle.c (enum dlang_symbol_kinds): Remove enum.
	(struct dlang_info): New struct
	(dlang_decode_backref): New function.
	(dlang_backref): New function.
	(dlang_symbol_backref): New function.
	(dlang_type_backref): New function.
	(dlang_symbol_name_p): New function.
	(dlang_function_type_noreturn): New function.
	(dlang_function_type): Add 'info' parameter.  Decode function type
	with dlang_function_type_noreturn.
	(dlang_function_args): Add 'info' parameter.
	(dlang_type): Add 'info' parameter.  Handle back referenced types.
	(dlang_identifier): Replace 'kind' parameter with 'info'.  Handle back
	referenced symbols.  Split off decoding of plain identifiers to...
	(dlang_lname): ...here.
	(dlang_parse_mangle): Replace 'kind' parameter with 'info'.  Decode
	function type and return with dlang_type.
	(dlang_parse_qualified): Replace 'kind' parameter with 'info', add
	'suffix_modifier' parameter.  Decode function type with
	dlang_function_type_noreturn.
	(dlang_parse_tuple): Add 'info' parameter.
	(dlang_template_symbol_param): New function.
	(dlang_template_args): Add 'info' parameter.  Decode symbol parameter
	with dlang_template_symbol_param.  Handle back referenced values, and
	externally mangled parameters.
	(dlang_parse_template): Add 'info' parameter.
	(dlang_demangle_init_info): New function.
	(dlang_demangle): Initialize and pass 'info' parameter.
	* testsuite/d-demangle-expected: Add new tests.

Co-Authored-By: Rainer Schuetze <r.sagitario@gmx.de>
2020-05-14 23:43:17 +02:00
H.J. Lu
d17cdc17c9 Enable CET in cross compiler if possible
Don't perform CET run-time check for host when cross compiling.  Instead,
enable CET in cross compiler if possible so that it will run on both CET
and non-CET hosts.

config/

	PR bootstrap/94998
	* cet.m4 (GCC_CET_HOST_FLAGS): Enable CET in cross compiler if
	possible.

libiberty/

	PR bootstrap/94998
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/94998
	* configure: Regenerated.
2020-05-12 10:39:54 -07:00
H.J. Lu
eedc73a224 Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk work first
GCC_CET_HOST_FLAGS uses -Wl,-z,ibt,-z,shstk to check if Linux/x86 host
has Intel CET enabled by introducing an Intel CET violation on purpose.
To avoid false positive, check whether -Wl,-z,ibt,-z,shstk works first.
-fcf-protection=none is added to avoid false negative when -fcf-protection
is enabled by default.

config/

	PR bootstrap/94739
	* cet.m4 (GCC_CET_HOST_FLAGS): Add -fcf-protection=none to
	-Wl,-z,ibt,-z,shstk.  Check whether -fcf-protection=none
	-Wl,-z,ibt,-z,shstk works first.

libiberty/

	PR bootstrap/94739
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/94739
	* configure: Regenerated.
2020-04-28 05:42:50 -07:00
Jakub Jelinek
76458c912b demangler: Handle <=> operator in the demangler [PR94797]
The demangler didn't handle spaceship operator.

2020-04-27  Jakub Jelinek  <jakub@redhat.com>

	PR demangler/94797
	* cp-demangle.c (cplus_demangle_operators): Add ss <=> operator.
	* testsuite/demangle-expected: Add operator<=> test.
2020-04-27 20:59:25 +02:00
H.J. Lu
8fc8bf801e Enable Intel CET in liblto_plugin.so on Intel CET enabled host
Since ld is Intel CET enabled on Intel CET enabled host, dlopen fails on
liblto_plugin.so if it isn't Intel CET enabled.  Add GCC_CET_HOST_FLAGS
to cet.m4, use it in libiberty and lto-plugin to always enable Intel
CET in liblto_plugin.so on Intel CET enabled host.

On Linux/x86 host, enable Intel CET by default if assembler and compiler
support Intel CET so that the generated liblto_plugin.so can be used on
both CET and non-CET machines.  It is an error to disable Intel CET in
liblto_plugin.so on Intel CET enabled host.

config/

	PR bootstrap/94739
	* cet.m4 (GCC_CET_HOST_FLAGS): New.

libiberty/

	PR bootstrap/94739
	* Makefile.in (COMPILE.c): Add @CET_HOST_FLAGS@.
	(configure_deps): Add $(srcdir)/../config/cet.m4 and
	$(srcdir)/../config/enable.m4.
	* aclocal.m4: Include ../config/cet.m4 and ../config/enable.m4.
	* configure.ac: Add GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) and
	AC_SUBST(CET_HOST_FLAGS).
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/94739
	* Makefile.am (AM_CFLAGS): Add $(CET_HOST_FLAGS).
	* configure.ac: Add GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) and
	AC_SUBST(CET_HOST_FLAGS).
	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.
2020-04-25 10:07:16 -07:00
Richard Biener
c9f90a25d4 Keep .GCC.command.line sections of LTO objetcs
This patch is for .GCC.command.line sections in LTO objects to be copied
into the final objects as in the following example:

[egeyar@localhost lto]$ gcc -flto -O3 demo.c -c -g --record-gcc-command-line
[egeyar@localhost lto]$ gcc -flto -O2 demo2.c -c -g --record-gcc-command-line -DFORTIFY=2
[egeyar@localhost lto]$ gcc demo.o demo2.o -o a.out
[egeyar@localhost lto]$ readelf -p .GCC.command.line a.out

String dump of section '.GCC.command.line':
  [     0]  10.0.1 20200227 (experimental) : gcc -flto -O3 demo.c -c -g --record-gcc-command-line
  [    56]  10.0.1 20200227 (experimental) : gcc -flto -O2 demo2.c -c -g --record-gcc-command-line -DFORTIFY=2

2020-03-05  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

	* simple-object.c (handle_lto_debug_sections): Name
	".GCC.command.line" among debug sections to be copied over
	from lto objects.
2020-03-05 08:44:11 +01:00
Nick Clifton
3bb6abbf4b Fix a libiberty testsuite failure
* testsuite/demangle-expected: Update expected demangling of
	enable_if pattern.
2020-03-02 03:50:34 -08:00
H.J. Lu
577350603a lto: Also copy .note.gnu.property section
When generating the separate file with LTO debug sections, we should
also copy .note.gnu.property section.

	PR lto/93966
	* simple-object.c (handle_lto_debug_sections): Also copy
	.note.gnu.property section.
2020-03-02 03:09:08 -08:00
Sandra Loosemore
02ce382cd3 Use a non-empty test program to test ability to link.
On bare-metal targets, I/O support is typically provided by a BSP and
requires a linker script and/or hosting library to be specified on the
linker command line.  Linking an empty program with the default linker
script may succeed, however, which confuses libstdc++ configuration
when programs that probe for the presence of various I/O features fail
with link errors.

2020-02-12  Sandra Loosemore  <sandra@codesourcery.com>

	PR libstdc++/79193
	PR libstdc++/88999

	config/
	* no-executables.m4: Use a non-empty program to test for linker
	support.

	libgcc/
	* configure: Regenerated.

	libgfortran/
	* configure: Regenerated.

	libiberty/
	* configure: Regenerated.

	libitm/
	* configure: Regenerated.

	libobjc/
	* configure: Regenerated.

	libquadmath/
	* configure: Regenerated.

	libssp/
	* configure: Regenerated.

	libstdc++v-3/
	* configure: Regenerated.
2020-02-12 13:22:07 -08:00
Andrew Burgess
5f44a4341c libiberty/hashtab: More const parameters
Makes some parameters const in libiberty's hashtab library.

include/ChangeLog:

        * hashtab.h (htab_remove_elt): Make a parameter const.
        (htab_remove_elt_with_hash): Likewise.

libiberty/ChangeLog:

        * hashtab.c (htab_remove_elt): Make a parameter const.
        (htab_remove_elt_with_hash): Likewise.
2020-02-05 13:01:06 +00:00
Alexandre Oliva
18193e8f00 [libiberty] output empty args as a pair of quotes
writeargv writes out empty arguments in a way that expandargv skips
them instead of preserving them.  Fixed by writing out a pair of
quotes for them.


for  libiberty/ChangeLog

	* argv.c (writeargv): Output empty args as "".
2020-01-23 16:45:24 -03:00
Iain Sandoe
7ebbff3acb [libiberty] Update demangler to handle co_await operator.
C++20 coroutines introduces a new operator with a mangling of 'aw'.
This patch adds that to libiberty's demangler.

libiberty/ChangeLog:

2020-01-18  Iain Sandoe  <iain@sandoe.co.uk>

	* cp-demangle.c (cplus_demangle_operators): Add the co_await
	operator.
	* testsuite/demangle-expected: Test co_await operator mangling.
2020-01-18 12:15:12 +00:00
Jakub Jelinek
8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
Tim Ruehsen
1cd4fe3d43 Fix read buffer overflow in split_directories
* make-relative-prefix.c (split_directories):
        Return early on empty 'name'

From-SVN: r279068
2019-12-06 15:20:06 -07:00
Jeff Law
513e0aa0c4 [PATCH] Fix slowness in demangler
* cp-demangle.c (d_print_init): Remove const from 4th param.
	(cplus_demangle_fill_name): Initialize d->d_counting.
	(cplus_demangle_fill_extended_operator): Likewise.
	(cplus_demangle_fill_ctor): Likewise.
	(cplus_demangle_fill_dtor): Likewise.
	(d_make_empty): Likewise.
	(d_count_templates_scopes): Remobe const from 3rd param,
	Return on dc->d_counting > 1,
	Increment dc->d_counting.
        * cp-demint.c (cplus_demangle_fill_component): Initialize d->d_counting.
	(cplus_demangle_fill_builtin_type): Likewise.
	(cplus_demangle_fill_operator): Likewise.

	* demangle.h (struct demangle_component): Add member
	d_counting.

From-SVN: r278359
2019-11-16 10:14:14 -07:00
Eduard-Mihai Burtescu
32fc3719e0 [PATCH] Refactor rust-demangle to be independent of C++ demangling.
* demangle.h (rust_demangle_callback): Add.

	* cplus-dem.c (cplus_demangle): Use rust_demangle directly.
	(rust_demangle): Remove.
	* rust-demangle.c (is_prefixed_hash): Rename to is_legacy_prefixed_hash.
	(parse_lower_hex_nibble): Rename to decode_lower_hex_nibble.
	(parse_legacy_escape): Rename to decode_legacy_escape.
	(rust_is_mangled): Remove.
	(struct rust_demangler): Add.
	(peek): Add.
	(next): Add.
	(struct rust_mangled_ident): Add.
	(parse_ident): Add.
	(rust_demangle_sym): Remove.
	(print_str): Add.
	(PRINT): Add.
	(print_ident): Add.
	(rust_demangle_callback): Add.
	(struct str_buf): Add.
	(str_buf_reserve): Add.
	(str_buf_append): Add.
	(str_buf_demangle_callback): Add.
	(rust_demangle): Add.
	* rust-demangle.h: Remove.

From-SVN: r278358
2019-11-16 08:32:50 -07:00
Miguel Saldivar
f73cb38f65 * testsuite/demangle-expected: Fix test.
From-SVN: r278357
2019-11-16 07:45:30 -07:00
Kamlesh Kumar
e0c866ddfd PR c++/91979 - mangling nullptr expression
2019-11-04  Kamlesh Kumar  <kamleshbhalui@gmail.com>

gcc/cp
        * cp/mangle.c (write_template_arg_literal): Handle nullptr
        mangling.
gcc
	* common.opt (-fabi-version): Document =14.
	* doc/invoke.texi (C++ Dialect Options): Likewise.
gcc/c-family
        * c-opts.c (c_common_post_options): Update
        latest_abi_version.
libiberty
        * cp-demangle.c (d_expr_primary): Handle
        nullptr demangling.
        * testsuite/demangle-expected: Added test.

From-SVN: r277801
2019-11-04 18:24:25 -05:00