Update libiberty sources with changes in the gcc mainline.
authorNick Clifton <nickc@redhat.com>
Fri, 17 Jan 2020 14:13:22 +0000 (14:13 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 17 Jan 2020 14:13:22 +0000 (14:13 +0000)
+2020-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+ Update copyright years.
+
+2019-12-06  Tim Ruehsen  <tim.ruehsen@gmx.de>
+
+ * make-relative-prefix.c (split_directories):
+ Return early on empty 'name'
+
+2019-11-16  Tim Ruehsen  <tim.ruehsen@gmx.de>
+
+ * 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  <eddyb@lyken.rs>
+
+ * 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  <saldivarcher@gmail.com>
+
+ * testsuite/demangle-expected: Fix test.
+
+2019-11-04  Kamlesh Kumar  <kamleshbhalui@gmail.com>
+
+ * cp-demangle.c (d_expr_primary): Handle
+ nullptr demangling.
+ * testsuite/demangle-expected: Added test.
+
+2019-10-29 Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+ * cp-demangle.c (d_number): Avoid signed int overflow.
+
+2019-10-28  Miguel Saldivar  <saldivarcher@gmail.com>
+
+ * 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  <eddyb@lyken.rs>
+
+ * 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  <eddyb@lyken.rs>
+
+ * 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  <mliska@suse.cz>
+
+ PR lto/91478
+ * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
+ First find a WEAK HIDDEN symbol in symbol table that will be
+ preserved.  Later, use the symbol name for all removed symbols.
+
+2019-08-12  Martin Liska  <mliska@suse.cz>
+
+ * 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 <rich@cygnus.com>.
 #
-# 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

100 files changed:
include/ChangeLog
include/ansidecl.h
include/demangle.h
include/libiberty.h
libiberty/ChangeLog
libiberty/Makefile.in
libiberty/_doprnt.c
libiberty/argv.c
libiberty/asprintf.c
libiberty/choose-temp.c
libiberty/clock.c
libiberty/concat.c
libiberty/copying-lib.texi
libiberty/cp-demangle.c
libiberty/cp-demangle.h
libiberty/cp-demint.c
libiberty/cplus-dem.c
libiberty/crc32.c
libiberty/d-demangle.c
libiberty/dwarfnames.c
libiberty/dyn-string.c
libiberty/fdmatch.c
libiberty/fibheap.c
libiberty/filedescriptor.c [new file with mode: 0644]
libiberty/filename_cmp.c
libiberty/floatformat.c
libiberty/fnmatch.c
libiberty/fopen_unlocked.c
libiberty/gather-docs
libiberty/getopt.c
libiberty/getopt1.c
libiberty/getruntime.c
libiberty/hashtab.c
libiberty/hex.c
libiberty/lbasename.c
libiberty/libiberty.texi
libiberty/lrealpath.c
libiberty/maint-tool
libiberty/make-relative-prefix.c
libiberty/make-temp-file.c
libiberty/md5.c
libiberty/memmem.c
libiberty/mempcpy.c
libiberty/mkstemps.c
libiberty/objalloc.c
libiberty/obstack.c
libiberty/partition.c
libiberty/pex-common.c
libiberty/pex-common.h
libiberty/pex-djgpp.c
libiberty/pex-msdos.c
libiberty/pex-one.c
libiberty/pex-unix.c
libiberty/pex-win32.c
libiberty/pexecute.c
libiberty/physmem.c
libiberty/putenv.c
libiberty/regex.c
libiberty/rust-demangle.c
libiberty/safe-ctype.c
libiberty/setenv.c
libiberty/setproctitle.c
libiberty/sha1.c
libiberty/simple-object-coff.c
libiberty/simple-object-common.h
libiberty/simple-object-elf.c
libiberty/simple-object-mach-o.c
libiberty/simple-object-xcoff.c
libiberty/simple-object.c
libiberty/snprintf.c
libiberty/sort.c
libiberty/spaces.c
libiberty/splay-tree.c
libiberty/stack-limit.c
libiberty/stpcpy.c
libiberty/stpncpy.c
libiberty/strndup.c
libiberty/strtod.c
libiberty/strverscmp.c
libiberty/testsuite/Makefile.in
libiberty/testsuite/demangle-expected
libiberty/testsuite/demangler-fuzzer.c
libiberty/testsuite/rust-demangle-expected
libiberty/testsuite/test-demangle.c
libiberty/testsuite/test-expandargv.c
libiberty/testsuite/test-pexecute.c
libiberty/testsuite/test-strtol.c
libiberty/timeval-utils.c
libiberty/unlink-if-ordinary.c
libiberty/vasprintf.c
libiberty/vfprintf.c
libiberty/vprintf-support.c
libiberty/vprintf-support.h
libiberty/vsnprintf.c
libiberty/vsprintf.c
libiberty/xasprintf.c
libiberty/xexit.c
libiberty/xmalloc.c
libiberty/xstrndup.c
libiberty/xvasprintf.c

index 9706da7c44dfc2d6fa224bff8d7110ef656af6ff..b1189ea21756a205066c9f37f3f23d64c50949ab 100644 (file)
@@ -1,3 +1,40 @@
+2020-01-17  Nick Clifton  <nickc@redhat.com>
+
+       * Import from gcc mainline:
+       2019-06-10  Martin Liska  <mliska@suse.cz>
+
+       * ansidecl.h (ATTRIBUTE_WARN_UNUSED_RESULT): New macro.
+       * libiberty.h (xmalloc): Use it.
+       (xrealloc): Likewise.
+       (xcalloc): Likewise.
+       (xstrdup): Likewise.
+       (xstrndup): Likewise.
+       (xmemdup): Likewise.
+
+       2019-06-10  Martin Liska  <mliska@suse.cz>
+
+       * ansidecl.h:
+       (ATTRIBUTE_RESULT_SIZE_1): Define new macro.
+       (ATTRIBUTE_RESULT_SIZE_2): Likewise.
+       (ATTRIBUTE_RESULT_SIZE_1_2): Likewise.
+       * libiberty.h (xmalloc): Add RESULT_SIZE attribute.
+       (xrealloc): Likewise.
+       (xcalloc): Likewise.
+
+       2019-11-16  Tim Ruehsen  <tim.ruehsen@gmx.de>
+
+       * demangle.h (struct demangle_component): Add member
+       d_counting.
+
+       2019-11-16  Eduard-Mihai Burtescu  <eddyb@lyken.rs>
+
+       * demangle.h (rust_demangle_callback): Add.
+
+       2019-07-18  Eduard-Mihai Burtescu  <eddyb@lyken.rs>
+
+       * demangle.h (rust_is_mangled): Move to libiberty/rust-demangle.h.
+       (rust_demangle_sym): Move to libiberty/rust-demangle.h.
+
 2020-01-16  Andre Vieira  <andre.simoesdiasvieira@arm.com>
 
        PR 25376
index e3f8ba72671ee4f580abb328f4f18d6e78d46322..ec7a13f016ae29050cbdf78601df3429a0beea46 100644 (file)
@@ -292,6 +292,40 @@ So instead we use the macro below and test it against specific values.  */
 # endif
 #endif
 
+/* Attribute `alloc_size' was valid as of gcc 4.3.  */
+#ifndef ATTRIBUTE_RESULT_SIZE_1
+# if (GCC_VERSION >= 4003)
+#  define ATTRIBUTE_RESULT_SIZE_1 __attribute__ ((alloc_size (1)))
+# else
+#  define ATTRIBUTE_RESULT_SIZE_1
+#endif
+#endif
+
+#ifndef ATTRIBUTE_RESULT_SIZE_2
+# if (GCC_VERSION >= 4003)
+#  define ATTRIBUTE_RESULT_SIZE_2 __attribute__ ((alloc_size (2)))
+# else
+#  define ATTRIBUTE_RESULT_SIZE_2
+#endif
+#endif
+
+#ifndef ATTRIBUTE_RESULT_SIZE_1_2
+# if (GCC_VERSION >= 4003)
+#  define ATTRIBUTE_RESULT_SIZE_1_2 __attribute__ ((alloc_size (1, 2)))
+# else
+#  define ATTRIBUTE_RESULT_SIZE_1_2
+#endif
+#endif
+
+/* Attribute `warn_unused_result' was valid as of gcc 3.3.  */
+#ifndef ATTRIBUTE_WARN_UNUSED_RESULT
+# if GCC_VERSION >= 3003
+#  define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
+# else
+#  define ATTRIBUTE_WARN_UNUSED_RESULT
+# endif
+#endif
+
 /* We use __extension__ in some places to suppress -pedantic warnings
    about GCC extensions.  This feature didn't work properly before
    gcc 2.8.  */
index 15643629958640a33cd20926ee723cedeb1efcc1..a7f11f59205d4f51ee22931d19afd4ffcf3d8ff0 100644 (file)
@@ -159,24 +159,11 @@ ada_demangle (const char *mangled, int options);
 extern char *
 dlang_demangle (const char *mangled, int options);
 
-/* Returns non-zero iff MANGLED is a rust mangled symbol.  MANGLED must
-   already have been demangled through cplus_demangle_v3.  If this function
-   returns non-zero then MANGLED can be demangled (in-place) using
-   RUST_DEMANGLE_SYM.  */
 extern int
-rust_is_mangled (const char *mangled);
-
-/* Demangles SYM (in-place) if RUST_IS_MANGLED returned non-zero for SYM.
-   If RUST_IS_MANGLED returned zero for SYM then RUST_DEMANGLE_SYM might
-   replace characters that cannot be demangled with '?' and might truncate
-   SYM.  After calling RUST_DEMANGLE_SYM SYM might be shorter, but never
-   larger.  */
-extern void
-rust_demangle_sym (char *sym);
-
-/* Demangles MANGLED if it was GNU_V3 and then RUST mangled, otherwise
-   returns NULL. Uses CPLUS_DEMANGLE_V3, RUST_IS_MANGLED and
-   RUST_DEMANGLE_SYM.  Returns a new string that is owned by the caller.  */
+rust_demangle_callback (const char *mangled, int options,
+                        demangle_callbackref callback, void *opaque);
+
+
 extern char *
 rust_demangle (const char *mangled, int options);
 
@@ -481,6 +468,7 @@ struct demangle_component
      Initialize to zero.  Private to d_print_comp.
      All other fields are final after initialization.  */
   int d_printing;
+  int d_counting;
 
   union
   {
index 267b6ec5280d1a44ce7c5e6aaf3523a64056d63b..141cb886a85000f86080342f90ea6c44c8720bb3 100644 (file)
@@ -137,6 +137,10 @@ extern const char *unix_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRI
 
 extern char *lrealpath (const char *);
 
+/* Return true when FD file descriptor exists.  */
+
+extern int is_valid_fd (int fd);
+
 /* Concatenate an arbitrary number of strings.  You must pass NULL as
    the last argument of this function, to terminate the list of
    strings.  Allocates memory using xmalloc.  */
@@ -310,30 +314,30 @@ extern void xmalloc_failed (size_t) ATTRIBUTE_NORETURN;
    message to stderr (using the name set by xmalloc_set_program_name,
    if any) and then call xexit.  */
 
-extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_RESULT_SIZE_1 ATTRIBUTE_WARN_UNUSED_RESULT;
 
 /* Reallocate memory without fail.  This works like xmalloc.  Note,
    realloc type functions are not suitable for attribute malloc since
    they may return the same address across multiple calls. */
 
-extern void *xrealloc (void *, size_t) ATTRIBUTE_RETURNS_NONNULL;
+extern void *xrealloc (void *, size_t) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_RESULT_SIZE_2 ATTRIBUTE_WARN_UNUSED_RESULT;
 
 /* Allocate memory without fail and set it to zero.  This works like
    xmalloc.  */
 
-extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_RESULT_SIZE_1_2 ATTRIBUTE_WARN_UNUSED_RESULT;
 
 /* Copy a string into a memory buffer without fail.  */
 
-extern char *xstrdup (const char *) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern char *xstrdup (const char *) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_WARN_UNUSED_RESULT;
 
 /* Copy at most N characters from string into a buffer without fail.  */
 
-extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_WARN_UNUSED_RESULT;
 
 /* Copy an existing memory buffer to a new memory buffer without fail.  */
 
-extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL;
+extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_WARN_UNUSED_RESULT;
 
 /* Physical memory routines.  Return values are in BYTES.  */
 extern double physmem_total (void);
@@ -649,7 +653,7 @@ extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
 
 extern char *xasprintf (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_PRINTF_1;
 
-#if !HAVE_DECL_VASPRINTF
+#if defined(HAVE_DECL_VASPRINTF) && !HAVE_DECL_VASPRINTF
 /* Like vsprintf but provides a pointer to malloc'd storage, which
    must be freed by the caller.  */
 
index 95cb1525f2c4c1e7a3ddb73e4c90a96ce753f3e1..c2bab93a1517ae08b9b4225f9daf8384e44cca09 100644 (file)
@@ -1,3 +1,103 @@
+2020-01-01  Jakub Jelinek  <jakub@redhat.com>
+
+       Update copyright years.
+
+2019-12-06  Tim Ruehsen  <tim.ruehsen@gmx.de>
+
+       * make-relative-prefix.c (split_directories):
+       Return early on empty 'name'
+
+2019-11-16  Tim Ruehsen  <tim.ruehsen@gmx.de>
+
+       * 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  <eddyb@lyken.rs>
+
+       * 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  <saldivarcher@gmail.com>
+
+       * testsuite/demangle-expected: Fix test.
+
+2019-11-04  Kamlesh Kumar  <kamleshbhalui@gmail.com>
+
+       * cp-demangle.c (d_expr_primary): Handle
+       nullptr demangling.
+       * testsuite/demangle-expected: Added test.
+
+2019-10-29 Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+       * cp-demangle.c (d_number): Avoid signed int overflow.
+
+2019-10-28  Miguel Saldivar  <saldivarcher@gmail.com>
+
+       * 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  <eddyb@lyken.rs>
+
+       * 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  <eddyb@lyken.rs>
+
+       * 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  <mliska@suse.cz>
+
+       PR lto/91478
+       * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
+       First find a WEAK HIDDEN symbol in symbol table that will be
+       preserved.  Later, use the symbol name for all removed symbols.
+
+2019-08-12  Martin Liska  <mliska@suse.cz>
+
+       * Makefile.in: Add filedescriptor.c.
+       * filedescriptor.c: New file.
+       * lrealpath.c (is_valid_fd): Remove.
+
 2019-08-08  Martin Liska  <mliska@suse.cz>
 
        PR bootstrap/91352
index 0be45b4ae8ec6383f1166665bb32d0b260af2579..fe738d0db435e59717106574a54c9fba67e9ec31 100644 (file)
@@ -1,7 +1,7 @@
 # Makefile for the libiberty library.
 # Originally written by K. Richard Pixley <rich@cygnus.com>.
 #
-# 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
index d44dc415ed22b5a2cb95b7866370100c351a4ba7..a739f4304f9568546fceb745c674f2f6d2005f74 100644 (file)
@@ -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
index 6444896f995a8e4abfb6a1edc510f3a4bbe1a30b..8c9794db6a211ba5b46f55fa52048633ba8350fa 100644 (file)
@@ -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.
index 5718682f691c7fee77d7bfc7997687272804cffa..6e38e2234dc551da56b3835ca60daaf70bf75f67 100644 (file)
@@ -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.
index 72c1b710bd8bf7dbfe321a5ed3dbf89fa3e36183..49a2faaa51bb6d6c28c611e52d05f656ea25dadd 100644 (file)
@@ -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
index a3730714bdc07f3ae38af7d34e7aab89e2d13376..0de74657d0d712efd34595d3d2e05fdd28f27ecd 100644 (file)
@@ -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
index 8eb478b47bcf7ae4fe1d904c862c3c35220b634a..533e4a99b0d8ced71abf8d86c8e2b6f8141c1962 100644 (file)
@@ -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.
index ac733f93adfa710c5b29aaa9ae68da0d8f49747d..ce1cb03cc7d72b807cf2233f0df55cad6f3012b8 100644 (file)
@@ -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
index aa78c86dd443c5078c5f440ebeaafd01ae3cd8ec..3639bfbfd430b487255b03ceaf360ac62ec01273 100644 (file)
@@ -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 <ian@wasabisystems.com>.
 
    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) != '(')
index 92191cf3ea8a45a52f4d63943795b825963ce1aa..943a3ef478e5f7fd4c2e229b8622f518abc92925 100644 (file)
@@ -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 <ian@wasabisystems.com>.
 
    This file is part of the libiberty library, which is part of GCC.
index 950e4dc5522af08d65131ee8a766c0317ff7c770..6e41bad2672e15d551b7030aa769327bae2985d4 100644 (file)
@@ -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 <ian@wasabisystems.com>.
 
    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;
        }
     }
