From 533da48302a26885a972e4379eccc26b364e5b53 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 17 Jan 2020 14:13:22 +0000 Subject: Update libiberty sources with changes in the gcc mainline. +2020-01-01 Jakub Jelinek + + Update copyright years. + +2019-12-06 Tim Ruehsen + + * make-relative-prefix.c (split_directories): + Return early on empty 'name' + +2019-11-16 Tim Ruehsen + + * cp-demangle.c (d_print_init): Remove const from 4th param. + (cplus_demangle_fill_name): Initialize d->d_counting. + (cplus_demangle_fill_extended_operator): Likewise. + (cplus_demangle_fill_ctor): Likewise. + (cplus_demangle_fill_dtor): Likewise. + (d_make_empty): Likewise. + (d_count_templates_scopes): Remobe const from 3rd param, + Return on dc->d_counting > 1, + Increment dc->d_counting. + * cp-demint.c (cplus_demangle_fill_component): Initialize d->d_counting. + (cplus_demangle_fill_builtin_type): Likewise. + (cplus_demangle_fill_operator): Likewise. + +2019-11-16 Eduard-Mihai Burtescu + + * cplus-dem.c (cplus_demangle): Use rust_demangle directly. + (rust_demangle): Remove. + * rust-demangle.c (is_prefixed_hash): Rename to is_legacy_prefixed_hash. + (parse_lower_hex_nibble): Rename to decode_lower_hex_nibble. + (parse_legacy_escape): Rename to decode_legacy_escape. + (rust_is_mangled): Remove. + (struct rust_demangler): Add. + (peek): Add. + (next): Add. + (struct rust_mangled_ident): Add. + (parse_ident): Add. + (rust_demangle_sym): Remove. + (print_str): Add. + (PRINT): Add. + (print_ident): Add. + (rust_demangle_callback): Add. + (struct str_buf): Add. + (str_buf_reserve): Add. + (str_buf_append): Add. + (str_buf_demangle_callback): Add. + (rust_demangle): Add. + * rust-demangle.h: Remove. + +2019-11-15 Miguel Saldivar + + * testsuite/demangle-expected: Fix test. + +2019-11-04 Kamlesh Kumar + + * cp-demangle.c (d_expr_primary): Handle + nullptr demangling. + * testsuite/demangle-expected: Added test. + +2019-10-29 Paul Pluzhnikov + + * cp-demangle.c (d_number): Avoid signed int overflow. + +2019-10-28 Miguel Saldivar + + * cp-demangle.c (d_print_mod): Add a space before printing `complex` + and `imaginary`, as opposed to after. + * testsuite/demangle-expected: Adjust test. + +2019-10-03 Eduard-Mihai Burtescu + + * 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. + +2019-09-03 Eduard-Mihai Burtescu + + * 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. + +2019-08-27 Martin Liska + + 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. + +2019-08-12 Martin Liska + + * Makefile.in: Add filedescriptor.c. + * filedescriptor.c: New file. + * lrealpath.c (is_valid_fd): Remove. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 0be45b4ae8..fe738d0db4 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -1,7 +1,7 @@ # Makefile for the libiberty library. # Originally written by K. Richard Pixley . # -# Copyright (C) 1990-2019 Free Software Foundation, Inc. +# Copyright (C) 1990-2020 Free Software Foundation, Inc. # # This file is part of the libiberty library. # Libiberty is free software; you can redistribute it and/or @@ -127,7 +127,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \ calloc.c choose-temp.c clock.c concat.c cp-demangle.c \ cp-demint.c cplus-dem.c crc32.c \ d-demangle.c dwarfnames.c dyn-string.c \ - fdmatch.c ffs.c fibheap.c filename_cmp.c floatformat.c \ + fdmatch.c ffs.c fibheap.c filedescriptor.c filename_cmp.c floatformat.c \ fnmatch.c fopen_unlocked.c \ getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \ gettimeofday.c \ @@ -171,6 +171,7 @@ REQUIRED_OFILES = \ ./cp-demint.$(objext) ./crc32.$(objext) ./d-demangle.$(objext) \ ./dwarfnames.$(objext) ./dyn-string.$(objext) \ ./fdmatch.$(objext) ./fibheap.$(objext) \ + ./filedescriptor.$(objext) \ ./filename_cmp.$(objext) ./floatformat.$(objext) \ ./fnmatch.$(objext) ./fopen_unlocked.$(objext) \ ./getopt.$(objext) ./getopt1.$(objext) ./getpwd.$(objext) \ @@ -756,6 +757,17 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir else true; fi $(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION) +./filedescriptor.$(objext): $(srcdir)/filedescriptor.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/filedescriptor.c -o pic/$@; \ + else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/filedescriptor.c -o noasan/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/filedescriptor.c $(OUTPUT_OPTION) + + ./filename_cmp.$(objext): $(srcdir)/filename_cmp.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/safe-ctype.h diff --git a/libiberty/_doprnt.c b/libiberty/_doprnt.c index d44dc415ed..a739f4304f 100644 --- a/libiberty/_doprnt.c +++ b/libiberty/_doprnt.c @@ -1,5 +1,5 @@ /* Provide a version of _doprnt in terms of fprintf. - Copyright (C) 1998-2019 Free Software Foundation, Inc. + Copyright (C) 1998-2020 Free Software Foundation, Inc. Contributed by Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98 This program is free software; you can redistribute it and/or modify it diff --git a/libiberty/argv.c b/libiberty/argv.c index 6444896f99..8c9794db6a 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -1,5 +1,5 @@ /* Create and destroy argument vectors (argv's) - Copyright (C) 1992-2019 Free Software Foundation, Inc. + Copyright (C) 1992-2020 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support This file is part of the libiberty library. diff --git a/libiberty/asprintf.c b/libiberty/asprintf.c index 5718682f69..6e38e2234d 100644 --- a/libiberty/asprintf.c +++ b/libiberty/asprintf.c @@ -1,6 +1,6 @@ /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2020 Free Software Foundation, Inc. Contributed by Cygnus Solutions. This file is part of the libiberty library. diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c index 72c1b710bd..49a2faaa51 100644 --- a/libiberty/choose-temp.c +++ b/libiberty/choose-temp.c @@ -1,5 +1,5 @@ /* Utility to pick a temporary filename prefix. - Copyright (C) 1996-2019 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/clock.c b/libiberty/clock.c index a3730714bd..0de74657d0 100644 --- a/libiberty/clock.c +++ b/libiberty/clock.c @@ -1,5 +1,5 @@ /* ANSI-compatible clock function. - Copyright (C) 1994-2019 Free Software Foundation, Inc. + Copyright (C) 1994-2020 Free Software Foundation, Inc. This file is part of the libiberty library. This library is free software; you can redistribute it and/or modify it under the diff --git --- libiberty/ChangeLog | 100 +++++ libiberty/Makefile.in | 16 +- libiberty/_doprnt.c | 2 +- libiberty/argv.c | 2 +- libiberty/asprintf.c | 2 +- libiberty/choose-temp.c | 2 +- libiberty/clock.c | 2 +- libiberty/concat.c | 2 +- libiberty/copying-lib.texi | 2 +- libiberty/cp-demangle.c | 34 +- libiberty/cp-demangle.h | 2 +- libiberty/cp-demint.c | 5 +- libiberty/cplus-dem.c | 53 +-- libiberty/crc32.c | 2 +- libiberty/d-demangle.c | 2 +- libiberty/dwarfnames.c | 2 +- libiberty/dyn-string.c | 2 +- libiberty/fdmatch.c | 2 +- libiberty/fibheap.c | 2 +- libiberty/filedescriptor.c | 47 ++ libiberty/filename_cmp.c | 2 +- libiberty/floatformat.c | 2 +- libiberty/fnmatch.c | 2 +- libiberty/fopen_unlocked.c | 2 +- libiberty/gather-docs | 2 +- libiberty/getopt.c | 2 +- libiberty/getopt1.c | 2 +- libiberty/getruntime.c | 2 +- libiberty/hashtab.c | 2 +- libiberty/hex.c | 2 +- libiberty/lbasename.c | 2 +- libiberty/libiberty.texi | 4 +- libiberty/lrealpath.c | 18 +- libiberty/maint-tool | 2 +- libiberty/make-relative-prefix.c | 5 +- libiberty/make-temp-file.c | 2 +- libiberty/md5.c | 2 +- libiberty/memmem.c | 2 +- libiberty/mempcpy.c | 2 +- libiberty/mkstemps.c | 2 +- libiberty/objalloc.c | 2 +- libiberty/obstack.c | 2 +- libiberty/partition.c | 2 +- libiberty/pex-common.c | 2 +- libiberty/pex-common.h | 2 +- libiberty/pex-djgpp.c | 2 +- libiberty/pex-msdos.c | 2 +- libiberty/pex-one.c | 2 +- libiberty/pex-unix.c | 2 +- libiberty/pex-win32.c | 2 +- libiberty/pexecute.c | 2 +- libiberty/physmem.c | 2 +- libiberty/putenv.c | 2 +- libiberty/regex.c | 2 +- libiberty/rust-demangle.c | 687 ++++++++++++++++++----------- libiberty/safe-ctype.c | 2 +- libiberty/setenv.c | 2 +- libiberty/setproctitle.c | 2 +- libiberty/sha1.c | 2 +- libiberty/simple-object-coff.c | 2 +- libiberty/simple-object-common.h | 2 +- libiberty/simple-object-elf.c | 73 ++- libiberty/simple-object-mach-o.c | 2 +- libiberty/simple-object-xcoff.c | 2 +- libiberty/simple-object.c | 2 +- libiberty/snprintf.c | 2 +- libiberty/sort.c | 2 +- libiberty/spaces.c | 2 +- libiberty/splay-tree.c | 2 +- libiberty/stack-limit.c | 2 +- libiberty/stpcpy.c | 2 +- libiberty/stpncpy.c | 2 +- libiberty/strndup.c | 2 +- libiberty/strtod.c | 2 +- libiberty/strverscmp.c | 2 +- libiberty/testsuite/Makefile.in | 2 +- libiberty/testsuite/demangle-expected | 6 +- libiberty/testsuite/demangler-fuzzer.c | 2 +- libiberty/testsuite/rust-demangle-expected | 6 +- libiberty/testsuite/test-demangle.c | 2 +- libiberty/testsuite/test-expandargv.c | 2 +- libiberty/testsuite/test-pexecute.c | 2 +- libiberty/testsuite/test-strtol.c | 2 +- libiberty/timeval-utils.c | 2 +- libiberty/unlink-if-ordinary.c | 2 +- libiberty/vasprintf.c | 2 +- libiberty/vfprintf.c | 2 +- libiberty/vprintf-support.c | 2 +- libiberty/vprintf-support.h | 2 +- libiberty/vsnprintf.c | 2 +- libiberty/vsprintf.c | 2 +- libiberty/xasprintf.c | 2 +- libiberty/xexit.c | 2 +- libiberty/xmalloc.c | 2 +- libiberty/xstrndup.c | 2 +- libiberty/xvasprintf.c | 2 +- 96 files changed, 788 insertions(+), 432 deletions(-) create mode 100644 libiberty/filedescriptor.c (limited to 'libiberty') diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 95cb1525f2c..c2bab93a151 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,103 @@ +2020-01-01 Jakub Jelinek + + Update copyright years. + +2019-12-06 Tim Ruehsen + + * make-relative-prefix.c (split_directories): + Return early on empty 'name' + +2019-11-16 Tim Ruehsen + + * cp-demangle.c (d_print_init): Remove const from 4th param. + (cplus_demangle_fill_name): Initialize d->d_counting. + (cplus_demangle_fill_extended_operator): Likewise. + (cplus_demangle_fill_ctor): Likewise. + (cplus_demangle_fill_dtor): Likewise. + (d_make_empty): Likewise. + (d_count_templates_scopes): Remobe const from 3rd param, + Return on dc->d_counting > 1, + Increment dc->d_counting. + * cp-demint.c (cplus_demangle_fill_component): Initialize d->d_counting. + (cplus_demangle_fill_builtin_type): Likewise. + (cplus_demangle_fill_operator): Likewise. + +2019-11-16 Eduard-Mihai Burtescu + + * cplus-dem.c (cplus_demangle): Use rust_demangle directly. + (rust_demangle): Remove. + * rust-demangle.c (is_prefixed_hash): Rename to is_legacy_prefixed_hash. + (parse_lower_hex_nibble): Rename to decode_lower_hex_nibble. + (parse_legacy_escape): Rename to decode_legacy_escape. + (rust_is_mangled): Remove. + (struct rust_demangler): Add. + (peek): Add. + (next): Add. + (struct rust_mangled_ident): Add. + (parse_ident): Add. + (rust_demangle_sym): Remove. + (print_str): Add. + (PRINT): Add. + (print_ident): Add. + (rust_demangle_callback): Add. + (struct str_buf): Add. + (str_buf_reserve): Add. + (str_buf_append): Add. + (str_buf_demangle_callback): Add. + (rust_demangle): Add. + * rust-demangle.h: Remove. + +2019-11-15 Miguel Saldivar + + * testsuite/demangle-expected: Fix test. + +2019-11-04 Kamlesh Kumar + + * cp-demangle.c (d_expr_primary): Handle + nullptr demangling. + * testsuite/demangle-expected: Added test. + +2019-10-29 Paul Pluzhnikov + + * cp-demangle.c (d_number): Avoid signed int overflow. + +2019-10-28 Miguel Saldivar + + * cp-demangle.c (d_print_mod): Add a space before printing `complex` + and `imaginary`, as opposed to after. + * testsuite/demangle-expected: Adjust test. + +2019-10-03 Eduard-Mihai Burtescu + + * 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. + +2019-09-03 Eduard-Mihai Burtescu + + * 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. + +2019-08-27 Martin Liska + + 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. + +2019-08-12 Martin Liska + + * Makefile.in: Add filedescriptor.c. + * filedescriptor.c: New file. + * lrealpath.c (is_valid_fd): Remove. + 2019-08-08 Martin Liska PR bootstrap/91352 diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 0be45b4ae8e..fe738d0db43 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -1,7 +1,7 @@ # Makefile for the libiberty library. # Originally written by K. Richard Pixley . # -# Copyright (C) 1990-2019 Free Software Foundation, Inc. +# Copyright (C) 1990-2020 Free Software Foundation, Inc. # # This file is part of the libiberty library. # Libiberty is free software; you can redistribute it and/or @@ -127,7 +127,7 @@ CFILES = alloca.c argv.c asprintf.c atexit.c \ calloc.c choose-temp.c clock.c concat.c cp-demangle.c \ cp-demint.c cplus-dem.c crc32.c \ d-demangle.c dwarfnames.c dyn-string.c \ - fdmatch.c ffs.c fibheap.c filename_cmp.c floatformat.c \ + fdmatch.c ffs.c fibheap.c filedescriptor.c filename_cmp.c floatformat.c \ fnmatch.c fopen_unlocked.c \ getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \ gettimeofday.c \ @@ -171,6 +171,7 @@ REQUIRED_OFILES = \ ./cp-demint.$(objext) ./crc32.$(objext) ./d-demangle.$(objext) \ ./dwarfnames.$(objext) ./dyn-string.$(objext) \ ./fdmatch.$(objext) ./fibheap.$(objext) \ + ./filedescriptor.$(objext) \ ./filename_cmp.$(objext) ./floatformat.$(objext) \ ./fnmatch.$(objext) ./fopen_unlocked.$(objext) \ ./getopt.$(objext) ./getopt1.$(objext) ./getpwd.$(objext) \ @@ -756,6 +757,17 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir else true; fi $(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION) +./filedescriptor.$(objext): $(srcdir)/filedescriptor.c config.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/libiberty.h + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/filedescriptor.c -o pic/$@; \ + else true; fi + if [ x"$(NOASANFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(NOASANFLAG) $(srcdir)/filedescriptor.c -o noasan/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/filedescriptor.c $(OUTPUT_OPTION) + + ./filename_cmp.$(objext): $(srcdir)/filename_cmp.c config.h $(INCDIR)/ansidecl.h \ $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/safe-ctype.h diff --git a/libiberty/_doprnt.c b/libiberty/_doprnt.c index d44dc415ed2..a739f4304f9 100644 --- a/libiberty/_doprnt.c +++ b/libiberty/_doprnt.c @@ -1,5 +1,5 @@ /* Provide a version of _doprnt in terms of fprintf. - Copyright (C) 1998-2019 Free Software Foundation, Inc. + Copyright (C) 1998-2020 Free Software Foundation, Inc. Contributed by Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98 This program is free software; you can redistribute it and/or modify it diff --git a/libiberty/argv.c b/libiberty/argv.c index 6444896f995..8c9794db6a2 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -1,5 +1,5 @@ /* Create and destroy argument vectors (argv's) - Copyright (C) 1992-2019 Free Software Foundation, Inc. + Copyright (C) 1992-2020 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support This file is part of the libiberty library. diff --git a/libiberty/asprintf.c b/libiberty/asprintf.c index 5718682f691..6e38e2234dc 100644 --- a/libiberty/asprintf.c +++ b/libiberty/asprintf.c @@ -1,6 +1,6 @@ /* Like sprintf but provides a pointer to malloc'd storage, which must be freed by the caller. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2020 Free Software Foundation, Inc. Contributed by Cygnus Solutions. This file is part of the libiberty library. diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c index 72c1b710bd8..49a2faaa51b 100644 --- a/libiberty/choose-temp.c +++ b/libiberty/choose-temp.c @@ -1,5 +1,5 @@ /* Utility to pick a temporary filename prefix. - Copyright (C) 1996-2019 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/clock.c b/libiberty/clock.c index a3730714bdc..0de74657d0d 100644 --- a/libiberty/clock.c +++ b/libiberty/clock.c @@ -1,5 +1,5 @@ /* ANSI-compatible clock function. - Copyright (C) 1994-2019 Free Software Foundation, Inc. + Copyright (C) 1994-2020 Free Software Foundation, Inc. This file is part of the libiberty library. This library is free software; you can redistribute it and/or modify it under the diff --git a/libiberty/concat.c b/libiberty/concat.c index 8eb478b47bc..533e4a99b0d 100644 --- a/libiberty/concat.c +++ b/libiberty/concat.c @@ -1,5 +1,5 @@ /* Concatenate variable number of strings. - Copyright (C) 1991-2019 Free Software Foundation, Inc. + Copyright (C) 1991-2020 Free Software Foundation, Inc. Written by Fred Fish @ Cygnus Support This file is part of the libiberty library. diff --git a/libiberty/copying-lib.texi b/libiberty/copying-lib.texi index ac733f93adf..ce1cb03cc7d 100644 --- a/libiberty/copying-lib.texi +++ b/libiberty/copying-lib.texi @@ -5,7 +5,7 @@ @center Version 2.1, February 1999 @display -Copyright @copyright{} 1991-2019 Free Software Foundation, Inc. +Copyright @copyright{} 1991-2020 Free Software Foundation, Inc. 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index aa78c86dd44..3639bfbfd43 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1,5 +1,5 @@ /* Demangler for g++ V3 ABI. - Copyright (C) 2003-2019 Free Software Foundation, Inc. + Copyright (C) 2003-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of the libiberty library, which is part of GCC. @@ -517,7 +517,7 @@ d_growable_string_callback_adapter (const char *, size_t, void *); static void d_print_init (struct d_print_info *, demangle_callbackref, void *, - const struct demangle_component *); + struct demangle_component *); static inline void d_print_error (struct d_print_info *); @@ -864,6 +864,7 @@ cplus_demangle_fill_name (struct demangle_component *p, const char *s, int len) if (p == NULL || s == NULL || len <= 0) return 0; p->d_printing = 0; + p->d_counting = 0; p->type = DEMANGLE_COMPONENT_NAME; p->u.s_name.s = s; p->u.s_name.len = len; @@ -880,6 +881,7 @@ cplus_demangle_fill_extended_operator (struct demangle_component *p, int args, if (p == NULL || args < 0 || name == NULL) return 0; p->d_printing = 0; + p->d_counting = 0; p->type = DEMANGLE_COMPONENT_EXTENDED_OPERATOR; p->u.s_extended_operator.args = args; p->u.s_extended_operator.name = name; @@ -900,6 +902,7 @@ cplus_demangle_fill_ctor (struct demangle_component *p, || (int) kind > gnu_v3_object_ctor_group) return 0; p->d_printing = 0; + p->d_counting = 0; p->type = DEMANGLE_COMPONENT_CTOR; p->u.s_ctor.kind = kind; p->u.s_ctor.name = name; @@ -920,6 +923,7 @@ cplus_demangle_fill_dtor (struct demangle_component *p, || (int) kind > gnu_v3_object_dtor_group) return 0; p->d_printing = 0; + p->d_counting = 0; p->type = DEMANGLE_COMPONENT_DTOR; p->u.s_dtor.kind = kind; p->u.s_dtor.name = name; @@ -937,6 +941,7 @@ d_make_empty (struct d_info *di) return NULL; p = &di->comps[di->next_comp]; p->d_printing = 0; + p->d_counting = 0; ++di->next_comp; return p; } @@ -1717,7 +1722,7 @@ d_number (struct d_info *di) } if (ret > ((INT_MAX - (peek - '0')) / 10)) return -1; - ret = ret * 10 + peek - '0'; + ret = ret * 10 + (peek - '0'); d_advance (di, 1); peek = d_peek_char (di); } @@ -3577,6 +3582,17 @@ d_expr_primary (struct d_info *di) && type->u.s_builtin.type->print != D_PRINT_DEFAULT) di->expansion -= type->u.s_builtin.type->len; + if (type->type == DEMANGLE_COMPONENT_BUILTIN_TYPE + && strcmp (type->u.s_builtin.type->name, + cplus_demangle_builtin_types[33].name) == 0) + { + if (d_peek_char (di) == 'E') + { + d_advance (di, 1); + return type; + } + } + /* Rather than try to interpret the literal value, we just collect it as a string. Note that it's possible to have a floating point literal here. The ABI specifies that the @@ -4068,11 +4084,13 @@ d_growable_string_callback_adapter (const char *s, size_t l, void *opaque) static void d_count_templates_scopes (struct d_print_info *dpi, - const struct demangle_component *dc) + struct demangle_component *dc) { - if (dc == NULL) + if (dc == NULL || dc->d_counting > 1 || dpi->recursion > MAX_RECURSION_COUNT) return; + ++ dc->d_counting; + switch (dc->type) { case DEMANGLE_COMPONENT_NAME: @@ -4202,7 +4220,7 @@ d_count_templates_scopes (struct d_print_info *dpi, static void d_print_init (struct d_print_info *dpi, demangle_callbackref callback, - void *opaque, const struct demangle_component *dc) + void *opaque, struct demangle_component *dc) { dpi->len = 0; dpi->last_char = '\0'; @@ -5977,10 +5995,10 @@ d_print_mod (struct d_print_info *dpi, int options, d_append_string (dpi, "&&"); return; case DEMANGLE_COMPONENT_COMPLEX: - d_append_string (dpi, "complex "); + d_append_string (dpi, " _Complex"); return; case DEMANGLE_COMPONENT_IMAGINARY: - d_append_string (dpi, "imaginary "); + d_append_string (dpi, " _Imaginary"); return; case DEMANGLE_COMPONENT_PTRMEM_TYPE: if (d_last_char (dpi) != '(') diff --git a/libiberty/cp-demangle.h b/libiberty/cp-demangle.h index 92191cf3ea8..943a3ef478e 100644 --- a/libiberty/cp-demangle.h +++ b/libiberty/cp-demangle.h @@ -1,5 +1,5 @@ /* Internal demangler interface for g++ V3 ABI. - Copyright (C) 2003-2019 Free Software Foundation, Inc. + Copyright (C) 2003-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of the libiberty library, which is part of GCC. diff --git a/libiberty/cp-demint.c b/libiberty/cp-demint.c index 950e4dc5522..6e41bad2672 100644 --- a/libiberty/cp-demint.c +++ b/libiberty/cp-demint.c @@ -1,5 +1,5 @@ /* Demangler component interface functions. - Copyright (C) 2004-2019 Free Software Foundation, Inc. + Copyright (C) 2004-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of the libiberty library, which is part of GCC. @@ -125,6 +125,7 @@ cplus_demangle_fill_component (struct demangle_component *p, p->u.s_binary.left = left; p->u.s_binary.right = right; p->d_printing = 0; + p->d_counting = 0; return 1; } @@ -149,6 +150,7 @@ cplus_demangle_fill_builtin_type (struct demangle_component *p, p->type = DEMANGLE_COMPONENT_BUILTIN_TYPE; p->u.s_builtin.type = &cplus_demangle_builtin_types[i]; p->d_printing = 0; + p->d_counting = 0; return 1; } } @@ -176,6 +178,7 @@ cplus_demangle_fill_operator (struct demangle_component *p, p->type = DEMANGLE_COMPONENT_OPERATOR; p->u.s_operator.op = &cplus_demangle_operators[i]; p->d_printing = 0; + p->d_counting = 0; return 1; } } diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index a39e2bf2ed4..fb0673d1815 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -1,5 +1,5 @@ /* Demangler for GNU C++ - Copyright (C) 1989-2019 Free Software Foundation, Inc. + Copyright (C) 1989-2020 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.uucp) Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling Modified by Satish Pai (pai@apollo.hp.com) for HP demangling @@ -52,7 +52,6 @@ void * realloc (); #define CURRENT_DEMANGLING_STYLE options #include "libiberty.h" -#include "rust-demangle.h" enum demangling_styles current_demangling_style = auto_demangling; @@ -160,27 +159,20 @@ cplus_demangle (const char *mangled, int options) if ((options & DMGL_STYLE_MASK) == 0) options |= (int) current_demangling_style & DMGL_STYLE_MASK; + /* The Rust demangling is implemented elsewhere. + Legacy Rust symbols overlap with GNU_V3, so try Rust first. */ + if (RUST_DEMANGLING || AUTO_DEMANGLING) + { + ret = rust_demangle (mangled, options); + if (ret || RUST_DEMANGLING) + return ret; + } + /* The V3 ABI demangling is implemented elsewhere. */ - if (GNU_V3_DEMANGLING || RUST_DEMANGLING || AUTO_DEMANGLING) + if (GNU_V3_DEMANGLING || AUTO_DEMANGLING) { ret = cplus_demangle_v3 (mangled, options); - if (GNU_V3_DEMANGLING) - return ret; - - if (ret) - { - /* Rust symbols are GNU_V3 mangled plus some extra subtitutions. - The subtitutions are always smaller, so do in place changes. */ - if (rust_is_mangled (ret)) - rust_demangle_sym (ret); - else if (RUST_DEMANGLING) - { - free (ret); - ret = NULL; - } - } - - if (ret || RUST_DEMANGLING) + if (ret || GNU_V3_DEMANGLING) return ret; } @@ -204,27 +196,6 @@ cplus_demangle (const char *mangled, int options) return (ret); } -char * -rust_demangle (const char *mangled, int options) -{ - /* Rust symbols are GNU_V3 mangled plus some extra subtitutions. */ - char *ret = cplus_demangle_v3 (mangled, options); - - /* The Rust subtitutions are always smaller, so do in place changes. */ - if (ret != NULL) - { - if (rust_is_mangled (ret)) - rust_demangle_sym (ret); - else - { - free (ret); - ret = NULL; - } - } - - return ret; -} - /* Demangle ada names. The encoding is documented in gcc/ada/exp_dbug.ads. */ char * diff --git a/libiberty/crc32.c b/libiberty/crc32.c index 96b12b9b56a..8f7832aa2a8 100644 --- a/libiberty/crc32.c +++ b/libiberty/crc32.c @@ -1,5 +1,5 @@ /* crc32.c - Copyright (C) 2009-2019 Free Software Foundation, Inc. + Copyright (C) 2009-2020 Free Software Foundation, Inc. This file is part of the libiberty library. diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c index becc402c1f8..a9702858a6e 100644 --- a/libiberty/d-demangle.c +++ b/libiberty/d-demangle.c @@ -1,5 +1,5 @@ /* Demangler for the D programming language - Copyright (C) 2014-2019 Free Software Foundation, Inc. + Copyright (C) 2014-2020 Free Software Foundation, Inc. Written by Iain Buclaw (ibuclaw@gdcproject.org) This file is part of the libiberty library. diff --git a/libiberty/dwarfnames.c b/libiberty/dwarfnames.c index c97741e4e35..968d1917532 100644 --- a/libiberty/dwarfnames.c +++ b/libiberty/dwarfnames.c @@ -1,5 +1,5 @@ /* Names of various DWARF tags. - Copyright (C) 2012-2019 Free Software Foundation, Inc. + Copyright (C) 2012-2020 Free Software Foundation, Inc. This file is part of GNU CC. diff --git a/libiberty/dyn-string.c b/libiberty/dyn-string.c index 441b36bf240..e10f691181a 100644 --- a/libiberty/dyn-string.c +++ b/libiberty/dyn-string.c @@ -1,5 +1,5 @@ /* An abstract string datatype. - Copyright (C) 1998-2019 Free Software Foundation, Inc. + Copyright (C) 1998-2020 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GNU CC. diff --git a/libiberty/fdmatch.c b/libiberty/fdmatch.c index ff45e419176..31803e47f72 100644 --- a/libiberty/fdmatch.c +++ b/libiberty/fdmatch.c @@ -1,5 +1,5 @@ /* Compare two open file descriptors to see if they refer to the same file. - Copyright (C) 1991-2019 Free Software Foundation, Inc. + Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/fibheap.c b/libiberty/fibheap.c index 1449e7fd3dd..b8972281006 100644 --- a/libiberty/fibheap.c +++ b/libiberty/fibheap.c @@ -1,5 +1,5 @@ /* A Fibonacci heap datatype. - Copyright (C) 1998-2019 Free Software Foundation, Inc. + Copyright (C) 1998-2020 Free Software Foundation, Inc. Contributed by Daniel Berlin (dan@cgsoftware.com). This file is part of GNU CC. diff --git a/libiberty/filedescriptor.c b/libiberty/filedescriptor.c new file mode 100644 index 00000000000..ba2e87c240e --- /dev/null +++ b/libiberty/filedescriptor.c @@ -0,0 +1,47 @@ +/* File descriptor related functions. + + Copyright (C) 2019-2020 Free Software Foundation, Inc. + + This file is part of the libiberty library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ + +#include "config.h" +#include "ansidecl.h" +#include "libiberty.h" + +#ifdef HAVE_FCNTL_H +#include +#endif + +#if defined (_WIN32) +#define WIN32_LEAN_AND_MEAN +#include /* for GetFullPathName */ +#endif +/* Return true when FD file descriptor exists. */ + +int +is_valid_fd (int fd) +{ +#if defined(_WIN32) + HANDLE h = (HANDLE) _get_osfhandle (fd); + return h != (HANDLE) -1; +#elif defined(F_GETFD) + return fcntl (fd, F_GETFD) >= 0; +#else + return dup2 (fd, fd) < 0; +#endif +} diff --git a/libiberty/filename_cmp.c b/libiberty/filename_cmp.c index d111066d393..68fb06f9458 100644 --- a/libiberty/filename_cmp.c +++ b/libiberty/filename_cmp.c @@ -1,6 +1,6 @@ /* File name comparison routine. - Copyright (C) 2007-2019 Free Software Foundation, Inc. + Copyright (C) 2007-2020 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libiberty/floatformat.c b/libiberty/floatformat.c index 8632253b4c1..2fd5e688ec4 100644 --- a/libiberty/floatformat.c +++ b/libiberty/floatformat.c @@ -1,5 +1,5 @@ /* IEEE floating point support routines, for GDB, the GNU Debugger. - Copyright (C) 1991-2019 Free Software Foundation, Inc. + Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of GDB. diff --git a/libiberty/fnmatch.c b/libiberty/fnmatch.c index 50fe2e8da8c..7be51aed03b 100644 --- a/libiberty/fnmatch.c +++ b/libiberty/fnmatch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2019 Free Software Foundation, Inc. +/* Copyright (C) 1991-2020 Free Software Foundation, Inc. NOTE: This source is derived from an old version taken from the GNU C Library (glibc). diff --git a/libiberty/fopen_unlocked.c b/libiberty/fopen_unlocked.c index 05efad43ebc..b8c426b8eae 100644 --- a/libiberty/fopen_unlocked.c +++ b/libiberty/fopen_unlocked.c @@ -1,5 +1,5 @@ /* Implement fopen_unlocked and related functions. - Copyright (C) 2005-2019 Free Software Foundation, Inc. + Copyright (C) 2005-2020 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. diff --git a/libiberty/gather-docs b/libiberty/gather-docs index 94a1212fe73..01f1e0bf325 100644 --- a/libiberty/gather-docs +++ b/libiberty/gather-docs @@ -1,7 +1,7 @@ #!/usr/bin/perl # -*- perl -*- -# Copyright (C) 2001-2019 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is part of the libiberty library. # Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/getopt.c b/libiberty/getopt.c index 1ad4d505a04..7119b621c12 100644 --- a/libiberty/getopt.c +++ b/libiberty/getopt.c @@ -3,7 +3,7 @@ "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987-2019 Free Software Foundation, Inc. + Copyright (C) 1987-2020 Free Software Foundation, Inc. NOTE: This source is derived from an old version taken from the GNU C Library (glibc). diff --git a/libiberty/getopt1.c b/libiberty/getopt1.c index 33e0bda21ba..87242472e86 100644 --- a/libiberty/getopt1.c +++ b/libiberty/getopt1.c @@ -1,5 +1,5 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987-2019 Free Software Foundation, Inc. + Copyright (C) 1987-2020 Free Software Foundation, Inc. NOTE: This source is derived from an old version taken from the GNU C Library (glibc). diff --git a/libiberty/getruntime.c b/libiberty/getruntime.c index 0900a19dfba..f9f7841a743 100644 --- a/libiberty/getruntime.c +++ b/libiberty/getruntime.c @@ -1,5 +1,5 @@ /* Return time used so far, in microseconds. - Copyright (C) 1994-2019 Free Software Foundation, Inc. + Copyright (C) 1994-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index 9f917c3571d..26c98ce2d68 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -1,5 +1,5 @@ /* An expandable hash tables datatype. - Copyright (C) 1999-2019 Free Software Foundation, Inc. + Copyright (C) 1999-2020 Free Software Foundation, Inc. Contributed by Vladimir Makarov (vmakarov@cygnus.com). This file is part of the libiberty library. diff --git a/libiberty/hex.c b/libiberty/hex.c index 67ce13cdb50..f2b57e3b817 100644 --- a/libiberty/hex.c +++ b/libiberty/hex.c @@ -1,5 +1,5 @@ /* Hex character manipulation support. - Copyright (C) 1995-2019 Free Software Foundation, Inc. + Copyright (C) 1995-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/lbasename.c b/libiberty/lbasename.c index 7aefbb49361..6715b20858e 100644 --- a/libiberty/lbasename.c +++ b/libiberty/lbasename.c @@ -1,6 +1,6 @@ /* Libiberty basename. Like basename, but is not overridden by the system C library. - Copyright (C) 2001-2019 Free Software Foundation, Inc. + Copyright (C) 2001-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/libiberty.texi b/libiberty/libiberty.texi index bf870d9c62e..01751be39d9 100644 --- a/libiberty/libiberty.texi +++ b/libiberty/libiberty.texi @@ -24,7 +24,7 @@ @ifinfo This manual describes the GNU @libib library of utility subroutines. -Copyright @copyright{} 2001-2019 Free Software Foundation, Inc. +Copyright @copyright{} 2001-2020 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 @@ -50,7 +50,7 @@ notice identical to this one except for the removal of this paragraph @vskip 0pt plus 1filll -Copyright @copyright{} 2001-2019 Free Software Foundation, Inc. +Copyright @copyright{} 2001-2020 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 diff --git a/libiberty/lrealpath.c b/libiberty/lrealpath.c index ac914a7a4f4..d6694c40349 100644 --- a/libiberty/lrealpath.c +++ b/libiberty/lrealpath.c @@ -1,7 +1,7 @@ /* Libiberty realpath. Like realpath, but more consistent behavior. Based on gdb_realpath from GDB. - Copyright (C) 2003-2019 Free Software Foundation, Inc. + Copyright (C) 2003-2020 Free Software Foundation, Inc. This file is part of the libiberty library. @@ -49,9 +49,6 @@ components will be simplified. The returned value will be allocated using #ifdef HAVE_STRING_H #include #endif -#ifdef HAVE_FCNTL_H -#include -#endif /* On GNU libc systems the declaration is only visible with _GNU_SOURCE. */ #if defined(HAVE_CANONICALIZE_FILE_NAME) \ @@ -158,16 +155,3 @@ lrealpath (const char *filename) /* This system is a lost cause, just duplicate the filename. */ return strdup (filename); } - -/* Return true when FD file descriptor exists. */ - -int -is_valid_fd (int fd) -{ -#if defined(_WIN32) - HANDLE h = (HANDLE) _get_osfhandle (fd); - return h != (HANDLE) -1; -#else - return fcntl (fd, F_GETFD) >= 0; -#endif -} diff --git a/libiberty/maint-tool b/libiberty/maint-tool index f100dd4a0d7..c27c3a4fc86 100644 --- a/libiberty/maint-tool +++ b/libiberty/maint-tool @@ -1,7 +1,7 @@ #!/usr/bin/perl # -*- perl -*- -# Copyright (C) 2001-2019 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is part of the libiberty library. # Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c index ec0b0ee7494..e3f9f920df4 100644 --- a/libiberty/make-relative-prefix.c +++ b/libiberty/make-relative-prefix.c @@ -1,5 +1,5 @@ /* Relative (relocatable) prefix support. - Copyright (C) 1987-2019 Free Software Foundation, Inc. + Copyright (C) 1987-2020 Free Software Foundation, Inc. This file is part of libiberty. @@ -122,6 +122,9 @@ split_directories (const char *name, int *ptr_num_dirs) const char *p, *q; int ch; + if (!*name) + return NULL; + /* Count the number of directories. Special case MSDOS disk names as part of the initial directory. */ p = name; diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c index 2c66e35cc1f..cb08c27af6f 100644 --- a/libiberty/make-temp-file.c +++ b/libiberty/make-temp-file.c @@ -1,5 +1,5 @@ /* Utility to pick a temporary filename prefix. - Copyright (C) 1996-2019 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/md5.c b/libiberty/md5.c index 54875a38268..755b8ff9f8d 100644 --- a/libiberty/md5.c +++ b/libiberty/md5.c @@ -1,6 +1,6 @@ /* md5.c - Functions to compute MD5 message digest of files or memory blocks according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995-2019 Free Software Foundation, Inc. + Copyright (C) 1995-2020 Free Software Foundation, Inc. NOTE: This source is derived from an old version taken from the GNU C Library (glibc). diff --git a/libiberty/memmem.c b/libiberty/memmem.c index e45af443ea8..1e26c8bc2a5 100644 --- a/libiberty/memmem.c +++ b/libiberty/memmem.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2019 Free Software Foundation, Inc. +/* Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify diff --git a/libiberty/mempcpy.c b/libiberty/mempcpy.c index 1cc569c6902..a65a55703f9 100644 --- a/libiberty/mempcpy.c +++ b/libiberty/mempcpy.c @@ -1,5 +1,5 @@ /* Implement the mempcpy function. - Copyright (C) 2003-2019 Free Software Foundation, Inc. + Copyright (C) 2003-2020 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c index b57880ef0ed..18d879ac876 100644 --- a/libiberty/mkstemps.c +++ b/libiberty/mkstemps.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2019 Free Software Foundation, Inc. +/* Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is derived from mkstemp.c from the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libiberty/objalloc.c b/libiberty/objalloc.c index f6c65a2f71f..131598f37f4 100644 --- a/libiberty/objalloc.c +++ b/libiberty/objalloc.c @@ -1,5 +1,5 @@ /* objalloc.c -- routines to allocate memory for objects - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Solutions. This program is free software; you can redistribute it and/or modify it diff --git a/libiberty/obstack.c b/libiberty/obstack.c index 3e1d160700b..0a4e57ee4c4 100644 --- a/libiberty/obstack.c +++ b/libiberty/obstack.c @@ -1,5 +1,5 @@ /* obstack.c - subroutines used implicitly by object stack macros - Copyright (C) 1988-2019 Free Software Foundation, Inc. + Copyright (C) 1988-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libiberty/partition.c b/libiberty/partition.c index 37011b867ea..2e17515f2d6 100644 --- a/libiberty/partition.c +++ b/libiberty/partition.c @@ -1,5 +1,5 @@ /* List implementation of a partition of consecutive integers. - Copyright (C) 2000-2019 Free Software Foundation, Inc. + Copyright (C) 2000-2020 Free Software Foundation, Inc. Contributed by CodeSourcery, LLC. This file is part of GNU CC. diff --git a/libiberty/pex-common.c b/libiberty/pex-common.c index 5f3a9628ed6..30cd9040d96 100644 --- a/libiberty/pex-common.c +++ b/libiberty/pex-common.c @@ -1,5 +1,5 @@ /* Common code for executing a program in a sub-process. - Copyright (C) 2005-2019 Free Software Foundation, Inc. + Copyright (C) 2005-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of the libiberty library. diff --git a/libiberty/pex-common.h b/libiberty/pex-common.h index b5aa87737ed..54dd1a12493 100644 --- a/libiberty/pex-common.h +++ b/libiberty/pex-common.h @@ -1,6 +1,6 @@ /* Utilities to execute a program in a subprocess (possibly linked by pipes with other subprocesses), and wait for it. Shared logic. - Copyright (C) 1996-2019 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/pex-djgpp.c b/libiberty/pex-djgpp.c index 847cd150205..35118089b46 100644 --- a/libiberty/pex-djgpp.c +++ b/libiberty/pex-djgpp.c @@ -1,6 +1,6 @@ /* Utilities to execute a program in a subprocess (possibly linked by pipes with other subprocesses), and wait for it. DJGPP specialization. - Copyright (C) 1996-2019 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/pex-msdos.c b/libiberty/pex-msdos.c index c7fa8a325d7..67a4733d49a 100644 --- a/libiberty/pex-msdos.c +++ b/libiberty/pex-msdos.c @@ -1,6 +1,6 @@ /* Utilities to execute a program in a subprocess (possibly linked by pipes with other subprocesses), and wait for it. Generic MSDOS specialization. - Copyright (C) 1996-2019 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/pex-one.c b/libiberty/pex-one.c index b26da672d18..2dcf6c07fff 100644 --- a/libiberty/pex-one.c +++ b/libiberty/pex-one.c @@ -1,5 +1,5 @@ /* Execute a program and wait for a result. - Copyright (C) 2005-2019 Free Software Foundation, Inc. + Copyright (C) 2005-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c index f9e5277897b..684a49ace60 100644 --- a/libiberty/pex-unix.c +++ b/libiberty/pex-unix.c @@ -1,7 +1,7 @@ /* Utilities to execute a program in a subprocess (possibly linked by pipes with other subprocesses), and wait for it. Generic Unix version (also used for UWIN and VMS). - Copyright (C) 1996-2019 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c index 0c69a250319..331067b5078 100644 --- a/libiberty/pex-win32.c +++ b/libiberty/pex-win32.c @@ -1,6 +1,6 @@ /* Utilities to execute a program in a subprocess (possibly linked by pipes with other subprocesses), and wait for it. Generic Win32 specialization. - Copyright (C) 1996-2019 Free Software Foundation, Inc. + Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c index b951d908b2e..2dfcdda68d4 100644 --- a/libiberty/pexecute.c +++ b/libiberty/pexecute.c @@ -1,6 +1,6 @@ /* Utilities to execute a program in a subprocess (possibly linked by pipes with other subprocesses), and wait for it. - Copyright (C) 2004-2019 Free Software Foundation, Inc. + Copyright (C) 2004-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/physmem.c b/libiberty/physmem.c index e2d393b3cf7..f9427168a66 100644 --- a/libiberty/physmem.c +++ b/libiberty/physmem.c @@ -1,5 +1,5 @@ /* Calculate the size of physical memory. - Copyright (C) 2000-2019 Free Software Foundation, Inc. + Copyright (C) 2000-2020 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/libiberty/putenv.c b/libiberty/putenv.c index f0f2ca37e28..f3ddf83933f 100644 --- a/libiberty/putenv.c +++ b/libiberty/putenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2019 Free Software Foundation, Inc. +/* Copyright (C) 1991-2020 Free Software Foundation, Inc. This file based on putenv.c in the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libiberty/regex.c b/libiberty/regex.c index 07b8ac832dc..7d2031994f7 100644 --- a/libiberty/regex.c +++ b/libiberty/regex.c @@ -3,7 +3,7 @@ (Implements POSIX draft P1003.2/D11.2, except for some of the internationalization features.) - Copyright (C) 1993-2019 Free Software Foundation, Inc. + Copyright (C) 1993-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c index 2302db45b6f..b87365c85fe 100644 --- a/libiberty/rust-demangle.c +++ b/libiberty/rust-demangle.c @@ -1,5 +1,5 @@ /* Demangler for the Rust programming language - Copyright (C) 2016-2019 Free Software Foundation, Inc. + Copyright (C) 2016-2020 Free Software Foundation, Inc. Written by David Tolnay (dtolnay@gmail.com). This file is part of the libiberty library. @@ -33,9 +33,11 @@ If not, see . */ #include "safe-ctype.h" +#include #include #include #include +#include #ifdef HAVE_STRING_H #include @@ -47,303 +49,484 @@ extern void *memset(void *s, int c, size_t n); #include #include "libiberty.h" -#include "rust-demangle.h" +struct rust_demangler +{ + const char *sym; + size_t sym_len; -/* Mangled Rust symbols look like this: - _$LT$std..sys..fd..FileDesc$u20$as$u20$core..ops..Drop$GT$::drop::hc68340e1baa4987a - - The original symbol is: - ::drop - - The last component of the path is a 64-bit hash in lowercase hex, - prefixed with "h". Rust does not have a global namespace between - crates, an illusion which Rust maintains by using the hash to - distinguish things that would otherwise have the same symbol. - - Any path component not starting with a XID_Start character is - prefixed with "_". - - The following escape sequences are used: + void *callback_opaque; + demangle_callbackref callback; - "," => $C$ - "@" => $SP$ - "*" => $BP$ - "&" => $RF$ - "<" => $LT$ - ">" => $GT$ - "(" => $LP$ - ")" => $RP$ - " " => $u20$ - "\"" => $u22$ - "'" => $u27$ - "+" => $u2b$ - ";" => $u3b$ - "[" => $u5b$ - "]" => $u5d$ - "{" => $u7b$ - "}" => $u7d$ - "~" => $u7e$ + /* Position of the next character to read from the symbol. */ + size_t next; - A double ".." means "::" and a single "." means "-". + /* Non-zero if any error occurred. */ + int errored; - The only characters allowed in the mangled symbol are a-zA-Z0-9 and _.:$ */ + /* Non-zero if printing should be verbose (e.g. include hashes). */ + int verbose; -static const char *hash_prefix = "::h"; -static const size_t hash_prefix_len = 3; -static const size_t hash_len = 16; + /* Rust mangling version, with legacy mangling being -1. */ + int version; +}; -static int is_prefixed_hash (const char *start); -static int looks_like_rust (const char *sym, size_t len); -static int unescape (const char **in, char **out, const char *seq, char value); +/* Parsing functions. */ -/* INPUT: sym: symbol that has been through C++ (gnu v3) demangling +static char +peek (const struct rust_demangler *rdm) +{ + if (rdm->next < rdm->sym_len) + return rdm->sym[rdm->next]; + return 0; +} - This function looks for the following indicators: +static char +next (struct rust_demangler *rdm) +{ + char c = peek (rdm); + if (!c) + rdm->errored = 1; + else + rdm->next++; + return c; +} - 1. The hash must consist of "h" followed by 16 lowercase hex digits. +struct rust_mangled_ident +{ + /* ASCII part of the identifier. */ + const char *ascii; + size_t ascii_len; +}; - 2. As a sanity check, the hash must use between 5 and 15 of the 16 - possible hex digits. This is true of 99.9998% of hashes so once - in your life you may see a false negative. The point is to - notice path components that could be Rust hashes but are - probably not, like "haaaaaaaaaaaaaaaa". In this case a false - positive (non-Rust symbol has an important path component - removed because it looks like a Rust hash) is worse than a false - negative (the rare Rust symbol is not demangled) so this sets - the balance in favor of false negatives. +static struct rust_mangled_ident +parse_ident (struct rust_demangler *rdm) +{ + char c; + size_t start, len; + struct rust_mangled_ident ident; + + ident.ascii = NULL; + ident.ascii_len = 0; + + c = next (rdm); + if (!ISDIGIT (c)) + { + rdm->errored = 1; + return ident; + } + len = c - '0'; + + if (c != '0') + while (ISDIGIT (peek (rdm))) + len = len * 10 + (next (rdm) - '0'); + + start = rdm->next; + rdm->next += len; + /* Check for overflows. */ + if ((start > rdm->next) || (rdm->next > rdm->sym_len)) + { + rdm->errored = 1; + return ident; + } + + ident.ascii = rdm->sym + start; + ident.ascii_len = len; + + if (ident.ascii_len == 0) + ident.ascii = NULL; + + return ident; +} - 3. There must be no characters other than a-zA-Z0-9 and _.:$ +/* Printing functions. */ - 4. There must be no unrecognized $-sign sequences. +static void +print_str (struct rust_demangler *rdm, const char *data, size_t len) +{ + if (!rdm->errored) + rdm->callback (data, len, rdm->callback_opaque); +} - 5. There must be no sequence of three or more dots in a row ("..."). */ +#define PRINT(s) print_str (rdm, s, strlen (s)) -int -rust_is_mangled (const char *sym) +/* Return a 0x0-0xf value if the char is 0-9a-f, and -1 otherwise. */ +static int +decode_lower_hex_nibble (char nibble) { - size_t len, len_without_hash; + if ('0' <= nibble && nibble <= '9') + return nibble - '0'; + if ('a' <= nibble && nibble <= 'f') + return 0xa + (nibble - 'a'); + return -1; +} - if (!sym) - return 0; +/* Return the unescaped character for a "$...$" escape, or 0 if invalid. */ +static char +decode_legacy_escape (const char *e, size_t len, size_t *out_len) +{ + char c = 0; + size_t escape_len = 0; + int lo_nibble = -1, hi_nibble = -1; - len = strlen (sym); - if (len <= hash_prefix_len + hash_len) - /* Not long enough to contain "::h" + hash + something else */ + if (len < 3 || e[0] != '$') return 0; - len_without_hash = len - (hash_prefix_len + hash_len); - if (!is_prefixed_hash (sym + len_without_hash)) + e++; + len--; + + if (e[0] == 'C') + { + escape_len = 1; + + c = ','; + } + else if (len > 2) + { + escape_len = 2; + + if (e[0] == 'S' && e[1] == 'P') + c = '@'; + else if (e[0] == 'B' && e[1] == 'P') + c = '*'; + else if (e[0] == 'R' && e[1] == 'F') + c = '&'; + else if (e[0] == 'L' && e[1] == 'T') + c = '<'; + else if (e[0] == 'G' && e[1] == 'T') + c = '>'; + else if (e[0] == 'L' && e[1] == 'P') + c = '('; + else if (e[0] == 'R' && e[1] == 'P') + c = ')'; + else if (e[0] == 'u' && len > 3) + { + escape_len = 3; + + hi_nibble = decode_lower_hex_nibble (e[1]); + if (hi_nibble < 0) + return 0; + lo_nibble = decode_lower_hex_nibble (e[2]); + if (lo_nibble < 0) + return 0; + + /* Only allow non-control ASCII characters. */ + if (hi_nibble > 7) + return 0; + c = (hi_nibble << 4) | lo_nibble; + if (c < 0x20) + return 0; + } + } + + if (!c || len <= escape_len || e[escape_len] != '$') return 0; - return looks_like_rust (sym, len_without_hash); + *out_len = 2 + escape_len; + return c; } -/* A hash is the prefix "::h" followed by 16 lowercase hex digits. The - hex digits must comprise between 5 and 15 (inclusive) distinct - digits. */ +static void +print_ident (struct rust_demangler *rdm, struct rust_mangled_ident ident) +{ + char unescaped; + size_t len; + if (rdm->errored) + return; + + if (rdm->version == -1) + { + /* Ignore leading underscores preceding escape sequences. + The mangler inserts an underscore to make sure the + identifier begins with a XID_Start character. */ + if (ident.ascii_len >= 2 && ident.ascii[0] == '_' + && ident.ascii[1] == '$') + { + ident.ascii++; + ident.ascii_len--; + } + + while (ident.ascii_len > 0) + { + /* Handle legacy escape sequences ("$...$", ".." or "."). */ + if (ident.ascii[0] == '$') + { + unescaped + = decode_legacy_escape (ident.ascii, ident.ascii_len, &len); + if (unescaped) + print_str (rdm, &unescaped, 1); + else + { + /* Unexpected escape sequence, print the rest verbatim. */ + print_str (rdm, ident.ascii, ident.ascii_len); + return; + } + } + else if (ident.ascii[0] == '.') + { + if (ident.ascii_len >= 2 && ident.ascii[1] == '.') + { + /* ".." becomes "::" */ + PRINT ("::"); + len = 2; + } + else + { + /* "." becomes "-" */ + PRINT ("-"); + len = 1; + } + } + else + { + /* Print everything before the next escape sequence, at once. */ + for (len = 0; len < ident.ascii_len; len++) + if (ident.ascii[len] == '$' || ident.ascii[len] == '.') + break; + + print_str (rdm, ident.ascii, len); + } + + ident.ascii += len; + ident.ascii_len -= len; + } + + return; + } +} + +/* A legacy hash is the prefix "h" followed by 16 lowercase hex digits. + The hex digits must contain at least 5 distinct digits. */ static int -is_prefixed_hash (const char *str) +is_legacy_prefixed_hash (struct rust_mangled_ident ident) { - const char *end; - char seen[16]; - size_t i; - int count; + uint16_t seen; + int nibble; + size_t i, count; - if (strncmp (str, hash_prefix, hash_prefix_len)) + if (ident.ascii_len != 17 || ident.ascii[0] != 'h') return 0; - str += hash_prefix_len; - - memset (seen, 0, sizeof(seen)); - for (end = str + hash_len; str < end; str++) - if (*str >= '0' && *str <= '9') - seen[*str - '0'] = 1; - else if (*str >= 'a' && *str <= 'f') - seen[*str - 'a' + 10] = 1; - else - return 0; - /* Count how many distinct digits seen */ - count = 0; + seen = 0; for (i = 0; i < 16; i++) - if (seen[i]) - count++; - - return count >= 5 && count <= 15; + { + nibble = decode_lower_hex_nibble (ident.ascii[1 + i]); + if (nibble < 0) + return 0; + seen |= (uint16_t)1 << nibble; + } + + /* Count how many distinct digits were seen. */ + count = 0; + while (seen) + { + if (seen & 1) + count++; + seen >>= 1; + } + + return count >= 5; } -static int -looks_like_rust (const char *str, size_t len) +int +rust_demangle_callback (const char *mangled, int options, + demangle_callbackref callback, void *opaque) { - const char *end = str + len; - - while (str < end) - switch (*str) - { - case '$': - if (!strncmp (str, "$C$", 3)) - str += 3; - else if (!strncmp (str, "$SP$", 4) - || !strncmp (str, "$BP$", 4) - || !strncmp (str, "$RF$", 4) - || !strncmp (str, "$LT$", 4) - || !strncmp (str, "$GT$", 4) - || !strncmp (str, "$LP$", 4) - || !strncmp (str, "$RP$", 4)) - str += 4; - else if (!strncmp (str, "$u20$", 5) - || !strncmp (str, "$u22$", 5) - || !strncmp (str, "$u27$", 5) - || !strncmp (str, "$u2b$", 5) - || !strncmp (str, "$u3b$", 5) - || !strncmp (str, "$u5b$", 5) - || !strncmp (str, "$u5d$", 5) - || !strncmp (str, "$u7b$", 5) - || !strncmp (str, "$u7d$", 5) - || !strncmp (str, "$u7e$", 5)) - str += 5; - else - return 0; - break; - case '.': - /* Do not allow three or more consecutive dots */ - if (!strncmp (str, "...", 3)) - return 0; - /* Fall through */ - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case '_': - case ':': - str++; - break; - default: - return 0; - } - - return 1; -} + const char *p; + struct rust_demangler rdm; + struct rust_mangled_ident ident; + + rdm.sym = mangled; + rdm.sym_len = 0; + + rdm.callback_opaque = opaque; + rdm.callback = callback; + + rdm.next = 0; + rdm.errored = 0; + rdm.verbose = (options & DMGL_VERBOSE) != 0; + rdm.version = 0; + + /* Rust symbols always start with _ZN (legacy). */ + if (rdm.sym[0] == '_' && rdm.sym[1] == 'Z' && rdm.sym[2] == 'N') + { + rdm.sym += 3; + rdm.version = -1; + } + else + return 0; + + /* Legacy Rust symbols use only [_0-9a-zA-Z.:$] characters. */ + for (p = rdm.sym; *p; p++) + { + rdm.sym_len++; -/* - INPUT: sym: symbol for which rust_is_mangled(sym) returned 1. + if (*p == '_' || ISALNUM (*p)) + continue; - The input is demangled in-place because the mangled name is always - longer than the demangled one. */ + if (rdm.version == -1 && (*p == '$' || *p == '.' || *p == ':')) + continue; -void -rust_demangle_sym (char *sym) + return 0; + } + + /* Legacy Rust symbols need to be handled separately. */ + if (rdm.version == -1) + { + /* Legacy Rust symbols always end with E. */ + if (!(rdm.sym_len > 0 && rdm.sym[rdm.sym_len - 1] == 'E')) + return 0; + rdm.sym_len--; + + /* Legacy Rust symbols also always end with a path segment + that encodes a 16 hex digit hash, i.e. '17h[a-f0-9]{16}'. + This early check, before any parse_ident calls, should + quickly filter out most C++ symbols unrelated to Rust. */ + if (!(rdm.sym_len > 19 + && !memcmp (&rdm.sym[rdm.sym_len - 19], "17h", 3))) + return 0; + + do + { + ident = parse_ident (&rdm); + if (rdm.errored || !ident.ascii) + return 0; + } + while (rdm.next < rdm.sym_len); + + /* The last path segment should be the hash. */ + if (!is_legacy_prefixed_hash (ident)) + return 0; + + /* Reset the state for a second pass, to print the symbol. */ + rdm.next = 0; + if (!rdm.verbose && rdm.sym_len > 19) + { + /* Hide the last segment, containing the hash, if not verbose. */ + rdm.sym_len -= 19; + } + + do + { + if (rdm.next > 0) + print_str (&rdm, "::", 2); + + ident = parse_ident (&rdm); + print_ident (&rdm, ident); + } + while (rdm.next < rdm.sym_len); + } + else + return 0; + + return !rdm.errored; +} + +/* Growable string buffers. */ +struct str_buf +{ + char *ptr; + size_t len; + size_t cap; + int errored; +}; + +static void +str_buf_reserve (struct str_buf *buf, size_t extra) { - const char *in; - char *out; - const char *end; + size_t available, min_new_cap, new_cap; + char *new_ptr; - if (!sym) + /* Allocation failed before. */ + if (buf->errored) return; - in = sym; - out = sym; - end = sym + strlen (sym) - (hash_prefix_len + hash_len); - - while (in < end) - switch (*in) - { - case '$': - if (!(unescape (&in, &out, "$C$", ',') - || unescape (&in, &out, "$SP$", '@') - || unescape (&in, &out, "$BP$", '*') - || unescape (&in, &out, "$RF$", '&') - || unescape (&in, &out, "$LT$", '<') - || unescape (&in, &out, "$GT$", '>') - || unescape (&in, &out, "$LP$", '(') - || unescape (&in, &out, "$RP$", ')') - || unescape (&in, &out, "$u20$", ' ') - || unescape (&in, &out, "$u22$", '\"') - || unescape (&in, &out, "$u27$", '\'') - || unescape (&in, &out, "$u2b$", '+') - || unescape (&in, &out, "$u3b$", ';') - || unescape (&in, &out, "$u5b$", '[') - || unescape (&in, &out, "$u5d$", ']') - || unescape (&in, &out, "$u7b$", '{') - || unescape (&in, &out, "$u7d$", '}') - || unescape (&in, &out, "$u7e$", '~'))) { - /* unexpected escape sequence, not looks_like_rust. */ - goto fail; - } - break; - case '_': - /* If this is the start of a path component and the next - character is an escape sequence, ignore the underscore. The - mangler inserts an underscore to make sure the path - component begins with a XID_Start character. */ - if ((in == sym || in[-1] == ':') && in[1] == '$') - in++; - else - *out++ = *in++; - break; - case '.': - if (in[1] == '.') - { - /* ".." becomes "::" */ - *out++ = ':'; - *out++ = ':'; - in += 2; - } - else - { - /* "." becomes "-" */ - *out++ = '-'; - in++; - } - break; - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case ':': - *out++ = *in++; - break; - default: - /* unexpected character in symbol, not looks_like_rust. */ - goto fail; - } - goto done; - -fail: - *out++ = '?'; /* This is pretty lame, but it's hard to do better. */ -done: - *out = '\0'; + available = buf->cap - buf->len; + + if (extra <= available) + return; + + min_new_cap = buf->cap + (extra - available); + + /* Check for overflows. */ + if (min_new_cap < buf->cap) + { + buf->errored = 1; + return; + } + + new_cap = buf->cap; + + if (new_cap == 0) + new_cap = 4; + + /* Double capacity until sufficiently large. */ + while (new_cap < min_new_cap) + { + new_cap *= 2; + + /* Check for overflows. */ + if (new_cap < buf->cap) + { + buf->errored = 1; + return; + } + } + + new_ptr = (char *)realloc (buf->ptr, new_cap); + if (new_ptr == NULL) + { + free (buf->ptr); + buf->ptr = NULL; + buf->len = 0; + buf->cap = 0; + buf->errored = 1; + } + else + { + buf->ptr = new_ptr; + buf->cap = new_cap; + } } -static int -unescape (const char **in, char **out, const char *seq, char value) +static void +str_buf_append (struct str_buf *buf, const char *data, size_t len) { - size_t len = strlen (seq); + str_buf_reserve (buf, len); + if (buf->errored) + return; - if (strncmp (*in, seq, len)) - return 0; + memcpy (buf->ptr + buf->len, data, len); + buf->len += len; +} + +static void +str_buf_demangle_callback (const char *data, size_t len, void *opaque) +{ + str_buf_append ((struct str_buf *)opaque, data, len); +} + +char * +rust_demangle (const char *mangled, int options) +{ + struct str_buf out; + int success; + + out.ptr = NULL; + out.len = 0; + out.cap = 0; + out.errored = 0; - **out = value; + success = rust_demangle_callback (mangled, options, + str_buf_demangle_callback, &out); - *in += len; - *out += 1; + if (!success) + { + free (out.ptr); + return NULL; + } - return 1; + str_buf_append (&out, "\0", 1); + return out.ptr; } diff --git a/libiberty/safe-ctype.c b/libiberty/safe-ctype.c index 1877898ccc3..56364e6ecd2 100644 --- a/libiberty/safe-ctype.c +++ b/libiberty/safe-ctype.c @@ -1,6 +1,6 @@ /* replacement macros. - Copyright (C) 2000-2019 Free Software Foundation, Inc. + Copyright (C) 2000-2020 Free Software Foundation, Inc. Contributed by Zack Weinberg . This file is part of the libiberty library. diff --git a/libiberty/setenv.c b/libiberty/setenv.c index 2ceabe1317e..82bf1b83600 100644 --- a/libiberty/setenv.c +++ b/libiberty/setenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992-2019 Free Software Foundation, Inc. +/* Copyright (C) 1992-2020 Free Software Foundation, Inc. This file based on setenv.c in the GNU C Library. The GNU C Library is free software; you can redistribute it and/or diff --git a/libiberty/setproctitle.c b/libiberty/setproctitle.c index 1d3fafbf0a3..3de50f67593 100644 --- a/libiberty/setproctitle.c +++ b/libiberty/setproctitle.c @@ -1,5 +1,5 @@ /* Set the title of a process. - Copyright (C) 2010-2019 Free Software Foundation, Inc. + Copyright (C) 2010-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/sha1.c b/libiberty/sha1.c index f56f803ba2b..af08219b1b0 100644 --- a/libiberty/sha1.c +++ b/libiberty/sha1.c @@ -1,7 +1,7 @@ /* sha1.c - Functions to compute SHA1 message digest of files or memory blocks according to the NIST specification FIPS-180-1. - Copyright (C) 2000-2019 Free Software Foundation, Inc. + Copyright (C) 2000-2020 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the diff --git a/libiberty/simple-object-coff.c b/libiberty/simple-object-coff.c index f299f5afbb7..104cd560f61 100644 --- a/libiberty/simple-object-coff.c +++ b/libiberty/simple-object-coff.c @@ -1,5 +1,5 @@ /* simple-object-coff.c -- routines to manipulate COFF object files. - Copyright (C) 2010-2019 Free Software Foundation, Inc. + Copyright (C) 2010-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor, Google. This program is free software; you can redistribute it and/or modify it diff --git a/libiberty/simple-object-common.h b/libiberty/simple-object-common.h index ddcefc4ee09..2e3f1873468 100644 --- a/libiberty/simple-object-common.h +++ b/libiberty/simple-object-common.h @@ -1,5 +1,5 @@ /* simple-object-common.h -- common structs for object file manipulation. - Copyright (C) 2010-2019 Free Software Foundation, Inc. + Copyright (C) 2010-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/simple-object-elf.c b/libiberty/simple-object-elf.c index 75159266596..c62d5bba551 100644 --- a/libiberty/simple-object-elf.c +++ b/libiberty/simple-object-elf.c @@ -1,5 +1,5 @@ /* simple-object-elf.c -- routines to manipulate ELF object files. - Copyright (C) 2010-2019 Free Software Foundation, Inc. + Copyright (C) 2010-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor, Google. This program is free software; you can redistribute it and/or modify it @@ -1366,30 +1366,17 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, return errmsg; } - /* If we are processing .symtab purge __gnu_lto_slim symbol - from it and any symbols in discarded sections. */ + /* If we are processing .symtab purge any symbols + in discarded sections. */ if (sh_type == SHT_SYMTAB) { unsigned entsize = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, shdr, sh_entsize, Elf_Addr); unsigned strtab = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, shdr, sh_link, Elf_Word); - unsigned char *strshdr = shdrs + (strtab - 1) * shdr_size; - off_t stroff = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, - strshdr, sh_offset, Elf_Addr); - size_t strsz = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, - strshdr, sh_size, Elf_Addr); - char *strings = XNEWVEC (char, strsz); - char *gnu_lto = strings; + size_t prevailing_name_idx = 0; unsigned char *ent; unsigned *shndx_table = NULL; - simple_object_internal_read (sobj->descriptor, - sobj->offset + stroff, - (unsigned char *)strings, - strsz, &errmsg, err); - /* Find first '\0' in strings. */ - gnu_lto = (char *) memchr (gnu_lto + 1, '\0', - strings + strsz - gnu_lto); /* Read the section index table if present. */ if (symtab_indices_shndx[i - 1] != 0) { @@ -1404,6 +1391,45 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, (unsigned char *)shndx_table, sidxsz, &errmsg, err); } + + /* Find a WEAK HIDDEN symbol which name we will use for removed + symbols. We know there's a prevailing weak hidden symbol + at the start of the .debug_info section. */ + for (ent = buf; ent < buf + length; ent += entsize) + { + unsigned st_shndx = ELF_FETCH_FIELD (type_functions, ei_class, + Sym, ent, + st_shndx, Elf_Half); + unsigned char *st_info; + unsigned char *st_other; + if (ei_class == ELFCLASS32) + { + st_info = &((Elf32_External_Sym *)ent)->st_info; + st_other = &((Elf32_External_Sym *)ent)->st_other; + } + else + { + st_info = &((Elf64_External_Sym *)ent)->st_info; + st_other = &((Elf64_External_Sym *)ent)->st_other; + } + if (st_shndx == SHN_XINDEX) + st_shndx = type_functions->fetch_Elf_Word + ((unsigned char *)(shndx_table + (ent - buf) / entsize)); + + if (st_shndx != SHN_COMMON + && !(st_shndx != SHN_UNDEF + && st_shndx < shnum + && pfnret[st_shndx - 1] == -1) + && ELF_ST_BIND (*st_info) == STB_WEAK + && *st_other == STV_HIDDEN) + { + prevailing_name_idx = ELF_FETCH_FIELD (type_functions, + ei_class, Sym, ent, + st_name, Elf_Word); + break; + } + } + for (ent = buf; ent < buf + length; ent += entsize) { unsigned st_shndx = ELF_FETCH_FIELD (type_functions, ei_class, @@ -1426,9 +1452,10 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, if (st_shndx == SHN_XINDEX) st_shndx = type_functions->fetch_Elf_Word ((unsigned char *)(shndx_table + (ent - buf) / entsize)); - /* Eliminate all COMMONs - this includes __gnu_lto_v1 - and __gnu_lto_slim which otherwise cause endless - LTO plugin invocation. */ + /* Eliminate all COMMONs - this includes __gnu_lto_slim + which otherwise cause endless LTO plugin invocation. + FIXME: remove the condition once we remove emission + of __gnu_lto_slim symbol. */ if (st_shndx == SHN_COMMON) discard = 1; /* We also need to remove symbols refering to sections @@ -1460,12 +1487,13 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, else { /* Make discarded global symbols hidden weak - undefined and sharing the gnu_lto_ name. */ + undefined and sharing a name of a prevailing + symbol. */ bind = STB_WEAK; other = STV_HIDDEN; ELF_SET_FIELD (type_functions, ei_class, Sym, ent, st_name, Elf_Word, - gnu_lto - strings); + prevailing_name_idx); ELF_SET_FIELD (type_functions, ei_class, Sym, ent, st_shndx, Elf_Half, SHN_UNDEF); } @@ -1482,7 +1510,6 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj, ELF_SET_FIELD (type_functions, ei_class, Sym, ent, st_shndx, Elf_Half, sh_map[st_shndx]); } - XDELETEVEC (strings); XDELETEVEC (shndx_table); } else if (sh_type == SHT_GROUP) diff --git a/libiberty/simple-object-mach-o.c b/libiberty/simple-object-mach-o.c index 03283a0e3d8..14f53428643 100644 --- a/libiberty/simple-object-mach-o.c +++ b/libiberty/simple-object-mach-o.c @@ -1,5 +1,5 @@ /* simple-object-mach-o.c -- routines to manipulate Mach-O object files. - Copyright (C) 2010-2019 Free Software Foundation, Inc. + Copyright (C) 2010-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor, Google. This program is free software; you can redistribute it and/or modify it diff --git a/libiberty/simple-object-xcoff.c b/libiberty/simple-object-xcoff.c index 60676567e8e..d874de258f5 100644 --- a/libiberty/simple-object-xcoff.c +++ b/libiberty/simple-object-xcoff.c @@ -1,5 +1,5 @@ /* simple-object-coff.c -- routines to manipulate XCOFF object files. - Copyright (C) 2013-2019 Free Software Foundation, Inc. + Copyright (C) 2013-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor, Google and David Edelsohn, IBM. This program is free software; you can redistribute it and/or modify it diff --git a/libiberty/simple-object.c b/libiberty/simple-object.c index b00c265128c..d9c648af717 100644 --- a/libiberty/simple-object.c +++ b/libiberty/simple-object.c @@ -1,5 +1,5 @@ /* simple-object.c -- simple routines to read and write object files. - Copyright (C) 2010-2019 Free Software Foundation, Inc. + Copyright (C) 2010-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor, Google. This program is free software; you can redistribute it and/or modify it diff --git a/libiberty/snprintf.c b/libiberty/snprintf.c index a6feccf0202..2ab931e60b0 100644 --- a/libiberty/snprintf.c +++ b/libiberty/snprintf.c @@ -1,5 +1,5 @@ /* Implement the snprintf function. - Copyright (C) 2003-2019 Free Software Foundation, Inc. + Copyright (C) 2003-2020 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. This library is free diff --git a/libiberty/sort.c b/libiberty/sort.c index 0267fdb230e..fd8f926a8de 100644 --- a/libiberty/sort.c +++ b/libiberty/sort.c @@ -1,5 +1,5 @@ /* Sorting algorithms. - Copyright (C) 2000-2019 Free Software Foundation, Inc. + Copyright (C) 2000-2020 Free Software Foundation, Inc. Contributed by Mark Mitchell . This file is part of GNU CC. diff --git a/libiberty/spaces.c b/libiberty/spaces.c index 6e35d2237f8..d97390b2ddc 100644 --- a/libiberty/spaces.c +++ b/libiberty/spaces.c @@ -1,5 +1,5 @@ /* Allocate memory region filled with spaces. - Copyright (C) 1991-2019 Free Software Foundation, Inc. + Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c index 4bbb39a62ca..3b7b810388c 100644 --- a/libiberty/splay-tree.c +++ b/libiberty/splay-tree.c @@ -1,5 +1,5 @@ /* A splay-tree datatype. - Copyright (C) 1998-2019 Free Software Foundation, Inc. + Copyright (C) 1998-2020 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GNU CC. diff --git a/libiberty/stack-limit.c b/libiberty/stack-limit.c index aabe016e7a8..390adf32a4c 100644 --- a/libiberty/stack-limit.c +++ b/libiberty/stack-limit.c @@ -1,5 +1,5 @@ /* Increase stack size limit if possible. - Copyright (C) 2011-2019 Free Software Foundation, Inc. + Copyright (C) 2011-2020 Free Software Foundation, Inc. This file is part of the libiberty library. This library is free software; you can redistribute it and/or modify it under the diff --git a/libiberty/stpcpy.c b/libiberty/stpcpy.c index ee44a7bdd2b..2b0a8506375 100644 --- a/libiberty/stpcpy.c +++ b/libiberty/stpcpy.c @@ -1,5 +1,5 @@ /* Implement the stpcpy function. - Copyright (C) 2003-2019 Free Software Foundation, Inc. + Copyright (C) 2003-2020 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. diff --git a/libiberty/stpncpy.c b/libiberty/stpncpy.c index 47e0276c7e2..641b8f9cf93 100644 --- a/libiberty/stpncpy.c +++ b/libiberty/stpncpy.c @@ -1,5 +1,5 @@ /* Implement the stpncpy function. - Copyright (C) 2003-2019 Free Software Foundation, Inc. + Copyright (C) 2003-2020 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. diff --git a/libiberty/strndup.c b/libiberty/strndup.c index 88c3332e819..a7ff3a9bbfc 100644 --- a/libiberty/strndup.c +++ b/libiberty/strndup.c @@ -1,5 +1,5 @@ /* Implement the strndup function. - Copyright (C) 2005-2019 Free Software Foundation, Inc. + Copyright (C) 2005-2020 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. diff --git a/libiberty/strtod.c b/libiberty/strtod.c index 7bb11d286a5..de8c54cdfe7 100644 --- a/libiberty/strtod.c +++ b/libiberty/strtod.c @@ -1,5 +1,5 @@ /* Implementation of strtod for systems with atof. - Copyright (C) 1991-2019 Free Software Foundation, Inc. + Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the libiberty library. This library is free software; you can redistribute it and/or modify it under the diff --git a/libiberty/strverscmp.c b/libiberty/strverscmp.c index 19cf4aeab2e..c31734675fc 100644 --- a/libiberty/strverscmp.c +++ b/libiberty/strverscmp.c @@ -1,5 +1,5 @@ /* Compare strings while treating digits characters numerically. - Copyright (C) 1997-2019 Free Software Foundation, Inc. + Copyright (C) 1997-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Contributed by Jean-François Bignolles , 1997. diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in index 6b6b970fe0a..1f05557a153 100644 --- a/libiberty/testsuite/Makefile.in +++ b/libiberty/testsuite/Makefile.in @@ -1,6 +1,6 @@ # # Makefile -# Copyright (C) 1999-2019 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is part of the libiberty library. # Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index f21ed00e559..5878d96dee3 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -1278,7 +1278,7 @@ int& int_if_addable(A*) # --format=gnu-v3 _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE -void baz(A*) +void baz(A*) # --format=gnu-v3 _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv @@ -1446,3 +1446,7 @@ Foo()::X::fn _ZZZ3FooIiEfvENKUlT_E_clIcEEDaS0_EN1X2fnEv Foo()::{lambda(auto:1)#1}::operator()(char) const::X::fn() Foo()::{lambda(auto:1)#1}::operator()(char) const::X::fn +#PR91979 demangling nullptr expression + +_Z3fooILPv0EEvPN9enable_ifIXeqT_LDnEEvE4typeE +void foo<(void*)0>(enable_if<((void*)0)==((decltype(nullptr))), void>::type*) diff --git a/libiberty/testsuite/demangler-fuzzer.c b/libiberty/testsuite/demangler-fuzzer.c index c291e6c12e3..9e35caa142e 100644 --- a/libiberty/testsuite/demangler-fuzzer.c +++ b/libiberty/testsuite/demangler-fuzzer.c @@ -1,6 +1,6 @@ /* Demangler fuzzer. - Copyright (C) 2014-2019 Free Software Foundation, Inc. + Copyright (C) 2014-2020 Free Software Foundation, Inc. This file is part of GNU libiberty. diff --git a/libiberty/testsuite/rust-demangle-expected b/libiberty/testsuite/rust-demangle-expected index 0b4288fc37d..74774794736 100644 --- a/libiberty/testsuite/rust-demangle-expected +++ b/libiberty/testsuite/rust-demangle-expected @@ -41,7 +41,7 @@ main::main::he714a2e23ed7db2g # $XX$ substitutions should not contain just numbers. --format=auto _ZN4main4$99$17he714a2e23ed7db23E -main::$99$::he714a2e23ed7db23 +main::$99$ # _ at start of path should be removed. # ".." translates to "::" "$GT$" to ">" and "$LT$" to "<". --format=rust @@ -159,3 +159,7 @@ _ZN68_$LT$core..nonzero..NonZero$LT$T$GT$$u20$as$u20$core..ops..Deref$GT$5deref1 --format=rust _ZN63_$LT$core..ptr..Unique$LT$T$GT$$u20$as$u20$core..ops..Deref$GT$5deref17h19f2ad4920655e85E as core::ops::Deref>::deref +# +--format=rust +_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h059a991a004536adE +issue_60925::foo::Foo::foo diff --git a/libiberty/testsuite/test-demangle.c b/libiberty/testsuite/test-demangle.c index 9943b1cc72d..eb3bcbde608 100644 --- a/libiberty/testsuite/test-demangle.c +++ b/libiberty/testsuite/test-demangle.c @@ -1,5 +1,5 @@ /* Demangler test program, - Copyright (C) 2002-2019 Free Software Foundation, Inc. + Copyright (C) 2002-2020 Free Software Foundation, Inc. Written by Zack Weinberg This file is part of the libiberty library, which is part of GCC. diff --git a/libiberty/testsuite/test-pexecute.c b/libiberty/testsuite/test-pexecute.c index a92fae7a62e..30c990dfae9 100644 --- a/libiberty/testsuite/test-pexecute.c +++ b/libiberty/testsuite/test-pexecute.c @@ -1,5 +1,5 @@ /* Pexecute test program, - Copyright (C) 2005-2019 Free Software Foundation, Inc. + Copyright (C) 2005-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU libiberty. diff --git a/libiberty/testsuite/test-strtol.c b/libiberty/testsuite/test-strtol.c index 28cce83feb1..fd5f89d2a43 100644 --- a/libiberty/testsuite/test-strtol.c +++ b/libiberty/testsuite/test-strtol.c @@ -1,5 +1,5 @@ /* Test program for strtol family of funtions, - Copyright (C) 2014-2019 Free Software Foundation, Inc. + Copyright (C) 2014-2020 Free Software Foundation, Inc. Written by Yury Gribov This file is part of the libiberty library, which is part of GCC. diff --git a/libiberty/timeval-utils.c b/libiberty/timeval-utils.c index 90dc765e2a6..ee46b5633e1 100644 --- a/libiberty/timeval-utils.c +++ b/libiberty/timeval-utils.c @@ -1,5 +1,5 @@ /* Basic struct timeval utilities. - Copyright (C) 2011-2019 Free Software Foundation, Inc. + Copyright (C) 2011-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/unlink-if-ordinary.c b/libiberty/unlink-if-ordinary.c index dbaf31d804e..b4d6f0a8418 100644 --- a/libiberty/unlink-if-ordinary.c +++ b/libiberty/unlink-if-ordinary.c @@ -1,5 +1,5 @@ /* unlink-if-ordinary.c - remove link to a file unless it is special - Copyright (C) 2004-2019 Free Software Foundation, Inc. + Copyright (C) 2004-2020 Free Software Foundation, Inc. This file is part of the libiberty library. This library is free software; you can redistribute it and/or modify it under the diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c index cc04248b5cd..0bdd41a5e31 100644 --- a/libiberty/vasprintf.c +++ b/libiberty/vasprintf.c @@ -1,6 +1,6 @@ /* Like vsprintf but provides a pointer to malloc'd storage, which must be freed by the caller. - Copyright (C) 1994-2019 Free Software Foundation, Inc. + Copyright (C) 1994-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/vfprintf.c b/libiberty/vfprintf.c index 2fb6bf07090..433d12db66d 100644 --- a/libiberty/vfprintf.c +++ b/libiberty/vfprintf.c @@ -1,6 +1,6 @@ /* Provide a version vfprintf in terms of _doprnt. By Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98 - Copyright (C) 1998-2019 Free Software Foundation, Inc. + Copyright (C) 1998-2020 Free Software Foundation, Inc. */ #include "ansidecl.h" diff --git a/libiberty/vprintf-support.c b/libiberty/vprintf-support.c index aabc3d2ef04..52e7378ea96 100644 --- a/libiberty/vprintf-support.c +++ b/libiberty/vprintf-support.c @@ -1,6 +1,6 @@ /* Estimate the length of the string generated by a vprintf-like function. Used by vasprintf and xvasprintf. - Copyright (C) 1994-2019 Free Software Foundation, Inc. + Copyright (C) 1994-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/vprintf-support.h b/libiberty/vprintf-support.h index 51c2decd800..ea689df6d16 100644 --- a/libiberty/vprintf-support.h +++ b/libiberty/vprintf-support.h @@ -1,6 +1,6 @@ /* Estimate the length of the string generated by a vprintf-like function. Use by vasprintf and xvasprintf. - Copyright (C) 1994-2019 Free Software Foundation, Inc. + Copyright (C) 1994-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/vsnprintf.c b/libiberty/vsnprintf.c index 647fb7a3579..76a7711d1ea 100644 --- a/libiberty/vsnprintf.c +++ b/libiberty/vsnprintf.c @@ -1,5 +1,5 @@ /* Implement the vsnprintf function. - Copyright (C) 2003-2019 Free Software Foundation, Inc. + Copyright (C) 2003-2020 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. This library is free diff --git a/libiberty/vsprintf.c b/libiberty/vsprintf.c index a2ec5aef91a..63375695654 100644 --- a/libiberty/vsprintf.c +++ b/libiberty/vsprintf.c @@ -3,7 +3,7 @@ implementations of stdio; newer ones should already have vsprintf. Written by Per Bothner of Cygnus Support. Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu). - Copyright (C) 1991-2019 Free Software Foundation, Inc. + Copyright (C) 1991-2020 Free Software Foundation, Inc. This file is part of the libiberty library. This library is free software; you can redistribute it and/or modify it under the diff --git a/libiberty/xasprintf.c b/libiberty/xasprintf.c index 5af97e4eb49..76fb4b34d40 100644 --- a/libiberty/xasprintf.c +++ b/libiberty/xasprintf.c @@ -1,5 +1,5 @@ /* Implement the xasprintf function. - Copyright (C) 2014-2019 Free Software Foundation, Inc. + Copyright (C) 2014-2020 Free Software Foundation, Inc. Contributed by Manuel Lopez-Ibanez. This file is part of the libiberty library. diff --git a/libiberty/xexit.c b/libiberty/xexit.c index 7cbebc8420f..268aef15956 100644 --- a/libiberty/xexit.c +++ b/libiberty/xexit.c @@ -1,5 +1,5 @@ /* xexit.c -- Run any exit handlers, then exit. - Copyright (C) 1994-2019 Free Software Foundation, Inc. + Copyright (C) 1994-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c index e39ab3b9f9c..96d51b57780 100644 --- a/libiberty/xmalloc.c +++ b/libiberty/xmalloc.c @@ -1,5 +1,5 @@ /* memory allocation routines with error checking. - Copyright (C) 1989-2019 Free Software Foundation, Inc. + Copyright (C) 1989-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or diff --git a/libiberty/xstrndup.c b/libiberty/xstrndup.c index bb0b512dce5..32ba832427c 100644 --- a/libiberty/xstrndup.c +++ b/libiberty/xstrndup.c @@ -1,5 +1,5 @@ /* Implement the xstrndup function. - Copyright (C) 2005-2019 Free Software Foundation, Inc. + Copyright (C) 2005-2020 Free Software Foundation, Inc. Written by Kaveh R. Ghazi . This file is part of the libiberty library. diff --git a/libiberty/xvasprintf.c b/libiberty/xvasprintf.c index c4ab52e34c6..1ac513e189f 100644 --- a/libiberty/xvasprintf.c +++ b/libiberty/xvasprintf.c @@ -1,5 +1,5 @@ /* Implement the xvasprintf function. - Copyright (C) 2014-2019 Free Software Foundation, Inc. + Copyright (C) 2014-2020 Free Software Foundation, Inc. Contributed by Manuel Lopez-Ibanez. This file is part of the libiberty library. -- cgit v1.2.1