Commit Graph

1195 Commits

Author SHA1 Message Date
Miguel Saldivar 420fb10c09 cp-demangle.c (d_print_mod): Add a space before printing `complex` and `imaginary`, as opposed to after.
* cp-demangle.c (d_print_mod): Add a space before printing `complex`
	and `imaginary`, as opposed to after.
	* testsuite/demangle-expected: Adjust test.

From-SVN: r277535
2019-10-28 13:14:48 -06:00
Eduard-Mihai Burtescu e1cb00db67 rust-demangle.c (looks_like_rust): Remove.
* rust-demangle.c (looks_like_rust): Remove.
	(rust_is_mangled): Don't check escapes.
	(is_prefixed_hash): Allow 0-9a-f permutations.
	(rust_demangle_sym): Don't bail on unknown escapes.
	* testsuite/rust-demangle-expected: Update 'main::$99$' test.

From-SVN: r276539
2019-10-03 15:54:47 -06:00
Eduard-Mihai Burtescu 42bf58bb13 rust-demangle.c (unescape): Remove.
* rust-demangle.c (unescape): Remove.
	(parse_lower_hex_nibble): New function.
	(parse_legacy_escape): New function.
	(is_prefixed_hash): Use parse_lower_hex_nibble.
	(looks_like_rust): Use parse_legacy_escape.
	(rust_demangle_sym): Use parse_legacy_escape.
	* testsuite/rust-demangle-expected: Add 'llv$u6d$' test.

From-SVN: r275353
2019-09-03 14:04:32 -06:00
Martin Liska d23db3858e Share a prevailing name for remove debug info symbols w/ LTO.
2019-08-27  Martin Liska  <mliska@suse.cz>

	PR lto/91478
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	First find a WEAK HIDDEN symbol in symbol table that will be
	preserved.  Later, use the symbol name for all removed symbols.

From-SVN: r274955
2019-08-27 13:36:15 +00:00
Martin Liska 8f88e7f6f8 Move is_valid_fd to filedescriptor.c file.
2019-08-12  Martin Liska  <mliska@suse.cz>

	* Makefile.in: Add filedescriptor.c.
	* filedescriptor.c: New file.
	* lrealpath.c (is_valid_fd): Remove.

From-SVN: r274273
2019-08-12 07:36:48 +00:00
Martin Liska 0fddb18470 Fix file descriptor existence of MinGW.
2019-08-08  Martin Liska  <mliska@suse.cz>

	PR bootstrap/91352
	* gcc.c (driver::detect_jobserver): Use is_valid_fd.
	* lto-wrapper.c (jobserver_active_p): Likewise.
2019-08-08  Martin Liska  <mliska@suse.cz>

	PR bootstrap/91352
	* libiberty.h (is_valid_fd): New function.
2019-08-08  Martin Liska  <mliska@suse.cz>

	PR bootstrap/91352
	* lrealpath.c (is_valid_fd): New function.

From-SVN: r274208
2019-08-08 07:50:28 +00:00
Martin Liska 7012184434 Fix off-by-one in simple-object-elf.c (PR lto/91228).
2019-07-24  Martin Liska  <mliska@suse.cz>

	PR lto/91228
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Find first '\0' starting from gnu_lto + 1.

From-SVN: r273757
2019-07-24 07:00:48 +00:00
Ren Kimura b1bc0f5035 libiberty: Check zero value shstrndx in simple-object-elf.c
From-SVN: r273718
2019-07-23 07:33:32 +00:00
Martin Liska a861990d21 Do not emit __gnu_lto_v1 symbol.
2019-07-22  Martin Liska  <mliska@suse.cz>

	* config/avr/avr.c (avr_asm_output_aligned_decl_common): Update
	comment.
	* toplev.c (compile_file): Do not emit __gnu_lto_v1 symbol.
2019-07-22  Martin Liska  <mliska@suse.cz>

	* config/pa/stublib.c: Remove stub symbol __gnu_lto_v1.
	* config/pa/t-stublib: Likewise.
2019-07-22  Martin Liska  <mliska@suse.cz>

	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Do not search for gnu_lto_v1, but search for first '\0'.

From-SVN: r273662
2019-07-22 07:34:47 +00:00
Eduard-Mihai Burtescu 979526c9ce demangle.h (rust_is_mangled): Move to libiberty/rust-demangle.h.
include/
	* demangle.h (rust_is_mangled): Move to libiberty/rust-demangle.h.
	(rust_demangle_sym): Move to libiberty/rust-demangle.h.
libiberty/
	* cplus-dem.c: Include rust-demangle.h.
	* rust-demangle.c: Include rust-demangle.h.
	* rust-demangle.h: New file.

From-SVN: r273573
2019-07-18 16:10:51 +02:00
Michael Forney 2a1c064a94 cp-demangle.c: Don't define CP_DYNAMIC_ARRAYS if __STDC_NO_VLA__ is non-zero.
* cp-demangle.c: Don't define CP_DYNAMIC_ARRAYS if __STDC_NO_VLA__
	is non-zero.

From-SVN: r271819
2019-05-31 12:25:48 -06:00
Ben L 6c8dbbfe5c d-demangle.c (dlang_parse_assocarray): Correctly handle error result.
* d-demangle.c (dlang_parse_assocarray): Correctly handle error result.
     * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270700
2019-04-30 08:39:14 -06:00
Ben L f181b8e780 d-demangle.c (dlang_parse_tuple): Correctly handle error result.
* d-demangle.c (dlang_parse_tuple): Correctly handle error result.
     * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270699
2019-04-30 08:37:51 -06:00
Ben L dba20a5140 d-demangle.c (dlang_parse_structlit): Correctly handle error result.
* d-demangle.c (dlang_parse_structlit): Correctly handle error result.
    * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270698
2019-04-30 08:36:24 -06:00
Ben L 80b1ab1579 d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result.
* d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result.
    * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270697
2019-04-30 08:34:52 -06:00
Ben L 81adfd10c9 d-demangle.c (dlang_parse_integer): Fix stack underflow.
* d-demangle.c (dlang_parse_integer): Fix stack underflow.
     * testsuite/d-demangle-expected: Add testcase.

From-SVN: r270696
2019-04-30 08:32:38 -06:00
Ben L 80024f3180 cp-demangle (d_print_comp_inner): Guard against a NULL 'typed_name'.
* cp-demangle (d_print_comp_inner): Guard against a NULL 'typed_name'.
    * testsuite/demangle-expected: Add testcase.

From-SVN: r270695
2019-04-30 08:22:41 -06:00
Ben L 927e42fd52 cp-demangle.c (d_encoding): Guard against NULL return values from d_right (dc).
* cp-demangle.c (d_encoding): Guard against NULL return values from
     d_right (dc).
     * testsuite/demangle-expected: Add testcase.

From-SVN: r270694
2019-04-30 08:20:11 -06:00
Ben L 956bea2cd6 cp-demangle.c (d_expression_1): Don't peek ahead unless the current char is valid.
* cp-demangle.c (d_expression_1): Don't peek ahead unless the current
	char is valid.
	* testsuite/demangle-expected: Add testcase.

From-SVN: r270664
2019-04-29 16:19:01 -06:00
Nick Clifton 6fe6bd7c08 Fix a stack exhaustion bug in libiberty's demangler when decoding a pathalogically constructed mangled name.
PR 89394
	* cp-demangle.c (cplus_demangle_fill_name): Reject negative
	lengths.
	(d_count_templates_scopes): Replace num_templates and num_scopes
	parameters with a struct d_print_info pointer parameter.  Adjust
	body of the function accordingly.  Add recursion counter and check
	that the recursion limit is not reached.
	(d_print_init): Pass dpi parameter to d_count_templates_scopes.
	Reset recursion counter afterwards, unless the recursion limit was
	reached.

From-SVN: r270258
2019-04-10 14:44:47 +00:00
Alan Modra 6d31ef2ab1 Regenerate libiberty/functions.texi
This patch just picks up changes made in r231983 (git 2afaef0360)
and r268793 (git 0f7c25df5f).

	* functions.texi: Regenerate.

From-SVN: r270189
2019-04-07 21:00:35 +09:30
Jason Merrill 62de703f19 hash-table.h (remove_elt_with_hash): Return if slot is NULL rather than if is_empty (*slot).
* hash-table.h (remove_elt_with_hash): Return if slot is NULL rather
	than if is_empty (*slot).
	* hash-set-tests.c (test_set_of_strings): Add tests for addition of
	existing elt and for elt removal.
	* hash-map-tests.c (test_map_of_strings_to_int): Add test for removal
	of already removed elt.

	* hashtab.c (htab_remove_elt_with_hash): Return if slot is NULL rather
	than if *slot is HTAB_EMPTY_ENTRY.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r269695