index a39e2bf2ed46eaaee01a95b363b46a70be31fc9f..fb0673d181546a10e954b2691387f31fea3a0705 100644 (file)
@@ -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 *
index 96b12b9b56a720b652dcd11ebd4d5a80b10cccc1..8f7832aa2a872bb6749f32c3b75e5ad31b475125 100644 (file)
@@ -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.
 
index becc402c1f82e68445b134ed4910ff9b664f11ec..a9702858a6ede4dac257ed63fb3ead29ac72c6b1 100644 (file)
@@ -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.
index c97741e4e35a92140fe86aaff7300a057389db83..968d19175328cedd5facac796d258b886d1467f1 100644 (file)
@@ -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.
    
index 441b36bf2406d69da5d0fc0c869a3bd43bc47bbe..e10f691181a89833d5f60fc2bb02e489da1f4bf6 100644 (file)
@@ -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.
index ff45e4191766a93ea64d06e143c1844b3e0b7352..31803e47f722f9ab407a5f893184052d840a0c2d 100644 (file)
@@ -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
index 1449e7fd3dd85471c86d38eb10742ca24c9c6907..b89722810069f3d3532f2c1a990b2f9cade171d2 100644 (file)
@@ -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 (file)
index 0000000..ba2e87c
--- /dev/null
@@ -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 <fcntl.h>
+#endif
+
+#if defined (_WIN32)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h> /* 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
+}
index d111066d3935bd37d64581247953b0beb1fd1e57..68fb06f9458f27b29cf46732a87cdb2eb7099edd 100644 (file)
@@ -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
index 8632253b4c14f4341384c814db8dc48d9de0f683..2fd5e688ec4177ca91cdf2cd4d92b3ac34ffe409 100644 (file)
@@ -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.
 
