aboutsummaryrefslogtreecommitdiff
path: root/libiberty
AgeCommit message (Collapse)AuthorFilesLines
2019-08-09Synchronize libiberty sources with gcc mainline.Nick Clifton10-30/+223
* libiberty: Sync with gcc. Bring in: 2019-08-08 Martin Liska <mliska@suse.cz> PR bootstrap/91352 * lrealpath.c (is_valid_fd): New function. 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. 2019-07-12 Ren Kimura <rkx1209dev@gmail.com> * simple-object-elf.c (simple_object_elf_match): Check zero value shstrndx. This fixes a Bug 90924. 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'. 2019-07-18 Eduard-Mihai Burtescu <eddyb@lyken.rs> * cplus-dem.c: Include rust-demangle.h. * rust-demangle.c: Include rust-demangle.h. * rust-demangle.h: New file. 2019-05-31 Michael Forney <mforney@mforney.org> * cp-demangle.c: Don't define CP_DYNAMIC_ARRAYS if __STDC_NO_VLA__ is non-zero. 2019-04-30 Ben L <bobsayshilol@live.co.uk> * d-demangle.c (dlang_parse_assocarray): Correctly handle error result. * testsuite/d-demangle-expected: Add testcase. * d-demangle.c (dlang_parse_tuple): Correctly handle error result. * testsuite/d-demangle-expected: Add testcase. * d-demangle.c (dlang_parse_structlit): Correctly handle error result. * testsuite/d-demangle-expected: Add testcase. * d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result. * testsuite/d-demangle-expected: Add testcase. * d-demangle.c (dlang_parse_integer): Fix stack underflow. * testsuite/d-demangle-expected: Add testcase. * cp-demangle (d_print_comp_inner): Guard against a NULL 'typed_name'. * testsuite/demangle-expected: Add testcase. * cp-demangle.c (d_encoding): Guard against NULL return values from d_right (dc). * testsuite/demangle-expected: Add testcase. 2019-04-29 Ben L <bobsayshilol@live.co.uk> * cp-demangle.c (d_expression_1): Don't peek ahead unless the current char is valid. * testsuite/demangle-expected: Add testcase. 2019-04-10 Nick Clifton <nickc@redhat.com> 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.
2019-04-10Pull in patch for libiberty that fixes a stack exhaustion bug when ↵Nick Clifton1-22/+26
demangling 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.
2019-04-07Merge libiberty from gccAlan Modra8-40/+85
2019-02-12Fix splay tree KEY leak detected in GDB test gdb.base/macscp.exptromey2-3/+16
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268793 138bc75d-0d04-0410-961f-82ee72b054a4
2019-01-21Fix leak in splay-treeTom Tromey2-0/+6
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.
2019-01-10Sync libiberty sources with gcc master versions.Nick Clifton6-7998/+86
. * libiberty: Sync with gcc. Bring in: 2019-01-09 Sandra Loosemore <sandra@codesourcery.com> PR other/16615 * cp-demangle.c: Mechanically replace "can not" with "cannot". * floatformat.c: Likewise. * strerror.c: Likewise. 2018-12-22 Jason Merrill <jason@redhat.com> Remove support for demangling GCC 2.x era mangling schemes. * 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 * Merge from GCC: 2018-12-22 Jason Merrill <jason@redhat.com> * demangle.h: Remove support for ancient GNU (pre-3.0), Lucid, ARM, HP, and EDG demangling styles.
2019-01-09Merge from gcc: use "cannot" instead of "can not" in libiberty and include.Sandra Loosemore4-4/+13
2019-01-09 Sandra Loosemore <sandra@codesourcery.com> Merge from GCC: 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.
2019-01-07Revert "Sync libiberty sources with master version in gcc repository. ↵Simon Marchi3-85/+7988
Updated stabs demangling and cxxfilt tests to match." The previous commit breaks the GDB build, which is still using functions cplus_demangle_opname & co. Since removing these usages is not an obvious fix, let's revert this patch until we get rid of them.
2019-01-07Sync libiberty sources with master version in gcc repository. Updated stabs ↵Nick Clifton3-7988/+85
demangling and cxxfilt tests to match. PR 24044 * stabs.c (parse_stab_argtypes): Remove call to cplus_mangle_opcode. * testsuite/binutils-all/cxxfilt.exp: Replace tests of v2 encoding with v3 encoding. Add escape for known failures.
2019-01-01Update year range in copyright notice of binutils filesAlan Modra92-93/+93
2018-12-07Synchronize libiberty with gcc and add --no-recruse-limit option to tools ↵Nick Clifton8-132/+323
that support name demangling. This patch addresses the multitude of bug reports about resource exhaustion in libiberty's name demangling code. It adds a limit to the amount of recursion that is allowed, before an error is triggered. It also adds a new demangling option to disable this limit. (The limit is enabled by default). PR 87681 PR 87675 PR 87636 PR 87335 libiberty * cp-demangle.h (struct d_info): Add recursion_limit field. * cp-demangle.c (d_function_type): If the recursion limit is enabled and reached, return with a failure result. (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. (demangle_nested_args): If the recursion limit is enabled and reached, return with a failure result. include * demangle.h (DMGL_RECURSE_LIMIT): Define. (DEMANGLE_RECURSION_LIMIT): Prototype. binutuils * addr2line.c (demangle_flags): New static variable. (long_options): Add --recurse-limit and --no-recurse-limit. (translate_address): Pass demangle_flags to bfd_demangle. (main): Handle --recurse-limit and --no-recurse-limit options. * cxxfilt.c (flags): Add DMGL_RECURSE_LIMIT. (long_options): Add --recurse-limit and --no-recurse-limit. (main): Handle new options. * dlltool.c (gen_def_file): Include DMGL_RECURSE_LIMIT in flags passed to cplus_demangle. * nm.c (demangle_flags): New static variable. (long_options): Add --recurse-limit and --no-recurse-limit. (main): Handle new options. * objdump.c (demangle_flags): New static variable. (usage): Add --recurse-limit and --no-recurse-limit. (long_options): Likewise. (objdump_print_symname): Pass demangle_flags to bfd_demangle. (disassemble_section): Likewise. (dump_dymbols): Likewise. (main): Handle new options. * prdbg.c (demangle_flags): New static variable. (tg_variable): Pass demangle_flags to demangler. (tg_start_function): Likewise. * stabs.c (demangle_flags): New static variable. (stab_demangle_template): Pass demangle_flags to demangler. (stab_demangle_v3_argtypes): Likewise. (stab_demangle_v3_arg): Likewise. * doc/binutuls.texi: Document new command line options. * NEWS: Mention the new feature. * testsuite/config/default.exp (CXXFILT): Define if not already defined. (CXXFILTFLAGS): Likewise. * testsuite/binutils-all/cxxfilt.exp: New file. Runs a few simple tests of the cxxfilt program.
2018-08-01Copy from GCC: Add linker_output as prefix for LTO temps (PR lto/86548).marxin2-6/+29
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262999 138bc75d-0d04-0410-961f-82ee72b054a4
2018-07-19Fix GDB build using mingw.org's MinGWEli Zaretskii2-0/+10
libiberty/ 2018-07-18 Eli Zaretskii <eliz@gnu.org> PR gdb/23434 * libiberty/simple-object-elf.c (ENOTSUP): If not defined by errno.h, redirect ENOTSUP to ENOSYS.
2018-06-19Bump to autoconf 2.69 and automake 1.15.1Simon Marchi4-511/+623
When trying to run the update-gnulib.sh script in gdb, I get this: Error: Wrong automake version (Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ =:+{}]+)}/ at /opt/automake/1.11.1/bin/automake line 4113.), we need 1.11.1. Aborting. Apparently, it's an issue with a regex in automake that triggers a warning starting with Perl 5.22. It has been fixed in automake 1.15.1. So I think it's a good excuse to bump the versions of autoconf and automake used in the gnulib import. And to avoid requiring multiple builds of autoconf/automake, it was suggested that we bump the required version of those tools for all binutils-gdb. For autoconf, the 2.69 version is universally available, so it's an easy choice. For automake, different distros and distro versions have different automake versions. But 1.15.1 seems to be the most readily available as a package. In any case, it's easy to build it from source. I removed the version checks from AUTOMAKE_OPTIONS and AC_PREREQ, because I don't think they are useful in our case. They only specify a lower bound for the acceptable version of automake/autoconf. That's useful if you let the user choose the version of the tool they want to use, but want to set a minimum version (because you use a feature that was introduced in that version). In our case, we force people to use a specific version anyway. For the autoconf version, we have the check in config/override.m4 that enforces the version we want. It will be one less thing to update next time we change autotools version. I hit a few categories of problems that required some changes. They are described below along with the chosen solutions. Problem 1: configure.ac:17: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see: configure.ac:17: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation Solution 1: Adjust the code based on the example at that URL. Problem 2 (in zlib/): Makefile.am: error: required file './INSTALL' not found Makefile.am: 'automake --add-missing' can install 'INSTALL' Makefile.am: error: required file './NEWS' not found Makefile.am: error: required file './AUTHORS' not found Makefile.am: error: required file './COPYING' not found Makefile.am: 'automake --add-missing' can install 'COPYING' Solution 2: Add the foreign option to AUTOMAKE_OPTIONS. Problem 3: doc/Makefile.am:20: error: support for Cygnus-style trees has been removed Solution 3: Remove the cygnus options. Problem 4: Makefile.am:656: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') Solution 4: Rename "INCLUDES = " to "AM_CPPFLAGS += " (because AM_CPPFLAGS is already defined earlier). Problem 5: doc/Makefile.am:71: warning: suffix '.texinfo' for Texinfo files is discouraged; use '.texi' instead doc/Makefile.am: warning: Oops! doc/Makefile.am: It appears this file (or files included by it) are triggering doc/Makefile.am: an undocumented, soon-to-be-removed automake hack. doc/Makefile.am: Future automake versions will no longer place in the builddir doc/Makefile.am: (rather than in the srcdir) the generated '.info' files that doc/Makefile.am: appear to be cleaned, by e.g. being listed in CLEANFILES or doc/Makefile.am: DISTCLEANFILES. doc/Makefile.am: If you want your '.info' files to be placed in the builddir doc/Makefile.am: rather than in the srcdir, you have to use the shiny new doc/Makefile.am: 'info-in-builddir' automake option. Solution 5: Rename .texinfo files to .texi. Problem 6: doc/Makefile.am: warning: Oops! doc/Makefile.am: It appears this file (or files included by it) are triggering doc/Makefile.am: an undocumented, soon-to-be-removed automake hack. doc/Makefile.am: Future automake versions will no longer place in the builddir doc/Makefile.am: (rather than in the srcdir) the generated '.info' files that doc/Makefile.am: appear to be cleaned, by e.g. being listed in CLEANFILES or doc/Makefile.am: DISTCLEANFILES. doc/Makefile.am: If you want your '.info' files to be placed in the builddir doc/Makefile.am: rather than in the srcdir, you have to use the shiny new doc/Makefile.am: 'info-in-builddir' automake option. Solution 6: Remove the hack at the bottom of doc/Makefile.am and use the info-in-builddir automake option. Problem 7: doc/Makefile.am:35: error: required file '../texinfo.tex' not found doc/Makefile.am:35: 'automake --add-missing' can install 'texinfo.tex' Solution 7: Use the no-texinfo.tex automake option. We also have one in texinfo/texinfo.tex, not sure if we should point to that, or move it (or a newer version of it added with automake --add-missing) to top-level. Problem 8: Makefile.am:131: warning: source file 'config/tc-aarch64.c' is in a subdirectory, Makefile.am:131: 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. Solution 8: Use subdir-objects, that means adjusting references to some .o that will now be in config/. Problem 9: configure.ac:375: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2601: _AC_COMPILE_IFELSE is expanded from... ../../lib/autoconf/general.m4:2617: AC_COMPILE_IFELSE is expanded from... ../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from... ../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from... ../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from... configure.ac:375: the top level Solution 9: Use AC_LANG_SOURCE, or use proper quoting. Problem 10 (in intl/): configure.ac:7: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS /usr/share/aclocal/threadlib.m4:36: gl_THREADLIB_EARLY_BODY is expanded from... /usr/share/aclocal/threadlib.m4:29: gl_THREADLIB_EARLY is expanded from... /usr/share/aclocal/threadlib.m4:318: gl_THREADLIB is expanded from... /usr/share/aclocal/lock.m4:9: gl_LOCK is expanded from... /usr/share/aclocal/intl.m4:211: gt_INTL_SUBDIR_CORE is expanded from... /usr/share/aclocal/intl.m4:25: AM_INTL_SUBDIR is expanded from... /usr/share/aclocal/gettext.m4:57: AM_GNU_GETTEXT is expanded from... configure.ac:7: the top level Solution 10: Add AC_USE_SYSTEM_EXTENSIONS in configure.ac. ChangeLog: * libtool.m4: Use AC_LANG_SOURCE. * configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE. * README-maintainer-mode: Update version requirements. * ar-lib: New file. * test-driver: New file. * configure: Re-generate. bfd/ChangeLog: * Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11. (INCLUDES): Rename to ... (AM_CPPFLAGS): ... this. * configure.ac: Remove AC_PREREQ. * doc/Makefile.am (AUTOMAKE_OPTIONS): Remove 1.9, cygnus, add info-in-builddir no-texinfo.tex. (info_TEXINFOS): Rename bfd.texinfo to bfd.texi. * doc/bfd.texinfo: Rename to ... * doc/bfd.texi: ... this. * Makefile.in: Re-generate. * aclocal.m4: Re-generate. * config.in: Re-generate. * configure: Re-generate. * doc/Makefile.in: Re-generate. binutils/ChangeLog: * configure.ac: Remove AC_PREREQ. * doc/Makefile.am (AUTOMAKE_OPTIONS): Remove cygnus, add info-in-builddir no-texinfo.tex. * Makefile.in: Re-generate. * aclocal.m4: Re-generate. * config.in: Re-generate. * configure: Re-generate. * doc/Makefile.in: Re-generate. config/ChangeLog: * override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69. etc/ChangeLog: * configure.in: Remove AC_PREREQ. * configure: Re-generate. gas/ChangeLog: * Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11, add subdir-objects. (TARG_CPU_O, OBJ_FORMAT_O, ATOF_TARG_O): Add config/ prefix. * configure.ac (TARG_CPU_O, OBJ_FORMAT_O, ATOF_TARG_O, emfiles, extra_objects): Add config/ prefix. * doc/as.texinfo: Rename to... * doc/as.texi: ... this. * doc/Makefile.am: Rename as.texinfo to as.texi throughout. Remove DISTCLEANFILES hack. (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add no-texinfo.tex and info-in-builddir. * Makefile.in: Re-generate. * aclocal.m4: Re-generate. * config.in: Re-generate. * configure: Re-generate. * doc/Makefile.in: Re-generate. gdb/ChangeLog: * common/common-defs.h (PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_STRING, PACKAGE_TARNAME): Undefine. * configure.ac: Remove AC_PREREQ, add missing quoting. * gnulib/configure.ac: Modernize usage of AC_INIT/AM_INIT_AUTOMAKE. Remove AC_PREREQ. * gnulib/update-gnulib.sh (AUTOCONF_VERSION): Bump to 2.69. (AUTOMAKE_VERSION): Bump to 1.15.1. * configure: Re-generate. * config.in: Re-generate. * aclocal.m4: Re-generate. * gnulib/aclocal.m4: Re-generate. * gnulib/config.in: Re-generate. * gnulib/configure: Re-generate. * gnulib/import/Makefile.in: Re-generate. gdb/gdbserver/ChangeLog: * configure.ac: Remove AC_PREREQ, add missing quoting. * configure: Re-generate. * config.in: Re-generate. * aclocal.m4: Re-generate. gdb/testsuite/ChangeLog: * configure.ac: Remove AC_PREREQ. * configure: Re-generate. gold/ChangeLog: * configure.ac: Remove AC_PREREQ, add missing quoting and usage of AC_LANG_SOURCE. * Makefile.in: Re-generate. * aclocal.m4: Re-generate. * configure: Re-generate. * testsuite/Makefile.in: Re-generate. gprof/ChangeLog: * configure.ac: Remove AC_PREREQ. * Makefile.am: Remove DISTCLEANFILES hack. (AUTOMAKE_OPTIONS): Remove 1.11, add info-in-builddir. * Makefile.in: Re-generate. * aclocal.m4: Re-generate. * configure: Re-generate. * gconfig.in: Re-generate. intl/ChangeLog: * configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ. * configure: Re-generate. * config.h.in: Re-generate. * aclocal.m4: Re-generate. ld/ChangeLog: * configure.ac: Remove AC_PREREQ. * Makefile.am: Remove DISTCLEANFILES hack, rename ld.texinfo to ld.texi, ldint.texinfo to ldint.texi throughout. (AUTOMAKE_OPTIONS): Add info-in-builddir. * README: Rename ld.texinfo to ld.texi, ldint.texinfo to ldint.texi throughout. * gen-doc.texi: Likewise. * h8-doc.texi: Likewise. * ld.texinfo: Rename to ... * ld.texi: ... this. * ldint.texinfo: Rename to ... * ldint.texi: ... this. * Makefile.in: Re-generate. * aclocal.m4: Re-generate. * config.in: Re-generate. * configure: Re-generate. libdecnumber/ChangeLog: * configure.ac: Remove AC_PREREQ. * configure: Re-generate. * aclocal.m4. libiberty/ChangeLog: * configure.ac: Remove AC_PREREQ. * configure: Re-generate. * config.in: Re-generate. opcodes/ChangeLog: * Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11. * configure.ac: Remove AC_PREREQ. * Makefile.in: Re-generate. * aclocal.m4: Re-generate. * configure: Re-generate. readline/ChangeLog.gdb: * configure: Re-generate. * examples/rlfe/configure: Re-generate. sim/ChangeLog: * All configure.ac: Remove AC_PREREQ. * All configure: Re-generate. zlib/ChangeLog.bin-gdb: * 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.
2018-06-18libiberty: Sync with GCCSimon Marchi2-11/+41
Also sync include/simple-object.h, which goes together with the change in libiberty.
2018-05-31include: 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de>edlinger2-0/+24
include: * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260850 138bc75d-0d04-0410-961f-82ee72b054a4
2018-05-31Improve boostrap-ubsan config (PR bootstrap/64914).marxin2-1/+6
2018-05-10 Martin Liska <mliska@suse.cz> PR bootstrap/64914 * md5.c: Use strict alignment with UBSAN_BOOTSTRAP. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260112 138bc75d-0d04-0410-961f-82ee72b054a4
2018-05-31* argv.c (expandargv): Fix memory leak for expanded arguments.law2-0/+6
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259775 138bc75d-0d04-0410-961f-82ee72b054a4
2018-04-17Resync libiberty sources with master version in GCC repository.Nick Clifton7-173/+314
2018-04-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> PR lto/81968 * simple-object.c (handle_lto_debug_sections): Keep .comment section. 2018-03-02 David Malcolm <dmalcolm@redhat.com> * cp-demangle.c: Update URL for g++ V3 ABI. 2018-01-20 Eli Zaretskii <eliz@gnu.org> * simple-object-xcoff.c (simple_object_xcoff_find_sections): Use ulong_type to avoid warning about 32-bit shift. 2018-01-11 Richard Biener <rguenther@suse.de> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> PR lto/81968 * 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. 2018-01-10 Daniel van Gerpen <daniel@vangerpen.de> * argv.c (expandargv): Correct check for dynamically allocated argv.
2018-01-27Avoid compilation warning in libiberty/simple-object-xcoff.cEli Zaretskii2-5/+17
gdb/ChangeLog: 2018-01-27 Eli Zaretskii <eliz@gnu.org> * simple-object-xcoff.c (simple_object_xcoff_find_sections): Avoid compilation warning in 32-bit builds not supported by AC_SYS_LARGEFILE.
2018-01-10Update the libiberty sources with the latest patches found in the master ↵Nick Clifton94-197/+326
sources. 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. 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. 2017-10-24 Alan Modra <amodra@gmail.com> PR lto/82687 PR lto/82575 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Only make __gnu_lto symbols hidden. 2017-10-20 Alan Modra <amodra@gmail.com> PR lto/82575 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Make discarded non-local symbols weak and hidden. 2017-10-18 Jakub Jelinek <jakub@redhat.com> 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. 2017-09-25 Nathan Sidwell <nathan@acm.org> 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. 2017-09-21 Nathan Sidwell <nathan@acm.org> 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
2017-09-15Sync libiberty/ & include/ with GCCPedro Alves5-106/+179
Note this brings in the interface files for libcc1/G++ as well, which we will be needing in GDB soon anyway. That commit renamed a method in the C interface and that required a small update to GDB's compile/ code, which I've included that in this patch to keep the tree building. include/ChangeLog: 2017-09-15 Pedro Alves <palves@redhat.com> * ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro. 2017-09-12 Jiong Wang <jiong.wang@arm.com> * dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP. * dwarf2.h (DW_CFA_DUP): New define. 2017-08-21 Richard Biener <rguenther@suse.de> * simple-object.h (simple_object_copy_lto_debug_sections): New function. 2017-05-18 Martin Liska <mliska@suse.cz> * ansidecl.h: Define CONSTEXPR macro. 2017-05-24 Nathan Sidwell <nathan@acm.org> * libiberty.h (ASTRDUP): Adjust cast to avoid warning. 2017-01-30 Alexandre Oliva <aoliva@redhat.com> Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. 2016-04-29 Oleg Endo <olegendo@gcc.gnu.org> * longlong.h (umul_ppmm): Remove SHMEDIA checks. (__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations. 2017-09-15 Yao Qi <yao.qi@linaro.org> Pedro Alves <palves@redhat.com> * ansidecl.h (DISABLE_COPY_AND_ASSIGN): New macro. 2017-09-12 Jiong Wang <jiong.wang@arm.com> * dwarf2.def (DW_CFA_AARCH64_negate_ra_state): New DW_CFA_DUP. * dwarf2.h (DW_CFA_DUP): New define. 2017-08-21 Richard Biener <rguenther@suse.de> * simple-object.h (simple_object_copy_lto_debug_sections): New function. 2017-05-18 Martin Liska <mliska@suse.cz> * ansidecl.h: Define CONSTEXPR macro. 2017-05-24 Nathan Sidwell <nathan@acm.org> * libiberty.h (ASTRDUP): Adjust cast to avoid warning. 2017-01-30 Alexandre Oliva <aoliva@redhat.com> Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. 2016-04-29 Oleg Endo <olegendo@gcc.gnu.org> * longlong.h (umul_ppmm): Remove SHMEDIA checks. (__umulsidi3, count_leading_zeros): Remove SHMEDIA implementations. libiberty/ChangeLog: 2017-09-15 Nathan Sidwell <nathan@acm.org> 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. 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. 2017-09-15 Nathan Sidwell <nathan@acm.org> * 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. (d_local_name): * testsuite/demangle-expected: Realign blank lines with tests. 2017-09-12 Jiong Wang <jiong.wang@arm.com> * dwarfnames.c (DW_CFA_DUP): New define. gdb/ChangeLog: 2017-09-15 Pedro Alves <palves@redhat.com> * compile/compile-c-types.c (convert_enum, convert_int) (convert_float): Adjust to refer to int_type_v0 and float_type_v0.
2017-09-01Import latest fixes to libiberty from GCCH.J. Lu2-6/+5
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.
2017-09-01Import latest fixes to libiberty from GCC.Nick Clifton7-36/+802
PR lto/81968 * simple-object-elf.c (simple_object_elf_copy_lto_debug_section): Keep names of removed global symbols. * 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. 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. 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. * 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. * simple-object-xcoff.c (simple_object_xcoff_find_sections): Search symbol table for .go_export symbol and apply pfn if found.
2017-07-02Import include/+libiberty/ r249883 from upstream GCC.Jan Kratochvil2-0/+15
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.
2017-06-25Sync libiberty with upstream GCC.Iain Buclaw3-255/+586
libiberty/ChangeLog: * d-demangle.c (dlang_identifier): Prefix mangled init symbols with `initializer for'. * testsuite/demangle-expected: Update tests. * d-demangle.c (dlang_call_convention_p): Move declaration before dlang_type. (dlang_type): Handle function types. * testsuite/d-demangle-expected: Add tests. * d-demangle.c (dlang_parse_real): Remove stack buffer, write the demangled hexadecimal directly to string. * testsuite/d-demangle-expected: Add tests. * d-demangle.c (dlang_hexdigit): New function. (ascii2hex): Remove function. (dlang_parse_string): Update to call dlang_hexdigit. * testsuite/d-demangle-expected: Add tests. * 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. * 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. * d-demangle.c (dlang_value): Add comment explaining why cases for digits are required. * testsuite/d-demangle-expected: Update integer value tests. * d-demangle.c (dlang_parse_symbol): Skip over anonymous symbols. * testsuite/d-demangle-expected: Add tests. * 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. * d-demangle.c (dlang_attributes): Handle scope attributes. * testsuite/d-demangle-expected: Add tests.
2017-06-25Sync libiberty with upstream GCC.Iain Buclaw5-25/+69
libiberty/ChangeLog: 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. * 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. * cp-demangle.c (d_substitution): Return NULL if d_add_substitution fails. * 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.
2017-05-31Avoid compilation warning on MinGW in xstrndupEli Zaretskii4-1/+33
libiberty/ChangeLog: 2017-05-31 DJ Delorie <dj@redhat.com> * configure.ac (strnlen): Add to AC_CHECK_DECLS. * configure: Likewise. * config.in: Add HACE_DECL_STRNLEN.
2017-05-31Make libiberty/waitpid.c compile without warnings on MinGWEli Zaretskii2-0/+10
libiberty/ChangeLog: 2017-05-31 Eli Zaretskii <eliz@gnu.org> * waitpid.c (wait) [__MINGW32__]: Define as a macro that calls _cwait, so that this function works on MinGW.
2017-03-27cplus_demangle_fill_component: Handle DEMANGLE_COMPONENT_RVALUE_REFERENCEPedro Alves2-0/+6
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.
2017-03-13Merge libiberty: Initialize d_printing in all cplus_demangle_fill_* functions.mark2-0/+12
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. gdb/ChangeLog: * cp-name-parser.y (make_empty): Initialize d_printing to zero.
2017-03-13Sync libiberty sources with GCC.Nick Clifton4-25/+83
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.
2017-03-01Sync libiberty sources with GCC mainline.Nick Clifton3-24/+87
Brings in: 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de> PR PR c++/70182 * cp-demangle.c (d_unqualified_name): Handle "on" for operator names. * testsuite/demangle-expected: Add tests. 2017-01-18 Markus Trippelsdorf <markus@trippelsdorf.de> PR c++/77489 * cp-demangle.c (d_discriminator): Handle discriminator >= 10. * testsuite/demangle-expected: Add tests for discriminator. 2016-12-13 Jakub Jelinek <jakub@redhat.com> PR c++/78761 * cp-demangle.c (cplus_demangle_type): Demangle Dc as decltype(auto). * testsuite/demangle-expected: Add test for decltype(auto).
2017-01-05Sync libiberty from gccAlan Modra95-134/+113
Picks up copyright year update and other recent fixes.
2016-12-12Port c++/78252 from GCCNathan Sidwell3-22/+82
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.
2016-12-08sync binutils config/ with gccAlan Modra2-1/+6
config/ * acx.m4: Import from gcc. * bootstrap-asan.mk: Likewise. * multi.m4: Likewise. / * configure: Regnerate. gas/ * configure: Regnerate. ld/ * configure: Regnerate. libiberty/ * configure: Regnerate. zlib/ * configure: Regnerate.
2016-12-06argv.c (expandargv): Check for directories passed as @-files.DJ Delorie2-0/+23
gcc pr 78584
2016-11-18libiberty: Add Rust symbol demangling.David Tolnay6-4/+585
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.
2016-11-18libiberty: demangler crash with missing :? or fold expression component.Mark Wielaard3-0/+19
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.
2016-11-18libiberty: Fix some demangler crashes caused by reading past end of input.Mark Wielaard3-4/+41
In various situations the cplus_demangle () function could read past the end of input causing crashes. Add checks in various places to not advance the demangle string location and fail early when end of string is reached. Add various examples of input strings to the testsuite that would crash test-demangle before the fixes. Found by using the American Fuzzy Lop (afl) fuzzer. libiberty/ChangeLog: * cplus-dem.c (demangle_signature): After 'H', template function, no success and don't advance position if end of string reached. (demangle_template): After 'z', template name, return zero on premature end of string. (gnu_special): Guard strchr against searching for zero characters. (do_type): If member, only advance mangled string when 'F' found. * testsuite/demangle-expected: Add examples of strings that could crash the demangler by reading past end of input.
2016-11-18libiberty: Add -Wshadow=local to warning flags (if supported).Mark Wielaard3-2/+9
libiberty/ChangeLog: * configure.ac (ac_libiberty_warn_cflags): Add -Wshadow=local. * configure: Regenerated.
2016-11-18Implement P0012R1, Make exception specifications part of the type system.Jason Merrill3-68/+133
libiberty/ * cp-demangle.c (is_fnqual_component_type): New. (d_encoding, d_print_comp_inner, d_print_mod_list): Use it. (FNQUAL_COMPONENT_CASE): New. (d_make_comp, has_return_type, d_print_comp_inner) (d_print_function_type): Use it. (next_is_type_qual): New. (d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec. include/ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC.
2016-11-18libiberty: Fix -Wimplicit-fallthrough warnings.Mark Wielaard4-15/+29
Adjust some comments, add some explicit fall through comments or explicit returns where necessary to not get implicit-fallthrough warnings. All fall throughs were deliberate. In one case I added an explicit return false for clarity instead of falling through a default case (that also would return false). libiberty/ChangeLog: * cplus-dem.c (demangle_signature): Move fall through comment. (demangle_fund_type): Add fall through comment between 'G' and 'I'. * hashtab.c (iterative_hash): Add fall through comments. * regex.c (regex_compile): Add Fall through comment after '+'/'?'. (byte_re_match_2_internal): Add Fall through comment after jump_n. Change "Note fall through" to "Fall through". (common_op_match_null_string_p): Return false after set_number_at instead of fall through.
2016-11-18Implement P0136R1, Rewording inheriting constructors.Jason Merrill3-0/+20
libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor.
2016-11-18libiberty: Fix memory leak in ada_demangle when symbol cannot be demangled.Mark Wielaard2-1/+7
When a symbol cannot be demangled in ada_demangle a new demangled VEC will be allocated without deleting the demangled VEC already in use. Running testsuite/test-demangle under valgrind will show the leak for this entry in testsuite/demangle-expected: # Elaborated flag (not demangled) --format=gnat x_E <x_E> 11 bytes in 1 blocks are definitely lost in loss record 1 of 1 at 0x4C27BE3: malloc (vg_replace_malloc.c:299) by 0x413FE7: xmalloc (xmalloc.c:148) by 0x4025EC: ada_demangle (cplus-dem.c:930) by 0x402C59: cplus_demangle (cplus-dem.c:892) by 0x400FEC: main (test-demangle.c:317) libiberty/ChangeLog: * cplus-dem.c (ada_demangle): Initialize demangled to NULL and XDELETEVEC demangled when unknown.
2016-11-18PR c++/71696 testcase.Marcel Böhme1-0/+5
Add libiberty/testsuite/demangle-expected testcase for: PR c++/71696 * cplus-dem.c: Prevent infinite recursion when there is a cycle in the referencing of remembered mangled types. (work_stuff): New stack to keep track of the remembered mangled types that are currently being processed. (push_processed_type): New method to push currently processed remembered type onto the stack. (pop_processed_type): New method to pop currently processed remembered type from the stack. (work_stuff_copy_to_from): Copy values of new variables. (delete_non_B_K_work_stuff): Free stack memory. (demangle_args): Push/Pop currently processed remembered type. (do_type): Do not demangle a cyclic reference and push/pop referenced remembered type.
2016-10-17Sync libiberty sources with gcc mainline.Nick Clifton5-31/+152
2016-09-19 Andrew Stubbs <ams@codesourcery.com> * pex-win32.c (argv_to_cmdline): Quote zero-length parameters. * testsuite/test-pexecute.c (main): Insert check for zero-length parameters. 2016-09-10 Mark Wielaard <mjw@redhat.com> * cp-demangle.c (d_substitution): Change struct demangle_component variable name from c to dc. 2016-08-12 Marek Polacek <polacek@redhat.com> PR c/7652 * cp-demangle.c (d_print_mod): Add FALLTHRU. 2016-08-04 Marcel B?hme <boehme.marcel@gmail.com> PR c++/71696 * cplus-dem.c: Prevent infinite recursion when there is a cycle in the referencing of remembered mangled types. (work_stuff): New stack to keep track of the remembered mangled types that are currently being processed. (push_processed_type): New method to push currently processed remembered type onto the stack. (pop_processed_type): New method to pop currently processed remembered type from the stack. (work_stuff_copy_to_from): Copy values of new variables. (delete_non_B_K_work_stuff): Free stack memory. (demangle_args): Push/Pop currently processed remembered type. (do_type): Do not demangle a cyclic reference and push/pop referenced remembered type.
2016-08-02Synchronize libiberty sources with FSF GCC mainline version.Nick Clifton6-42/+488
include * libiberty.h (MAX_ALLOCA_SIZE): New macro. libiberty * make-relative-prefix.c (make_relative_prefix_1): Fall back to malloc if alloca argument is greater than MAX_ALLOCA_SIZE. * cp-demangle.c (cplus_demangle_operators): Add f[lrLR]. (d_expression_1): Handle them. (d_maybe_print_fold_expression): New. (d_print_comp_inner): Use it. (d_index_template_argument): Handle negative index. * cp-demangle.c (cplus_demangle_operators): Add sP and sZ. (d_print_comp_inner): Handle them. (d_template_args_1): Split out from d_template_args. (d_args_length): New. PR c++/70926 * cplus-dem.c: Handle large values and overflow when demangling length variables. (demangle_template_value_parm): Read only until end of mangled string. (do_hpacc_template_literal): Likewise. (do_type): Handle overflow when demangling array indices. * cp-demangle.c (cplus_demangle_print_callback): Avoid zero-length VLAs. PR c++/70498 * cp-demangle.c (d_expression_1): Formatting fix. * cplus-dem.c (enum type_kind_t): Add tk_rvalue_reference constant. (demangle_template_value_parm): Handle tk_rvalue_reference type kind. (do_type): Support 'O' type id (rvalue references). * testsuite/demangle-expected: Add tests. PR c++/70498 * cp-demangle.c: Parse numbers as integer instead of long to avoid overflow after sanity checks. Include <limits.h> if available. (INT_MAX): Define if necessary. (d_make_template_param): Takes integer argument instead of long. (d_make_function_param): Likewise. (d_append_num): Likewise. (d_identifier): Likewise. (d_number): Parse as and return integer. (d_compact_number): Handle overflow. (d_source_name): Change variable type to integer for parsed number. (d_java_resource): Likewise. (d_special_name): Likewise. (d_discriminator): Likewise. (d_unnamed_type): Likewise. * testsuite/demangle-expected: Add regression test cases. * configure: Remove SH5 support. PR c++/69687 * cplus-dem.c: Include <limits.h> if available. (INT_MAX): Define if necessary. (remember_type, remember_Ktype, register_Btype, string_need): Abort if we detect cases where we the size of the allocation would overflow. PR c++/70492 * cplus-dem.c (gnu_special): Handle case where consume_count returns -1. PR c++/67394 PR c++/70481 * cplus-dem.c (squangle_mop_up): Zero bsize/ksize after freeing btypevec/ktypevec. * testsuite/demangle-expected: Add coverage tests.
2016-05-31Don't needlessly clear xmemdup allocated memory.Alan Modra2-2/+8
* xmemdup.c (xmemdup): Use xmalloc rather than xcalloc.
2016-01-28Sync libiberty with GCC.Iain Buclaw3-30/+71
libiberty/ChangeLog: * d-demangle.c (dlang_call_convention): Handle extern Objective-C function calling convention. (dlang_call_convention_p): Likewise. (dlang_type): Likewise. * testsuite/d-demangle-expected: Add coverage tests. * d-demangle.c (dlang_function_args): Append ',' for variadic functions only if parameters were seen before the elipsis symbol. * testsuite/d-demangle-expected: Add coverage test for parameter-less variadic functions. * d-demangle.c (dlang_type): Handle function types only in the context of seeing a pointer type symbol. * testsuite/d-demangle-expected: Update function pointer tests.