2019-03-14 23:47:01 +01:00
Philippe Waroquiers f9f75f8d3c Fix splay tree KEY leak detected in GDB test gdb.base/macscp.exp
When a node is removed from a splay tree, the splay tree was
not using the function splay_tree_delete_key_fn to release the key.
This was causing a leak, fixed by Tom Tromey.

This patch fixes another key leak, that happens when a key equal to
a key already present is inserted.  In such a case, we have to release
the old KEY.
Note that this is based on the assumption that the caller always
allocates a new KEY when doing an insert.

Also, clarify the documentation about when the release functions are
called.

2019-02-11  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* splay-tree.h (splay_tree_delete_key_fn): Update comment.
	(splay_tree_delete_value_fn): Likewise.

libiberty/ChangeLog
2019-02-11  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* splay-tree.c (splay_tree_insert): Also release old KEY in case
	of insertion of a key equal to an already present key.
	(splay_tree_new_typed_alloc): Update comment.

From-SVN: r268793
2019-02-12 13:02:48 +00:00
Nidal Faour 4293cd6ed8 re PR lto/88422 (collect2.exe: fatal error: lto-wrapper returned 1 exit status: file not recognized: file truncated)
2019-01-22  Nidal Faour  <nidal.faour@wdc.com>

	PR lto/88422
	* simple-object.c (O_BINARY): Define if not already defined.
	(simple_object_copy_lto_debug_sections): Create file in binary
	mode.