index 50fe2e8da8c5f251643a990110fb00a0beaa3589..7be51aed03b150260ec283c1a08be8b51a463569 100644 (file)
@@ -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).
index 05efad43ebc6cdc7a8cfaed1249dd6f2dc66b455..b8c426b8eae5bba490d780b252ba0e1989230587 100644 (file)
@@ -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 <ghazi@caip.rutgers.edu>.
 
 This file is part of the libiberty library.
index 94a1212fe73a088b0f2ad2ab4a70ea58c3addc22..01f1e0bf325871409db9fe7e7ce5272a54d499e5 100644 (file)
@@ -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
index 1ad4d505a04f2e1df2419e54e3209abb4a8c1f34..7119b621c12a695852c1c7586b153cc961d665ca 100644 (file)
@@ -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).
index 33e0bda21bafaa844fc56d67bb00af8b7625f0a9..87242472e86eae1246e3fe67fca4060049eaa67a 100644 (file)
@@ -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).
index 0900a19dfba64f37fa92fc2a80225982ae34eb00..f9f7841a743909405dcc00aaa906f963f4e98cba 100644 (file)
@@ -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
index 9f917c3571d96a6ebd1e472f85bb85787f715a6c..26c98ce2d6865939d0f9c723cac23bd8efeb8b40 100644 (file)
@@ -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.
index 67ce13cdb500fec88d8edb800309642d17b3f5fa..f2b57e3b817a9b042175c746f734e9588be79e24 100644 (file)
@@ -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
index 7aefbb493613219d82209ab65677ba1d064727a4..6715b20858edf4150907d882fa6983cc74c33286 100644 (file)
@@ -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
index bf870d9c62e0121a9dc847d046402019b6b257f8..01751be39d9dcfec7896847a9c84629b1bb7d288 100644 (file)
@@ -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
index ac914a7a4f403b09c90416c8e1fa3c6b52c1b48a..d6694c40349916b706d5ba05123d3a9059be3389 100644 (file)
@@ -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 <string.h>
 #endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#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
-}
index f100dd4a0d7bb05c8553cb50cc001d9ffed73ec1..c27c3a4fc86756ba28dac210ee9ef95dbb86a32c 100644 (file)
@@ -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
index ec0b0ee74940831f760f0c9857b544df23c42baa..e3f9f920df4a2b4a8be00e88727d74a42ed46eea 100644 (file)
@@ -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;
index 2c66e35cc1f515ba16f5c2a6a9d03b66ebb20fc1..cb08c27af6f4534be0116224946d036ecd5a8418 100644 (file)
@@ -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
index 54875a382685f61b24e387ca84afceca1bba96d3..755b8ff9f8d89823d3e606ccef621983a1c28f8a 100644 (file)
@@ -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).
index e45af443ea8c3b8ae4de2f933c8edba359a0842a..1e26c8bc2a51df27eed786e671387f7e705507d1 100644 (file)
@@ -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
index 1cc569c6902dbe317efc8655131103bc5a4be94f..a65a55703f9167bc1435c7167b9d94e0b6342ac5 100644 (file)
@@ -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 <ghazi@caip.rutgers.edu>.
 
 This file is part of the libiberty library.
index b57880ef0ed7a07baf1c67ba67dbfbeaad28697b..18d879ac87670a7623956d8368f16998d81248c4 100644 (file)
@@ -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
index f6c65a2f71f5a1a99b0f086040782212ed493a52..131598f37f4e2755ee6ad25768368c445eab5557 100644 (file)
@@ -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
index 3e1d160700bbc8b25e6576f99f4d2438dc8b687c..0a4e57ee4c4b172601c0458d59e4c15d7f1b0b12 100644 (file)
@@ -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
index 37011b867ea6b5413554cab7e85045bbab7a5299..2e17515f2d61a483fedf475dc487658024458a11 100644 (file)
@@ -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.
index 5f3a9628ed68a7e7dfdb8b5df8a2d6fb5fcb02f7..30cd9040d967d85d51c0f91142d4af782de197ad 100644 (file)
@@ -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 <ian@airs.com>.
 
 This file is part of the libiberty library.