From-SVN: r268141
2019-01-22 09:47:52 +00:00
Tom Tromey 2197ea1791 Fix leak in splay-tree
Philippe Waroquiers noticed a memory leak in gdb, which he tracked
down to a bug in splay-tree.  splay_tree_remove does not call the
`delete_key' function when it removes the old node; but it should.

I looked at every splay tree in GCC and there is only one that passes
a non-NULL delete function -- the one in lto.c.  That file does not
call splay_tree_remove.  So, I think this is safe to check in.

I re-ran the LTO tests to double check.

libiberty/
	* splay-tree.c (splay_tree_remove): Delete the key if necessary.

From-SVN: r268116
2019-01-21 15:25:29 +00:00
Tom Honermann 2d91f79dc9 Implement P0482R5, char8_t: A type for UTF-8 characters and strings
gcc/cp/
	* cvt.c (type_promotes_to): Handle char8_t promotion.
	* decl.c (grokdeclarator): Handle invalid type specifier
	combinations involving char8_t.
	* lex.c (init_reswords): Add char8_t as a reserved word.
	* mangle.c (write_builtin_type): Add name mangling for char8_t (Du).
	* parser.c (cp_keyword_starts_decl_specifier_p)
	(cp_parser_simple_type_specifier): Recognize char8_t as a simple
	type specifier.
	(cp_parser_string_literal): Use char8_array_type_node for the type
	of CPP_UTF8STRING.
	(cp_parser_set_decl_spec_type): Tolerate char8_t typedefs in system
	headers.
	* rtti.c (emit_support_tinfos): type_info support for char8_t.
	* tree.c (char_type_p): Recognize char8_t as a character type.
	* typeck.c (string_conv_p): Handle conversions of u8 string
	literals of char8_t type.
	(check_literal_operator_args): Handle UDLs with u8 string literals
	of char8_t type.
	* typeck2.c (ordinary_char_type_p): New.
	(digest_init_r): Disallow initializing a char array with a u8 string
	literal.
gcc/c-family/
	* c-common.c (c_common_reswords): Add char8_t.
	(fix_string_type): Use char8_t for the type of u8 string literals.
	(c_common_get_alias_set): char8_t doesn't alias.
	(c_common_nodes_and_builtins): Define char8_t as a builtin type in
	C++.
	(c_stddef_cpp_builtins): Add __CHAR8_TYPE__.
	(keyword_begins_type_specifier): Add RID_CHAR8.
	* c-common.h (rid): Add RID_CHAR8.
	(c_tree_index): Add CTI_CHAR8_TYPE and CTI_CHAR8_ARRAY_TYPE.
	Define D_CXX_CHAR8_T and D_CXX_CHAR8_T_FLAGS.
	Define char8_type_node and char8_array_type_node.
	* c-cppbuiltin.c (cpp_atomic_builtins): Predefine
	__GCC_ATOMIC_CHAR8_T_LOCK_FREE.
	(c_cpp_builtins): Predefine __cpp_char8_t.
	* c-lex.c (lex_string): Use char8_array_type_node as the type of
	CPP_UTF8STRING.
	(lex_charconst): Use char8_type_node as the type of CPP_UTF8CHAR.
	* c-opts.c: If not otherwise specified, enable -fchar8_t when
	targeting C++2a.
	* c.opt: Add the -fchar8_t command line option.
libiberty/
	* cp-demangle.c (cplus_demangle_builtin_types)
	(cplus_demangle_type): Add name demangling for char8_t (Du).
	* cp-demangle.h: Increase D_BUILTIN_TYPE_COUNT to accommodate the
	new char8_t type.

From-SVN: r267923
2019-01-14 14:55:51 -05:00
Sandra Loosemore adcb167e03 PR other/16615 [2/5]
2019-01-09  Sandra Loosemore  <sandra@codesourcery.com>

	PR other/16615 [2/5]

	include/
	* libiberty.h: Mechanically replace "can not" with "cannot".
	* plugin-api.h: Likewise.

	libiberty/
	* cp-demangle.c: Mechanically replace "can not" with "cannot".
	* floatformat.c: Likewise.
	* strerror.c: Likewise.

From-SVN: r267784
2019-01-09 16:39:49 -05:00
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Jason Merrill 6c8120c5ff Remove support for demangling GCC 2.x era mangling schemes.
libiberty/
	* cplus-dem.c: Remove cplus_mangle_opname, cplus_demangle_opname,
	internal_cplus_demangle, and all subroutines.
	(libiberty_demanglers): Remove entries for ancient GNU (pre-3.0),
	Lucid, ARM, HP, and EDG demangling styles.
	(cplus_demangle): Remove 'work' variable.  Don't call
	internal_cplus_demangle.
include/
	* demangle.h: Remove support for ancient GNU (pre-3.0), Lucid,
	ARM, HP, and EDG demangling styles.

From-SVN: r267363
2018-12-22 19:06:34 -05:00
Nick Clifton e96d1d8c78 Add a recursion limit to libiberty's demangling code. The limit is enabled by default, but can be disabled via a new demangling option.
include	* demangle.h (DMGL_NO_RECURSE_LIMIT): Define.
        (DEMANGLE_RECURSION_LIMIT): Define

	PR 87681
	PR 87675
	PR 87636
	PR 87350
	PR 87335
libiberty * cp-demangle.h (struct d_info): Add recursion_level field.
	* cp-demangle.c (d_function_type): Add recursion counter.
	If the recursion limit is reached and the check is not disabled,
	then return with a failure result.
	(cplus_demangle_init_info): Initialise the recursion_level field.
        (d_demangle_callback): If the recursion limit is enabled, check
	for a mangled string that is so long that there is not enough
	stack space for the local arrays.
        * cplus-dem.c (struct work): Add recursion_level field.
	(squangle_mop_up): Set the numb and numk fields to zero.
	(work_stuff_copy_to_from): Handle the case where a btypevec or 
	ktypevec field is NULL.
	(demangle_nested_args): Add recursion counter.  If
	the recursion limit is not disabled and reached, return with a
	failure result.

From-SVN: r266886
2018-12-07 10:33:30 +00:00
Jason Merrill 4be5c72cf3 Implement P0732R2, class types in non-type template parameters.
There is one significant piece of this that is not implemented yet: the
reliance on defaulted operator<=>, which someone else has been working on.
So, for the moment those lines are commented out of the testcases.

One tricky bit was treating template parameters of classtype as const
lvalues without making their decltype const; for this I used a
VIEW_CONVERT_EXPR wrapper, which previously could only appear in templates
as location wrappers.

The user-defined literal parts of P0732R2 are in the next patch.

gcc/cp/
	* error.c (dump_simple_decl): Look through a template parm object.
	* mangle.c (write_template_arg): Likewise.
	(mangle_template_parm_object): New.
	* pt.c (template_parm_object_p, get_template_parm_object): New.
	(invalid_tparm_referent_p): Factor from convert_nontype_argument.
	(convert_nontype_argument, invalid_nontype_parm_type_p): Handle
	class-type template arguments.
	* tree.c (lvalue_kind): Likewise.
gcc/c-family/
	* c-cppbuiltin.c (c_cpp_builtins): Add
	__cpp_nontype_template_parameter_class.
libiberty/
	* cp-demangle.c (d_dump, d_make_comp, d_count_templates_scopes)
	(d_print_comp_inner): Handle DEMANGLE_COMPONENT_TPARM_OBJ.
	(d_special_name): Handle TA.
	(d_expresion_1): Fix demangling of brace-enclosed initializer list.
include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_TPARM_OBJ.

From-SVN: r265789
2018-11-05 02:47:02 -05:00
Joseph Myers 22e0527251 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856).
This patch updates GCC to use autoconf 2.69 and automake 1.15.1.
(That's not the latest automake version, but it's the one used by
binutils-gdb, with which consistency is desirable, and in any case
seems a useful incremental update that should make a future update to
1.16.1 easier.)

The changes are generally similar to the binutils-gdb ones, and are
copied from there where shared files and directories are involved
(there are some further changes to such shared directories, however,
which I'd expect to apply to binutils-gdb once this patch is in GCC).
Largely, obsolete AC_PREREQ calls are removed, while many
AC_LANG_SOURCE calls are added to avoid warnings from aclocal and
autoconf.  Multilib support is no longer included in core automake,
meaning that multilib.am needs copying from automake's contrib
directory into the GCC source tree.  Autoconf 2.69 has Go support, so
local copies of that support are removed.  I hope the D support will
soon be submitted to upstream autoconf so the local copy of that can
be removed in a future update.  Changes to how automake generates
runtest calls mean quotes are removed from RUNTEST definitions in five
lib*/testsuite/Makefile.am files (libatomic, libgomp, libitm,
libphobos, libvtv; some others have RUNTEST definitions without
quotes, which are still OK); libgo and libphobos also get
-Wno-override added to AM_INIT_AUTOMAKE so those overrides of RUNTEST
do not generate automake warnings.

Note that the regeneration did not include regeneration of
fixincludes/config.h.in (attempting such regeneration resulted in all
the USED_FOR_TARGET conditionals disappearing; and I don't see
anything in the fixincludes/ directory that would result in such
conditionals being generated, unlike in the gcc/ directory).  Also
note that libvtv/testsuite/other-tests/Makefile.in was not
regenerated; that directory is not listed as a subdirectory for which
Makefile.in gets regenerated by calling "automake" in libvtv/, so I'm
not sure how it's meant to be regenerated.

While I mostly fixed warnings should running aclocal / automake /
autoconf, there were various such warnings from automake in the
libgfortran, libgo, libgomp, liboffloadmic, libsanitizer, libphobos
directories that I did not fix, preferring to leave those to the
relevant subsystem maintainers.  Specifically, most of those warnings
were of the following form (example from libgfortran):

Makefile.am:48: warning: source file 'caf/single.c' is in a subdirectory,
Makefile.am:48: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they
will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.

I think it's best for the relevant maintainers to add subdir-objects
and do any other associated Makefile.am changes needed.  In some cases
the paths in the warnings involved ../; I don't know if that adds any
extra complications to the use of subdir-objects.

I've tested this with native, cross and Canadian cross builds.  The
risk of any OS-specific issues should I hope be rather lower than if a
libtool upgrade were included (we *should* do such an upgrade at some
point, but it's more complicated - it involves identifying all our
local libtool changes to see if any aren't included in the upstream
version we update to, and reverting an upstream libtool patch that's
inappropriate for use in GCC); I think it would be better to get this
update into GCC so that people can test in different configurations
and we can fix any issues found, rather than to try to get more and
more testing done before it goes in.

top level:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* multilib.am: New file.  From automake.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
	* ar-lib: New file.
	* test-driver: New file.
	* configure: Re-generate.

config:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* math.m4, tls.m4: Use AC_LANG_SOURCE.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.

fixincludes:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, configure: Regenerate.

gcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use single
	line for second argument of AC_DEFINE_UNQUOTED.
	* doc/install.texi (Tools/packages necessary for modifying GCC):
	Update to autoconf 2.69 and automake 1.15.1.
	* aclocal.m4, config.in, configure: Regenerate.

gnattools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

gotools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* config/go.m4: Remove file.
	* Makefile.am (ACLOCAL_AMFLAGS): Do not use -I ./config.
	* configure.ac:  Remove AC_PREREQ.  Do not include config/go.m4.
	* Makefile.in, aclocal.m4, configure: Regenerate.

intl:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
	* configure: Re-generate.
	* config.h.in: Re-generate.
	* aclocal.m4: Re-generate.

libada:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

libatomic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* acinclude.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libbacktrace:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libcc1:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libcpp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* aclocal.m4, config.in, configure: Regenerate.

libdecnumber:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* aclocal.m4.

libffi:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove doc/libffi.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, fficonfig.h.in,
	include/Makefile.in, man/Makefile.in, testsuite/Makefile.in:
	Regenerate.

libgcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* configure: Regenerate.

libgfortran:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libgo [logically part of this change but omitted from the commit]:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* config/go.m4: Remove file.
	* config/libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use
	-Wno-override in AM_INIT_AUTOMAKE call.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libgomp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libgomp.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libhsail-rt:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libiberty:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* config.in: Re-generate.

libitm:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libitm.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libobjc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, config.h.in, configure: Regenerate.

liboffloadmic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* plugin/Makefile.am: Include multilib.am.
	* plugin/configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, plugin/Makefile.in,
	plugin/aclocal.m4, plugin/configure: Regenerate.

libphobos:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use -Wno-override in
	AM_INIT_AUTOMAKE call.
	* m4/autoconf.m4: Add extra argument to AC_LANG_DEFINE call.
	* m4/druntime/os.m4: Use AC_LANG_SOURCE.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, libdruntime/Makefile.in,
	src/Makefile.in, testsuite/Makefile.in: Regenerate.

libquadmath:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.8.  Add info-in-builddir.
	(all-local): Define outside conditional code.
	(CLEANFILES): Remove libquadmath.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libsanitizer:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, asan/Makefile.in, configure,
	interception/Makefile.in, libbacktrace/Makefile.in,
	lsan/Makefile.in, sanitizer_common/Makefile.in, tsan/Makefile.in,
	ubsan/Makefile.in: Regenerate.

libssp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.9.5.
	* configure.ac: Remove AC_PREREQ.  Quote argument to
	AC_RUN_IFELSE.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libstdc++-v3:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, doc/Makefile.in,
	include/Makefile.in, libsupc++/Makefile.in, po/Makefile.in,
	python/Makefile.in, src/Makefile.in, src/c++11/Makefile.in,
	src/c++17/Makefile.in, src/c++98/Makefile.in,
	src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate.

libvtv:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

lto-plugin:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

zlib:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add foreign.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* configure: Re-generate.

From-SVN: r265695
2018-10-31 17:03:16 +00:00
Nathan Sidwell df1346b423 [libiberty] Use pipe inside pex_run
https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00039.html
	* configure.ac (checkfuncs): Add pipe2.
	* config.in, configure: Rebuilt.
	* pex-unix.c (pex_unix_exec_child): Comminicate errors from child
	to parent with a pipe, when possible.

From-SVN: r264769
2018-10-01 18:46:51 +00:00
Martin Liska 92a285c1a7 Replace 8 spaces with a tabular in ChangeLog files.
From-SVN: r263886
2018-08-27 14:04:23 +00:00
Nathan Sidwell 832c74d935 [libiberty patch] Fix PGO bootstrap
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01386.html
	PR driver/87056
	* pex-unix.c (pex_unix_exec_child): Duplicate bad_fn into local
	scopes to avoid potential clobber.

Co-Authored-By: Martin Liska <mliska@suse.cz>

From-SVN: r263807
2018-08-23 10:21:21 +00:00
Nathan Sidwell 5c12a85534 [libiberty patch] PEX-unix forking
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01170.html
	* pex-unix.c (pex_child_error): Delete.
	(pex_unix_exec_child): Commonize error paths to single message &
	exit.

From-SVN: r263679
2018-08-21 00:01:50 +00:00
Tom Tromey 6ef4752bc9 cplus-dem.c (remember_Btype): Don't call memcpy with LEN==0.
2018-07-30  Tom Tromey  <tom@tromey.com>

	* cplus-dem.c (remember_Btype): Don't call memcpy with LEN==0.

From-SVN: r263069
2018-07-30 13:47:01 +00:00
Martin Liska c00c9d0365 Add linker_output as prefix for LTO temps (PR lto/86548).
2018-07-26  Martin Liska  <mliska@suse.cz>

        PR lto/86548
	* lto-wrapper.c: Add linker_output as prefix
        for ltrans_output_file.
2018-07-26  Martin Liska  <mliska@suse.cz>

        PR lto/86548
	* libiberty.h (make_temp_file_with_prefix): New function.
2018-07-26  Martin Liska  <mliska@suse.cz>

        PR lto/86548
	* make-temp-file.c (TEMP_FILE): Remove leading 'cc'.
	(make_temp_file): Call make_temp_file_with_prefix with
        first argument set to NULL.
	(make_temp_file_with_prefix): Support also prefix.

From-SVN: r262999
2018-07-26 12:13:14 +00:00
Eli Zaretskii 30ae666240 simple-object-elf.c (ENOTSUP): If not defined by errno.h, redirect to ENOSYS.
2018-07-19  Eli Zaretskii  <eliz@gnu.org>

	* simple-object-elf.c (ENOTSUP): If not defined by errno.h, redirect
	to ENOSYS.

From-SVN: r262872
2018-07-19 08:47:34 +00:00
Jan Hubicka e062dc8089 simple-object.h (simple_object_copy_lto_debug_sections): Add rename parameter.
* simple-object.h (simple_object_copy_lto_debug_sections): Add rename
	parameter.

From-SVN: r260970
2018-05-30 19:57:50 +02:00
Jan Hubicka 7ce4ce10cd simple-object.h (simple_object_copy_lto_debug_sections): Add rename parameter.
* simple-object.h (simple_object_copy_lto_debug_sections): Add rename
	parameter.
	* simple-object.c (handle_lto_debug_sections): Add rename parameter.
	(handle_lto_debug_sections_rename): New function.
	(handle_lto_debug_sections_norename): New function.
	(simple_object_copy_lto_debug_sections): Add rename parameter.

From-SVN: r260956
2018-05-30 15:26:26 +00:00
Bernd Edlinger b0c31bc65b splay-tree.h (splay_tree_compare_strings, [...]): Declare new utility functions.
include:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * splay-tree.h (splay_tree_compare_strings,
        splay_tree_delete_pointers): Declare new utility functions.

libiberty:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * splay-tree.c (splay_tree_compare_strings,
        splay_tree_delete_pointers): New utility functions.

gcc:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * tree-dump.c (dump_node): Use splay_tree_delete_pointers.

c-family:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * c-lex.c (get_fileinfo): Use splay_tree_compare_strings and
        splay_tree_delete_pointers.

cp:
2018-05-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * decl2.c (start_static_storage_duration_function): Use
        splay_tree_delete_pointers.

From-SVN: r260850
2018-05-28 18:21:23 +00:00
Martin Liska 84ec5aea48 Improve boostrap-ubsan config (PR bootstrap/64914).
2018-05-10  Martin Liska  <mliska@suse.cz>

	PR bootstrap/64914
	* bootstrap-ubsan.mk: Define UBSAN_BOOTSTRAP.
2018-05-10  Martin Liska  <mliska@suse.cz>

	PR bootstrap/64914
	* md5.c: Use strict alignment with UBSAN_BOOTSTRAP.

From-SVN: r260112
2018-05-10 10:15:42 +00:00
Daniel van Gerpen d6df811e5d argv.c (expandargv): Fix memory leak for expanded arguments.
* argv.c (expandargv): Fix memory leak for expanded
        arguments.

From-SVN: r259775
2018-04-30 12:00:49 -06:00
Rainer Orth 6888a172d3 Fix gcc.dg/debug/pr41893-1.c with Solaris ld (PR lto/81968)
PR lto/81968
	* simple-object.c (handle_lto_debug_sections): Keep .comment
	section.

From-SVN: r259364
2018-04-13 08:02:15 +00:00
David Malcolm b2353e5931 libiberty: fix URL for demangler ABI
libiberty/ChangeLog:
	* cp-demangle.c: Update URL for g++ V3 ABI.

From-SVN: r258155
2018-03-02 20:20:37 +00:00
Eli Zaretskii c6bff8ada6 simple-object-xcoff.c (simple_object_xcoff_find_sections): Use ulong_type to avoid warning about 32-bit shift.
* simple-object-xcoff.c (simple_object_xcoff_find_sections): Use
	ulong_type to avoid warning about 32-bit shift.

From-SVN: r256925
2018-01-21 05:01:31 +00:00
Richard Biener bf6f2cc7be re PR lto/81968 (early lto debug objects make Solaris ld SEGV)
2018-01-11  Richard Biener  <rguenther@suse.de>
	Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR lto/81968
	libiberty/
	* simple-object-common.h (struct simple_object_functions):
	Change copy_lto_debug_sections callback signature.
	* simple-object-elf.c (SHN_HIRESERVE, SHT_SYMTAB_SHNDX,
	SHF_INFO_LINK): Add defines.
	(simple_object_elf_copy_lto_debug_sections): Instead of
	leaving not to be copied sections empty unnamed SHT_NULL
	remove them from the target section headers and adjust section
	reference everywhere.  Handle SHN_XINDEX in the symbol table
	processing properly.
	* simple-object.c (handle_lto_debug_sections): Change
	interface to return a modified string and handle renaming
	of relocation sections.

Co-Authored-By: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>

From-SVN: r256528
2018-01-11 12:12:39 +00:00
Daniel van Gerpen 3ec62f5406 argv.c (expandargv): Correct check for dynamically allocated argv.
2018-01-10  Daniel van Gerpen  <daniel@vangerpen.de>

	* argv.c (expandargv): Correct check for dynamically
	allocated argv.

From-SVN: r256460
2018-01-10 15:40:53 -07:00
Jakub Jelinek 85ec4feb11 Update copyright years.
From-SVN: r256169
2018-01-03 11:03:58 +01:00
Richard Biener c1177db4fa re PR lto/83452 (FAIL: gfortran.dg/save_6.f90 -O0 (test for excess errors))
2017-01-02  Richard Biener  <rguenther@suse.de>

	PR lto/83452
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_section):
	Do not use UNDEF locals for removed symbols but instead just
	define them in the first prevailing section and with no name.
	Use the same gnu_lto_v1 name for all removed globals we promote to
	WEAK UNDEFs so hpux can use a stub to provide this symbol.  Clear
	sh_info and sh_link in removed sections.

From-SVN: r256069
2018-01-02 08:45:05 +00:00
Richard Biener bfe6f07666 re PR lto/82757 (r251560 causes: plugin needed to handle lto object)
2017-10-30  Richard Biener  <rguenther@suse.de>

	PR lto/82757
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Strip two leading _s from the __gnu_lto_* symbols.

From-SVN: r254219
2017-10-30 12:48:53 +00:00
Alan Modra 160826fefd PR82687, g++.dg/asan/default-options-1.C fails with PR82575 fix
The problem with making discarded symbols hidden is that the
non-default visibility is sticky.  When symbols other than the
__gnu_lto ones are discarded that turns out to be a bad idea.

	PR lto/82687
	PR lto/82575
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Only make __gnu_lto symbols hidden.  Delete outdated comment.
	Silence ISO C warning.

From-SVN: r254042
2017-10-24 23:15:01 +10:30
Alan Modra ebd208bf7b PR82575, lto debugobj references __gnu_lto_slim, ld test liblto-17 fails
If __gnu_lto_slim is global, undefined, default visibility in the
early debug object, then it finds its way into .dynsym when creating
shared libraries.  __gnu_lto_slim in a symbol table (.dynsym or
.symtab) signals nm and other binutils that the object is an LTO
object needing a plugin, but that isn't the case for the ld liblti-17
tests.  So, make __gnu_lto_slim hidden to prevent it becoming
dynamic.  Further, make it weak because some linkers may warn on
finding an undefined global non-default visibility symbol.

	PR lto/82575
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Make discarded non-local symbols weak and hidden.

From-SVN: r253914
2017-10-20 09:36:20 +10:30
Jakub Jelinek f8049c44b9 re PR lto/82598 (lto debugobj lacks .note.GNU-stack)
PR lto/82598
	* simple-object.c (handle_lto_debug_sections): Copy over also
	.note.GNU-stack section with unchanged name.
	* simple-object-elf.c (SHF_EXECINSTR): Define.
	(simple_object_elf_copy_lto_debug_section): Drop SHF_EXECINSTR bit
	on .note.GNU-stack section.

From-SVN: r253851
2017-10-18 11:20:31 +02:00
Nathan Sidwell 68aac47f3a re PR demangler/82195 (Undemangleable lambda)
PR demangler/82195
	* cp-demangle.c (d_encoding): Strip return type when name is a
	LOCAL_NAME.
	(d_local_name): Strip return type of enclosing TYPED_NAME.
	* testsuite/demangle-expected: Add and adjust tests.

From-SVN: r253186
2017-09-26 02:38:12 +00:00
Nathan Sidwell 7cd7dbdadf [demangler PATCH]: Revert and update generic lambda demangling
https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01482.html
	PR demangler/82195
	* cp-demangle.c (d_name): Revert addition of 'toplevel' parm.
	(has_return_type): Recurse for DEMANGLE_COMPONENT_LOCAL_NAME.
	(d_encoding): Revert d_name change.  Use is_fnqual_component_type
	to strip modifiers that do not belong.
	(d_special_name, d_class_enum_type): Revert d_name call change.
	(d_expresion_1): Commonize DEMANGLE_COMPONENT_UNARY building.
	(d_local_name): Revert parsing of a function type.
	(d_print_comp_inner): An inner LOCAL_NAME might contain a
	TEMPLATE.
	* testsuite/demangle-expected: Add & adjust tests

From-SVN: r253075
2017-09-21 15:52:31 +00:00
Nathan Sidwell fa0cdfb651 [demangler] Fix nested generic lambda
https://gcc.gnu.org/ml/gcc-patches/2017-09/msg00994.html
	PR demangler/82195
	* cp-demangle.c (d_name): Add 'toplevel' parm.  Pass to	...
	(d_local_name): ... here.  Parse trailing function args on nested
	local_name.
	(d_encoding, d_special_name, d_class_enum_type): Adjust d_name calls.
	* testsuite/demangle-expected: Add tests.

From-SVN: r252815
2017-09-15 12:23:57 +00:00
Richard Biener dc4b8c6820 re PR lto/81968 (early lto debug objects make Solaris ld SEGV)
2017-09-15  Richard Biener  <rguenther@suse.de>

	PR lto/81968
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Iterate marking dependent sections necessary.

From-SVN: r252807
2017-09-15 12:11:13 +00:00
Nathan Sidwell 9d89efebaa [Demangle PATCH] Some pre-fix cleanups
https://gcc.gnu.org/ml/gcc-patches/2017-09/msg00983.html

	* cp-demangle.c (is_fnqual_component_type): Reimplement using
	FNQUAL_COMPONENT_CASE.
	(d_encoding): Hold bare_function_type in local var.
	(d_local_name): Build name in both cases and build result once.
	Collapse switch-if to single conditional.
	* testsuite/demangle-expected: Realign blank lines with tests.

From-SVN: r252802
2017-09-15 10:50:05 +00:00
Jiong Wang ff971abe60 Add DW_CFA_AARCH64_negate_ra_state to dwarf2.def/h and dwarfnames.c
A new vendor CFA DW_CFA_AARCH64_negate_ra_state was introduced for ARMv8.3-A
return address signing, it is multiplexing DW_CFA_GNU_window_save in CFA vendor
extension space.

  This patch adds necessary code to make it available to external, the GDB
patch (https://sourceware.org/ml/gdb-patches/2017-08/msg00215.html) is intended
to use it.

  A new DW_CFA_DUP for it is added in dwarf2.def.  The use of DW_CFA_DUP is to
avoid duplicated case value issue when included in libiberty/dwarfnames.

  Native x86 builds OK to make sure no macro expanding errors.

Committed on behalf of Jiong Wang.

    include/
	* dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP.
	* dwarf2.h (DW_CFA_DUP): New define.

    libiberty/
	* dwarfnames.c (DW_CFA_DUP): New define.

From-SVN: r252037
2017-09-12 16:39:59 +00:00
Martin Liska 39baa1d35e Fix warning for simple-object-elf.c.
2017-09-01  Martin Liska  <mliska@suse.cz>

	* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
	Remove duplicite declaration.

From-SVN: r251584
2017-09-01 11:22:04 +00:00
Richard Biener a621861e39 re PR lto/81968 (early lto debug objects make Solaris ld SEGV)
2017-08-31  Richard Biener  <rguenther@suse.de>

	PR lto/81968
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_section):
	Keep names of removed global symbols.

From-SVN: r251560
2017-08-31 11:21:40 +00:00
Tony Reix 62663034af simple-object-xcoff.c (simple_object_xcoff_find_sections): Improve .go_export csect handling.
* simple-object-xcoff.c (simple_object_xcoff_find_sections):
	Improve .go_export csect handling.  Don't make assumptions
	on containing section or number of auxiliary entries.

From-SVN: r251533
2017-08-30 14:08:00 +00:00
Richard Biener 1963f60adb re PR lto/81968 (early lto debug objects make Solaris ld SEGV)
2017-08-28  Richard Biener  <rguenther@suse.de>

	PR lto/81968
	* simple-object-elf.c (simple_object_elf_copy_lto_debug_section):
	Adjust field with for sh_type write, set SHF_EXCLUDE only for
	removed sections.

From-SVN: r251384
2017-08-28 13:14:28 +00:00
Richard Biener d4c550fd0e re PR lto/81925 (early lto debug link failure on aarch64_be)
2017-08-22  Richard Biener  <rguenther@suse.de>

	PR lto/81925
	* simple-object-elf.c (simple_object_elf_write_shdr): Adjust
	type of sh_addralign and sh_entsize and properly write
	sh_entsize as Elf_Addr.
	(simple_object_elf_write_to_file): Read sh_entsize as Elf_Addr.

From-SVN: r251276
2017-08-22 13:54:01 +00:00
Richard Biener 1ea85365b4 re PR go/78628 (GO fails to build a translation unit decl)
2017-08-21  Richard Biener  <rguenther@suse.de>

	include/
	* simple-object.h (simple_object_copy_lto_debug_sections): New
	function.

	libiberty/
	* simple-object-common.h (struct simple_object_functions): Add
	copy_lto_debug_sections hook.
	* simple-object.c: Include fcntl.h.
	(handle_lto_debug_sections): New helper function.
	(simple_object_copy_lto_debug_sections): New function copying
	early LTO debug sections to regular debug sections in a new file.
	(simple_object_start_write): Handle NULL segment_name.
	* simple-object-coff.c (simple_object_coff_functions): Adjust
	for not implemented copy_lto_debug_sections hook.
	* simple-object-mach-o.c (simple_object_mach_o_functions): Likewise.
	* simple-object-xcoff.c (simple_object_xcoff_functions): Likewise.
	* simple-object-elf.c (SHT_NULL, SHT_SYMTAB, SHT_RELA, SHT_REL,
	SHT_GROUP): Add various sectopn header types.
	(SHF_EXCLUDE): Add flag.
	(Elf32_External_Sym, Elf64_External_Sym): Add symbol struct.
	(ELF_ST_BIND, ELF_ST_TYPE, ELF_ST_INFO): Add accessors.
	(STT_OBJECT, STT_FUNC, STT_TLS, STT_GNU_IFUNC): Add Symbol types.
	(STV_DEFAULT): Add symbol visibility.
	(SHN_COMMON): Add special section index name.
	(struct simple_object_elf_write): New.
	(simple_object_elf_start_write): Adjust for new private data.
	(simple_object_elf_write_shdr): Pass in values for all fields
	we write.
	(simple_object_elf_write_to_file): Adjust.  Copy from recorded
	section headers if requested.
	(simple_object_elf_release_write): Release private data.
	(simple_object_elf_copy_lto_debug_sections): Copy and rename sections
	as denoted by PFN and all their dependences, symbols and relocations
	to the empty destination file.
	(simple_object_elf_functions): Adjust for copy_lto_debug_sections hook.

        gcc/
        * debug.h (struct gcc_debug_hooks): Add die_ref_for_decl and
        register_external_die hooks.
        (debug_false_tree_charstarstar_uhwistar): Declare.
        (debug_nothing_tree_charstar_uhwi): Likewise.
        * debug.c (do_nothing_debug_hooks): Adjust.
        (debug_false_tree_charstarstar_uhwistar): New do nothing.
        (debug_nothing_tree_charstar_uhwi): Likewise.
        * dbxout.c (dbx_debug_hooks): Adjust.
        (xcoff_debug_hooks): Likewise.
        * sdbout.c (sdb_debug_hooks): Likewise.
        * vmsdbgout.c (vmsdbg_debug_hooks): Likewise.
        * dwarf2out.c (macinfo_label_base): New global.
	(dwarf2out_register_external_die): New function for the
	register_external_die hook.
        (dwarf2out_die_ref_for_decl): Likewise for die_ref_for_decl.
        (dwarf2_debug_hooks): Use them.
        (dwarf2_lineno_debug_hooks): Adjust.
        (struct die_struct): Add with_offset flag.
        (DEBUG_LTO_DWO_INFO_SECTION, DEBUG_LTO_INFO_SECTION,
        DEBUG_LTO_DWO_ABBREV_SECTION, DEBUG_LTO_ABBREV_SECTION,
        DEBUG_LTO_DWO_MACINFO_SECTION, DEBUG_LTO_MACINFO_SECTION,
        DEBUG_LTO_DWO_MACRO_SECTION, DEBUG_LTO_MACRO_SECTION,
        DEBUG_LTO_LINE_SECTION, DEBUG_LTO_DWO_STR_OFFSETS_SECTION,
        DEBUG_LTO_STR_DWO_SECTION, DEBUG_STR_LTO_SECTION): New macros
        defining section names for the early LTO debug variants.
	(reset_indirect_string): New helper.
        (add_AT_external_die_ref): Helper for dwarf2out_register_external_die.
        (print_dw_val): Add support for offsetted symbol references.
	(get_ultimate_context): Split out from is_cxx.
	(is_cxx): Use get_ultimate_context.
	(is_fortran): Add decl overload.
        (compute_comp_unit_symbol): Split out worker from
	compute_section_prefix.
        (compute_section_prefix): Call compute_comp_unit_symbol and
	set comdat_type_p here.
        (output_die): Skip DIE symbol output for the LTO added one.
        Handle DIE symbol references with offset.
        (output_comp_unit): Guard section name mangling properly.
        For LTO debug sections emit a symbol at the section beginning
        which we use to refer to its DIEs.
        (add_abstract_origin_attribute): For DIEs registered via
        dwarf2out_register_external_die directly refer to the early
        DIE rather than indirectly through the shadow one we created.
	Remove obsolete call to dwarf2out_abstract_function for
	non-function/block origins.
        (gen_array_type_die): When generating early LTO debug do
        not emit DW_AT_string_length.
        (gen_formal_parameter_die): Do not re-create DIEs for PARM_DECLs
        late when in LTO.  As suggested place a gcc_unreachable for
	the DECL_ABSTRACT_P case.
        (gen_subprogram_die): Avoid another specification DIE
        for early built declarations/definitions for the late LTO case.
        (gen_variable_die): Add type references for late duplicated VLA dies
        when in late LTO.
        (gen_inlined_subroutine_die): Do not call dwarf2out_abstract_function,
        we have the abstract instance already.
        (process_scope_var): Adjust decl DIE contexts in LTO which
        first puts them in limbo.
        (gen_decl_die): Do not generate type DIEs late apart from
        types for VLAs or for decls we do not yet have a DIE.  Do not
	call dwarf2out_abstract_function late.
        (dwarf2out_early_global_decl): Make sure to create DIEs
        for abstract instances of a decl first.
        (dwarf2out_late_global_decl): Adjust comment.
        (output_macinfo_op): With multiple macro sections use
	macinfo_label_base to distinguish labels.
        (output_macinfo): Likewise.  Update macinfo_label_base.
	Pass in the line info label.
	(note_variable_value_in_expr): When generating LTO resolve
	all variable values here by generating DIEs as needed.
        (init_sections_and_labels): Add early LTO debug flag parameter
        and generate different sections and names if set.  Add generation
        counter for the labels so we can have multiple of them.
        (reset_dies): Helper to allow DIEs to be output multiple times.
        (dwarf2out_finish): When outputting DIEs to the fat part of an
	LTO object first reset DIEs.
        (dwarf2out_early_finish): Output early DIEs when generating LTO.
	(modified_type_die): Check for decl_ultimate_origin being self
	before recursing.
	(gen_type_die_with_usage): Likewise.
	(gen_typedef_die): Allow decl_ultimate_origin being self.
        (set_decl_abstract_flags): Remove.
        (set_block_abstract_flags): Likewise.
        (dwarf2out_abstract_function): Treat the early generated DIEs
        as the abstract copy and only add DW_AT_inline and
        DW_AT_artificial here and call set_decl_origin_self.
	If the DIE has an abstract origin don't do anything.
	* tree.c (free_lang_data): Build a dummy TRANSLATION_UNIT_DECL
	if we have none yet (Go fails to build one, PR78628).
	(variably_modified_type_p): Prevent endless recursion for Ada
	cyclic pointer types.
        * lto-streamer-in.c: Include debug.h.
        (dref_queue): New global.
        (lto_read_tree_1): Stream in DIE references.
        (lto_input_tree): Register DIE references.
	(input_function): Stream DECL_DEBUG_ARGS.
        * lto-streamer-out.c: Include debug.h.
        (lto_write_tree_1): Output DIE references.
        (DFS::DFS_write_tree_body): Follow DECL_ABSTRACT_ORIGIN.
	Force a TRANSLATION_UNIT_DECL DECL_CONTEXT for file-scope decls.
	(output_function): Stream DECL_DEBUG_ARGS.
        * tree-streamer-in.c (lto_input_ts_decl_common_tree_pointers):
        Stream DECL_ABSTRACT_ORIGIN.
        * tree-streamer-out.c (write_ts_decl_common_tree_pointers): Likewise.
	(write_ts_decl_minimal_tree_pointers): Force a TRANSLATION_UNIT_DECL
	DECL_CONTEXT for file-scope decls.
        * lto-streamer.h (struct dref_entry): Declare.
        (dref_queue): Likewise.
	* cfgexpand.c (pass_expand::execute): Do not call the
	outlining_inline_function hook here.
        * lto-wrapper.c (debug_obj): New global.
        (tool_cleanup): Unlink it if required.
        (debug_objcopy): New function.
        (run_gcc): Handle early debug sections in the IL files by
        extracting them to separate files, partially linkin them and
        feeding the result back as result to the linker.

        * config/darwin.h (DEBUG_LTO_INFO_SECTION, DEBUG_LTO_ABBREV_SECTION,
        DEBUG_LTO_MACINFO_SECTION, DEBUG_LTO_LINE_SECTION,
        DEBUG_STR_LTO_SECTION, DEBUG_LTO_MACRO_SECTION): Put early debug
        sections into a separate segment.
        * config/darwin.c (darwin_asm_named_section): Handle __GNU_DWARF_LTO
        segments.
        (darwin_asm_dwarf_section): Likewise.
        (darwin_asm_output_dwarf_offset): Likewise.

	* config/i386/i386.c (make_resolver_func): Set DECL_IGNORED_P.

        lto/
        * lto.c (unify_scc): Truncate DIE reference queue for dropped SCCs.
        (lto_read_decls): Process TRANSLATION_UNIT_DECLs.  Remove
        TYPE_DECL debug processing, register DIE references from
        prevailing SCCs with the debug machinery.
        (lto_section_with_id): Handle LTO debug sections.

	libstdc++/
	* testsuite/libstdc++-prettyprinters/prettyprinters.exp: Run all
	tests with -flto as well if supported.

        testsuite/
	* c-c++-common/asan/global-overflow-1.c: Adjust diagnostic location
	regex to handle the LTO case.
	* c-c++-common/asan/heap-overflow-1.c: Likewise.
	* c-c++-common/asan/misalign-1.c: Likewise.
	* c-c++-common/asan/misalign-2.c: Likewise.
	* c-c++-common/asan/null-deref-1.c: Likewise.
	* c-c++-common/asan/stack-overflow-1.c: Likewise.
	* c-c++-common/asan/strncpy-overflow-1.c: Likewise.
	* c-c++-common/asan/use-after-free-1.c: Likewise.
	* c-c++-common/asan/alloca_big_alignment.c: Likewise.
	* c-c++-common/asan/alloca_detect_custom_size.c: Likewise.
	* c-c++-common/asan/alloca_overflow_partial.c: Likewise.
	* c-c++-common/asan/alloca_overflow_right.c: Likewise.
	* c-c++-common/asan/alloca_underflow_left.c: Likewise.
	* g++.dg/asan/large-func-test-1.C: Likewise.
	* gfortran.dg/save_6.f90: Add -flto -g variant of save_5.f90.

From-SVN: r251220
2017-08-21 10:29:00 +00:00
Jan Kratochvil ef29f5dd77 include/ChangeLog
2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

        * dwarf2.def (DW_IDX_compile_unit, DW_IDX_type_unit, DW_IDX_die_offset)
        (DW_IDX_parent, DW_IDX_type_hash, DW_IDX_lo_user, DW_IDX_hi_user)
        (DW_IDX_GNU_internal, DW_IDX_GNU_external): New.
        * dwarf2.h (DW_IDX, DW_IDX_DUP, DW_FIRST_IDX, DW_END_IDX): New.
        (enum dwarf_name_index_attribute): Remove.
        (get_DW_IDX_name): New declaration.

libiberty/ChangeLog
2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

        * dwarfnames.c (DW_FIRST_IDX, DW_END_IDX, DW_IDX, DW_IDX_DUP): New.

From-SVN: r249883
2017-07-02 20:00:48 +00:00
Tony Reix c1d2490437 simple-object-xcoff.c (simple_object_xcoff_find_sections): Search symbol table for .go_export symbol and apply pfn if found.
2017-06-07  Tony Reix  <tony.reix@atos.net>
            Matthieu Sarter  <matthieu.sarter.external@atos.net>
            David Edelsohn  <dje.gcc@gmail.com>

        * simple-object-xcoff.c (simple_object_xcoff_find_sections):
        Search symbol table for .go_export symbol and apply pfn if found.

Co-Authored-By: David Edelsohn <dje.gcc@gmail.com>
Co-Authored-By: Matthieu Sarter <matthieu.sarter.external@atos.net>

From-SVN: r248999
2017-06-07 19:23:55 -04:00
DJ Delorie 63d9caf904 configure.ac (strnlen): Add to AC_CHECK_DECLS.
* configure.ac (strnlen): Add to AC_CHECK_DECLS.
* configure: Likewise.
* config.in: Add HACE_DECL_STRNLEN.

From-SVN: r248721
2017-05-31 00:16:45 -04:00
Iain Buclaw dc64856fdf d-demangle.c (dlang_identifier): Prefix mangled init symbols with `initializer for'.
libiberty/ChangeLog:

	* d-demangle.c (dlang_identifier): Prefix mangled init symbols
	with `initializer for'.
	* testsuite/demangle-expected: Update tests.

From-SVN: r248539
2017-05-27 11:30:22 +00:00
Iain Buclaw 0e3712f6aa d-demangle.c (dlang_call_convention_p): Move declaration before dlang_type.
libiberty/ChangeLog:

	* d-demangle.c (dlang_call_convention_p): Move declaration
	before dlang_type.
	(dlang_type): Handle function types.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r248538
2017-05-27 11:29:52 +00:00
Iain Buclaw 1a122a71ee d-demangle.c (dlang_parse_real): Remove stack buffer, write the demangled hexadecimal directly to string.
libiberty/ChangeLog:

	* d-demangle.c (dlang_parse_real): Remove stack buffer, write
	the demangled hexadecimal directly to string.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r248537
2017-05-27 11:29:38 +00:00
Eli Zaretskii 1ab4db9379 waitpid.c (wait): Define as a macro that calls _cwait, so that this function works on MinGW.
2017-05-24  Eli Zaretskii  <eliz@gnu.org>
* libiberty/waitpid.c (wait) [__MINGW32__]: Define as a macro
that calls _cwait, so that this function works on MinGW.

From-SVN: r248430
2017-05-24 17:35:59 -04:00
Iain Buclaw 5398cab9ca d-demangle.c (dlang_hexdigit): New function.
libiberty/ChangeLog:

	* d-demangle.c (dlang_hexdigit): New function.
	(ascii2hex): Remove function.
	(dlang_parse_string): Update to call dlang_hexdigit.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247455
2017-05-01 23:38:50 +00:00
Iain Buclaw dbe65f77ff d-demangle.c (strtol): Remove declaration.
libiberty/ChangeLog:

	* d-demangle.c (strtol): Remove declaration.
	Updated all callers to use dlang_number.
	(dlang_number): New function.
	(dlang_value): Moved check for ISDIGIT into dlang_parse_integer.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247453
2017-05-01 23:31:24 +00:00
Iain Buclaw 5a4dbf7d31 d-demangle.c (dlang_parse_symbol): Remove function.
libiberty/ChangeLog:

	* d-demangle.c (dlang_parse_symbol): Remove function.
	(dlang_parse_qualified): New function.
	(dlang_parse_mangle): New function.
	(dlang_type): Update to call dlang_parse_qualified.
	(dlang_identifier): Update to call either dlang_parse_qualified or
	dlang_parse_mangle.
	(dlang_type_modifier_p): Remove function.
	(dlang_call_convention_p): Don't allow type modifiers in mangle.
	(dlang_template_args): Update to call dlang_identifier.
	(dlang_demangle): Update to call dlang_parse_mangle.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247450
2017-05-01 22:51:04 +00:00
Iain Buclaw dd03444ba5 d-demangle.c (dlang_value): Add comment explaining why cases for digits are required.
libiberty/ChangeLog:

	* d-demangle.c (dlang_value): Add comment explaining why cases for
	digits are required.
	* testsuite/d-demangle-expected: Update integer value tests.

From-SVN: r247436
2017-05-01 11:01:02 +00:00
Iain Buclaw 98bb7ee2da d-demangle.c (dlang_parse_symbol): Skip over anonymous symbols.
libiberty/ChangeLog:

	* d-demangle.c (dlang_parse_symbol): Skip over anonymous symbols.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247434
2017-05-01 10:50:58 +00:00
Iain Buclaw c6f44bae7e d-demangle.c (dlang_identifier): Handle template constraint symbols.
libiberty/ChangeLog:

	* d-demangle.c (dlang_identifier): Handle template constraint symbols.
	(dlang_parse_template): Only advance if template symbol prefix is
	followed by a digit.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247433
2017-05-01 10:45:35 +00:00
Iain Buclaw ec89d258a0 d-demangle.c (dlang_attributes): Handle scope attributes.
libiberty/ChangeLog:

	* d-demangle.c (dlang_attributes): Handle scope attributes.
	* testsuite/d-demangle-expected: Add tests.

From-SVN: r247432
2017-05-01 10:39:52 +00:00
Jonathan Wakely de3b531c9a PR demangler/80513 check for overflows and invalid characters in thunks
PR demangler/80513
	* cp-demangle.c (d_number): Check for overflow.
	* cplus-dem.c (consume_count): Fix overflow check.
	(gnu_special): Check for underscore after thunk delta.
	* testsuite/demangle-expected: Add tests for overflows and invalid
	characters in thunks.

From-SVN: r247300
2017-04-27 10:44:28 +01:00
Mark Wielaard 6b086d35b7 libiberty: Limit demangler maximum d_print_comp recursion call depth.
The fix for PR demangler/70909 and 67264 (endless demangler recursion)
catches when a demangle_component is printed in a cycle. But that doesn't
protect the call stack blowing up from non-cyclic nested types printed
recursively through d_print_comp. This can happen by a (very) long mangled
string that simply creates a very deep pointer or qualifier chain. Limit
the recursive d_print_comp call depth for a d_print_info to 1K nested
types.

libiberty/ChangeLog:

        * cp-demangle.c (MAX_RECURSION_COUNT): New constant.
        (struct d_print_info): Add recursion field.
        (d_print_init): Initialize recursion.
        (d_print_comp): Check and update d_print_info recursion depth.

From-SVN: r247056
2017-04-21 09:02:03 +00:00
Mark Wielaard 13b6ef76dc libiberty: Always return NULL if d_add_substitution fails.
d_add_substitution can fail for various reasons, like when the subs array
is full. If d_add_substitution fails d_substitution should return NULL
early and not try to continue. Every other call of d_add_substitution
is handled in the same way.

libiberty/ChangeLog:

	* cp-demangle.c (d_substitution): Return NULL if d_add_substitution
	fails.

From-SVN: r247055
2017-04-21 09:01:56 +00:00
Mark Wielaard 1240212c6b libiberty: Don't update and remove did_subs field from demangler structs.
The d_info field did_subs was used for estimating the string output
size. It was no longer used when the malloc-less callback interface
was introduced in 2007 (svn r121305). But the field was still updated.
When backtracking was introduced in 2013 (svn r205292) did_subs was
also added to the d_info_checkpoint struct. But except for updating
the field it was still not used.

Since it is never used just stop updating the field and remove it
from the two structs.

libiberty/ChangeLog:

	* cp-demangle.h (struct d_info): Remove did_subs field.
	* cp-demangle.c (struct d_info_checkpoint): Likewise.
	(d_template_param): Don't update did_subs.
	(d_substitution): Likewise.
	(d_checkpoint): Don't assign did_subs.
	(d_backtrack): Likewise.
	(cplus_demangle_init_info): Don't initialize did_subs.

From-SVN: r247054
2017-04-21 09:01:44 +00:00
Pedro Alves 7a312bbd41 cplus_demangle_fill_component: Handle DEMANGLE_COMPONENT_RVALUE_REFERENCE
This patch almost a decade ago:

...
    2007-08-31  Douglas Gregor  <doug.gregor@gmail.com>

        * cp-demangle.c (d_dump): Handle
        DEMANGLE_COMPONENT_RVALUE_REFERENCE.
        (d_make_comp): Ditto.
...

... missed doing the same change to cplus_demangle_fill_component that
was done to d_make_comp.  I.e., teach it to only validate that we're
not passing in a "right" subtree.  GDB has recently (finally) learned
about rvalue references, and a change to make it use
cplus_demangle_fill_component more ran into an assertion because of
this.

(GDB is the only user of cplus_demangle_fill_component in both the gcc
and binutils-gdb trees.)

libiberty/ChangeLog:
2017-03-27  Pedro Alves  <palves@redhat.com>

	* cp-demint.c (cplus_demangle_fill_component): Handle
	DEMANGLE_COMPONENT_RVALUE_REFERENCE.

From-SVN: r246502
2017-03-27 14:23:49 +00:00
Mark Wielaard 9905ca975c libiberty: Initialize d_printing in all cplus_demangle_fill_* functions.
While integrating the d_printing recursion guard change into gdb I
noticed we forgot to initialize the demangle_component d_printing
field in cplus_demangle_fill_{name,extended_operator,ctor,dtor}.
As is done in cplus_demangle_fill_{component,builtin_type,operator}.
It happened to work because in gcc all demangle_components were
allocated through d_make_empty. But gdb has its own allocation
mechanism (as might other users).

libiberty/ChangeLog:

       * cp-demangle.c (cplus_demangle_fill_name): Initialize
       demangle_component d_printing.
       (cplus_demangle_fill_extended_operator): Likewise.
       (cplus_demangle_fill_ctor): Likewise.
       (cplus_demangle_fill_dtor): Likewise.

From-SVN: r246105
2017-03-13 18:26:47 +00:00
Mark Wielaard a46586c34f Fix PR demangler/70909 and 67264 (endless demangler recursion)
ChangeLog:

       PR demangler/70909
       PR demangler/67264
       * include/demangle.h: Add d_printing to struct demangle_component
       and pass struct demangle_component as non const.

libiberty/ChangeLog:

       PR demangler/70909
       PR demangler/67264
       * cp-demangle.c: Fix endless recursion. Pass
       struct demangle_component as non const.
       (d_make_empty): Initialize variable.
       (d_print_comp_inner): Limit recursion.
       (d_print_comp): Decrement variable.
       * cp-demint.c (cplus_demangle_fill_component): Initialize
       variable.
       (cplus_demangle_fill_builtin_type): Likewise.
       (cplus_demangle_fill_operator): Likewise.
       * testsuite/demangle-expected: Add tests.

From-SVN: r245978
2017-03-08 14:28:38 +00:00
Markus Trippelsdorf 4bbc35f33f Fix PR70182 -- missing "on" in mangling of unresolved operators
The ABI says:

<unresolved-name>
   ::= [gs] <base-unresolved-name>
   ::= sr <unresolved-type> <base-unresolved-name>
   ::= srN <unresolved-type> <unresolved-qualifier-level>+ E <base-unresolved-name>
   ::= [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name>

<base-unresolved-name>
   ::= <simple-id>
   ::= on <operator-name>
   ::= on <operator-name> <template-args>
   ::= dn <destructor-name

libiberty:

	PR c++/70182
	* cp-demangle.c (d_unqualified_name): Handle "on" for
	operator names.
	* testsuite/demangle-expected: Add tests.

gcc/cp:

	PR c++/70182
	* mangle.c (write_template_args): Add "on" for operator names.

gcc:

	PR c++/70182
	* doc/invoke.texi (fabi-version): Mention mangling fix for
	operator names.

From-SVN: r244567
2017-01-18 08:49:11 +00:00
Markus Trippelsdorf f6efea5163 Fix PR77489 -- mangling of discriminator >= 1
libiberty:

	PR c++/77489
	* cp-demangle.c (d_discriminator): Handle discriminator >= 10.
	* testsuite/demangle-expected: Add tests for discriminator.

gcc:
	PR c++/77489
	* doc/invoke.texi (fabi-version): Document discriminator mangling.

gcc/cp:

	PR c++/77489
	* mangle.c (write_discriminator): Handle discriminator >= 10.

From-SVN: r244566
2017-01-18 08:40:05 +00:00
Jakub Jelinek 2afd3180c5 Update copyright years.
From-SVN: r244052
2017-01-04 12:30:51 +01:00
Alan Modra 8f56cb5163 Update configure deps, remove stray \xA0 in picflag.m4, regenerate
Also fix a stray changelog entry.  Some of the regen here is due to
previous changes not being regenerated properly, in part due to the
missing configure dependencies.

	* configure: Regenerate.
config/
	* picflag.m4: Remove stray \xA0 in comment.
gcc/
	* Makefile.in (aclocal_deps): Update and order as per aclocal.m4.
	* configure: Regenerate.
	* config.in: Regenerate.
libada/
	* Makefile.in (configure_deps): Update and order as per
	configure.ac sinclude.
	* configure: Regenerate.
libgcc/
	* Makefile.in (configure_deps): Update.
	* configure: Regenerate.
libiberty/
	* Makefile.in (configure_deps): Update.
	* configure: Regenerate.
libitm/
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r244049
2017-01-04 18:59:34 +10:30
Jakub Jelinek 816f431440 re PR c++/78761 (C++14, compiler generate mangled name that can not be demangled)
PR c++/78761
	* cp-demangle.c (cplus_demangle_type): Demangle Dc as decltype(auto).
	* testsuite/demangle-expected: Add test for decltype(auto).

From-SVN: r243593
2016-12-13 07:16:05 +01:00
Nathan Sidwell 8e09a726e6 re PR other/78252 (C++ demangler crashes with infinite recursion with lambda (auto))
libiberty/
	PR c++/78252
	* cp-demangle.c (struct d_print_info): Add is_lambda_arg field.
	(d_print_init): Initialize it.
	(d_print_comp_inner) <DEMANGLE_COMPONENT_TEMPLATE_PARAM>: Check
	is_lambda_arg for auto.
	<DEMANGLE_COMPONENT_REFERENCE,
	DEMANGLE_COMPONENT_RVALUE_REFERENCE>: Skip smashing check when
	is_lambda_arg.
	<DEMANGLE_COMPONENT_LAMBDA>: Increment is_lambda_arg around arg
	printing.
	* testsuite/demangle-expected: Add lambda auto mangling cases.

	gcc/testsuite/
	PR c++/78252
	* g++.dg/cpp1y/lambda-mangle-1.C: New.

From-SVN: r243566
2016-12-12 17:00:37 +00:00
DJ Delorie 1d2ccddf2e Oops, fix date
From-SVN: r243281
2016-12-06 01:40:07 -05:00
DJ Delorie 2207ff5dd1 * argv.c (expandargv): Check for directories passed as @-files.
From-SVN: r243280
2016-12-06 01:38:23 -05:00
David Malcolm e613205cef libiberty: avoid reading past end of buffer in strndup/xstrndup (PR c/78498)
gcc/ChangeLog:
	PR c/78498
	* selftest.c (selftest::assert_strndup_eq): New function.
	(selftest::test_strndup): New function.
	(selftest::test_libiberty): New function.
	(selftest::selftest_c_tests): Call test_libiberty.

gcc/testsuite/ChangeLog:
	PR c/78498
	* gcc.dg/format/pr78494.c: New test case.

libiberty/ChangeLog:
	PR c/78498
	* strndup.c (strlen): Delete decl.
	(strnlen): Add decl.
	(strndup): Call strnlen rather than strlen.
	* xstrndup.c (xstrndup): Likewise.

From-SVN: r243030
2016-11-30 14:50:43 +00:00
Nathan Sidwell 8684b29203 * cp-demangle.c (d_print_comp_inner): Fix parameter indentation.
From-SVN: r242963
2016-11-29 15:28:52 +00:00
David Tolnay 10d48c59b0 libiberty: Add Rust symbol demangling.
Adds Rust symbol demangler. Rust mangles symbols using GNU_V3 style,
adding a hash and various special character subtitutions. This adds
a new rust style to cplus_demangle and adds 3 helper functions
rust_demangle, rust_demangle_sym and rust_is_mangled.

rust-demangle.c was written by David. Mark did the code formatting to
GNU style and integration into the gcc/libiberty build system and
testsuite.

include/ChangeLog:

2016-11-03  David Tolnay <dtolnay@gmail.com>
           Mark Wielaard  <mark@klomp.org>

       * demangle.h (DMGL_RUST): New macro.
       (DMGL_STYLE_MASK): Add DMGL_RUST.
       (demangling_styles): Add dlang_rust.
       (RUST_DEMANGLING_STYLE_STRING): New macro.
       (RUST_DEMANGLING): New macro.
       (rust_demangle): New prototype.
       (rust_is_mangled): Likewise.
       (rust_demangle_sym): Likewise.

libiberty/ChangeLog:

2016-11-03  David Tolnay <dtolnay@gmail.com>
           Mark Wielaard  <mark@klomp.org>

       * Makefile.in (CFILES): Add rust-demangle.c.
       (REQUIRED_OFILES): Add rust-demangle.o.
       * cplus-dem.c (libiberty_demanglers): Add rust_demangling case.
       (cplus_demangle): Handle RUST_DEMANGLING.
       (rust_demangle): New function.
       * rust-demangle.c: New file.
       * testsuite/Makefile.in (really-check): Add check-rust-demangle.
       (check-rust-demangle): New rule.
       * testsuite/rust-demangle-expected: New file.

Co-Authored-By: Mark Wielaard <mark@klomp.org>

From-SVN: r242524
2016-11-16 23:09:27 +00:00
Mark Wielaard 168126e598 libiberty: demangler crash with missing :? or fold expression component.
When constructing an :? or fold expression that requires a third
expression only the first and second were explicitly checked to
not be NULL. Since the third expression is also required in these
constructs it needs to be explicitly checked and rejected when missing.
Otherwise the demangler will crash once it tries to d_print the
NULL component. Added two examples to demangle-expected of strings
that would crash before this fix.

Found by American Fuzzy Lop (afl) fuzzer.

From-SVN: r242451
2016-11-15 19:31:59 +00:00