index b5aa87737ed0617e825cd047ae437d7c046e74f1..54dd1a12493f4fa243cc35b13bc01922e71063ef 100644 (file)
@@ -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
index 847cd15020508ecedc792d96e76b99199d777597..35118089b46fc7fdf5b1bb67477334e79623db25 100644 (file)
@@ -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
index c7fa8a325d7d7c9bd3c9dc55b5e65666d6b97a31..67a4733d49acfb9ff36ea47408dbbe52cc43f50b 100644 (file)
@@ -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
index b26da672d18344dc83b470d6aa76f00744303d39..2dcf6c07ffffa91558b36a5e0d31561f52928a55 100644 (file)
@@ -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
index f9e5277897bf6bd2d4aec0869375932bf568bd27..684a49ace606ea5a7d824051b9c482f691292d82 100644 (file)
@@ -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
index 0c69a250319a2b3ff8ae82567443f06aecd0e274..331067b5078347912bc3828186629a52244aa1b9 100644 (file)
@@ -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
index b951d908b2e855923d3708cf1db4a7536c369b3d..2dfcdda68d4f7463d0fa07de10efe1dc3163d93c 100644 (file)
@@ -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
index e2d393b3cf736872e62218cc19795d5307c2c542..f9427168a66c89da815e65d850ce71314347d9ee 100644 (file)
@@ -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
index f0f2ca37e28f8f5ac3d3d008aa9c0d7213a748ae..f3ddf83933fae282a781c8fac1d42e43e6d53a3f 100644 (file)
@@ -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
index 07b8ac832dcd8470fee336ac51cce4570b8d07b4..7d2031994f79ee2d511b51f641a2a673d7231f26 100644 (file)
@@ -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
index 2302db45b6fbce2798721298f64149a3d3cb68ef..b87365c85fe920b6ccb6346b2889a782d5f86a7b 100644 (file)
@@ -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 <http://www.gnu.org/licenses/>.  */
 
 #include "safe-ctype.h"
 
+#include <inttypes.h>
 #include <sys/types.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #ifdef HAVE_STRING_H
 #include <string.h>
@@ -47,303 +49,484 @@ extern void *memset(void *s, int c, size_t n);
 
 #include <demangle.h>
 #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:
-     <std::sys::fd::FileDesc as core::ops::Drop>::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;
 }
index 1877898ccc333bce20e7b950358326e92a435d69..56364e6ecd23e49e157860bc312e8e5e44b55fad 100644 (file)
@@ -1,6 +1,6 @@
 /* <ctype.h> replacement macros.
 
-   Copyright (C) 2000-2019 Free Software Foundation, Inc.
+   Copyright (C) 2000-2020 Free Software Foundation, Inc.
    Contributed by Zack Weinberg <zackw@stanford.edu>.
 
 This file is part of the libiberty library.
index 2ceabe1317e85beb555cea92e6551d59ff67bbe1..82bf1b83600fae86c7f9eee99fffaf7bfc157ef3 100644 (file)
@@ -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
index 1d3fafbf0a3cee8f909879f6c9267264f04555d5..3de50f67593382a87581c82a608d203cab6d2f32 100644 (file)
@@ -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
index f56f803ba2bb59698084dded1c4b188e737b92f3..af08219b1b049cabdf20a0c8ab57994939dd9da0 100644 (file)
@@ -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
index f299f5afbb713e7ad4c6d86497d5088144783a91..104cd560f61cbe502622d7fea8c014ac050dbc4a 100644 (file)
@@ -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
index ddcefc4ee09c2bd8b96c2ffae2468edba8f9494b..2e3f1873468acb0aea66728935c2dfde7e9c5c64 100644 (file)
@@ -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
index 7515926659694ba930aa0a7d1a22e84b05c117c8..c62d5bba551c099e9f33c3a0b33dd4612952411c 100644 (file)
@@ -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)
index 03283a0e3d82cba5e63147152b513c5e3f3dcc4e..14f53428643edd927953067f26fc21f15b8e0eb2 100644 (file)
@@ -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
index 60676567e8e8859d6f18201a0d449f42607f7799..d874de258f5ed7c455f79a0768077e447eca7004 100644 (file)
@@ -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
index b00c265128c9dbca6984cea556af010df99f5427..d9c648af71783ef41b7277df9728bfa896aec1d7 100644 (file)
@@ -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
index a6feccf02027c4b426a3c11e5ad33abbc5408da0..2ab931e60b03c066938f7705fa1da0d7343d4520 100644 (file)
@@ -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 <ghazi@caip.rutgers.edu>.
 
 This file is part of the libiberty library.  This library is free
index 0267fdb230e3bdae067211de767a5b0c83298c1d..fd8f926a8deed83aa574f20b978fa799b5ff74da 100644 (file)
@@ -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 <mark@codesourcery.com>.
 
 This file is part of GNU CC.
index 6e35d2237f84e48bfce85bf71f71636561f4ca41..d97390b2ddce15721479afaaaae00ba062d9e101 100644 (file)
@@ -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
index 4bbb39a62ca476de7dd63b5ee592373e7a9a51a2..3b7b810388ce67b15b419cfb7d165f03b7552890 100644 (file)
@@ -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.
index aabe016e7a856782494a43f59da1e6b4d02eddd4..390adf32a4cbf03bf2652dd2a7ef31fe12e0e1de 100644 (file)
@@ -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
index ee44a7bdd2b79cbda738e506e9eedce5bf798d25..2b0a850637546e3ef65c4f06875bd2d63d120f7a 100644 (file)
@@ -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 <ghazi@caip.rutgers.edu>.
 
 This file is part of the libiberty library.
index 47e0276c7e246fe8d82546d0c660a7e5d8c5a914..641b8f9cf937fef9eefc1e5b06145dc019ec2ca5 100644 (file)
@@ -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 <ghazi@caip.rutgers.edu>.
 
 This file is part of the libiberty library.
index 88c3332e8191e25071de4368f29a899472ad6a26..a7ff3a9bbfc505d9da7ec7b50c119e4309fb6d25 100644 (file)
@@ -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 <ghazi@caip.rutgers.edu>.
 
 This file is part of the libiberty library.
index 7bb11d286a5ae8442175906c9147e92af9b969c4..de8c54cdfe73b02e326cfc691074e5fd4cd706eb 100644 (file)
@@ -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
index 19cf4aeab2ed77a9ee06c45e81e87cbc8d17de37..c31734675fcbc29d3fd23cce57e5cf6c64de0ac2 100644 (file)
@@ -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 <bignolle@ecoledoc.ibp.fr>, 1997.
 
index 6b6b970fe0a4ea52c65f6d379065dd0d59360cc6..1f05557a153557e9091f5b0d6e1ec2f2678a284a 100644 (file)
@@ -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
index f21ed00e559a235d5d6183ac7bc44f7495e2f3ce..5878d96dee326f5ff39eadd7798b960d67cf52ae 100644 (file)
@@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof ((*((Y*)(0)))+(*((Y*)(0))))>*)
 #
 --format=gnu-v3
 _Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE
-void baz<int>(A<sizeof (foo((int)(), (floatcomplex )00000000_00000000))>*)
+void baz<int>(A<sizeof (foo((int)(), (float _Complex)00000000_00000000))>*)
 #
 --format=gnu-v3
 _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
@@ -1446,3 +1446,7 @@ Foo<int>()::X::fn
 _ZZZ3FooIiEfvENKUlT_E_clIcEEDaS0_EN1X2fnEv
 Foo<int>()::{lambda(auto:1)#1}::operator()<char>(char) const::X::fn()
 Foo<int>()::{lambda(auto:1)#1}::operator()<char>(char) const::X::fn
+#PR91979 demangling nullptr expression
+
+_Z3fooILPv0EEvPN9enable_ifIXeqT_LDnEEvE4typeE
+void foo<(void*)0>(enable_if<((void*)0)==((decltype(nullptr))), void>::type*)
index c291e6c12e3848ff30dff024d760e701c38d65d7..9e35caa142e42567c11b32dd5edcc51d6171ddfd 100644 (file)
@@ -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.
 
index 0b4288fc37d70548e93a2233cbeaaecd1929bf55..74774794736a8ae1dde4e2ff59fed5a4da46b8d2 100644 (file)
@@ -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
 <core::ptr::Unique<T> as core::ops::Deref>::deref
+#
+--format=rust
+_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h059a991a004536adE
+issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo
index 9943b1cc72dde07261e6ad5f975f5e509dcb8081..eb3bcbde608940669fb861a8d626be7be10fe66a 100644 (file)
@@ -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 <zack@codesourcery.com
 
    This file is part of GNU libiberty.
index 234de9ae6bdc0eaf57807ac9a56648ca76380518..66bc010434d6e26a3252985de88289b46ced50cd 100644 (file)
@@ -1,5 +1,5 @@
 /* expandargv test program,
-   Copyright (C) 2006-2019 Free Software Foundation, Inc.
+   Copyright (C) 2006-2020 Free Software Foundation, Inc.
    Written by Carlos O'Donell <carlos@codesourcery.com>
 
    This file is part of the libiberty library, which is part of GCC.
index a92fae7a62e1db8139e0ea93a97d4c1c2482ba62..30c990dfae90ad0a95683a351bc34e3d966d6b46 100644 (file)
@@ -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 <ian@airs.com>.
 
    This file is part of GNU libiberty.
index 28cce83feb1b268523985973599aa89d9802e612..fd5f89d2a43fff7efd4cb82beaa020c9fd530162 100644 (file)
@@ -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 <y.gribov@samsung.com>
 
    This file is part of the libiberty library, which is part of GCC.
index 90dc765e2a61c107dfd80c8495504247ac28ad0a..ee46b5633e1c23ae1064912c35d8f07ab8889e4b 100644 (file)
@@ -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
index dbaf31d804e9478b05869b359536069ebfba43c1..b4d6f0a84183920cddbda1aae54a24763ec8c646 100644 (file)
@@ -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
index cc04248b5cddf42dc46b2b45553dda66148f73bc..0bdd41a5e31fc612a184037152d0fb22ba6957cd 100644 (file)
@@ -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
index 2fb6bf07090bea32c7dbfc680655f38d560433f9..433d12db66d61c240b0bc79aa598a3d4bb41f783 100644 (file)
@@ -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"
index aabc3d2ef040db9c9959f30f2d3ac3a0d6033662..52e7378ea96c7856060e6e0e1069552a8d66425e 100644 (file)
@@ -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
index 51c2decd800ea0f9f6cf76fa00cacc33bbc585ef..ea689df6d1673efaf9335b169be562667704a621 100644 (file)
@@ -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
index 647fb7a35793a8cd5b07177f0eaefcd807ac266e..76a7711d1ea8338d9991d7a1d5aaf28b16b98326 100644 (file)
@@ -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 <ghazi@caip.rutgers.edu>.
 
 This file is part of the libiberty library.  This library is free
index a2ec5aef91ad9e9199b732e8aa9bf53caa0786be..633756956541a014f47104a7e22601cb06fdd95a 100644 (file)
@@ -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
index 5af97e4eb49d50d1d51c4381b0c98f4771454702..76fb4b34d406fb25867dc97c97843986d91b7a92 100644 (file)
@@ -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.
index 7cbebc8420fb28eeb2eda3d0259b8ba9622815f6..268aef159569187ab4a887e4c6a2e8c90998ae97 100644 (file)
@@ -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
index e39ab3b9f9c4267d0010269da0f8eaf699e8711a..96d51b57780e6197a4243ae8d2cc633e55f00009 100644 (file)
@@ -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
index bb0b512dce58ccd8c1f8c4ff163cba2b9212d37a..32ba832427cfe0f5c6cbdf0ced4bc0150a168c8f 100644 (file)
@@ -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 <ghazi@caip.rutgers.edu>.
 
 This file is part of the libiberty library.
index c4ab52e34c6ee64c097d1d1b8b31b4ba2dcf1ab9..1ac513e189f417275df36be9cdd4c05026a2b108 100644 (file)
@@ -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.
This page took 0.07581 seconds and 4 git commands to generate.