Update libiberty sources with changes in the gcc mainline.

+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
This commit is contained in:
Nick Clifton 2020-01-17 14:13:22 +00:00
parent bf8e4b6c81
commit 533da48302
100 changed files with 888 additions and 469 deletions

View 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> 2020-01-16 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 25376 PR 25376

View File

@ -292,6 +292,40 @@ So instead we use the macro below and test it against specific values. */
# endif # endif
#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 /* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before about GCC extensions. This feature didn't work properly before
gcc 2.8. */ gcc 2.8. */

View File

@ -159,24 +159,11 @@ ada_demangle (const char *mangled, int options);
extern char * extern char *
dlang_demangle (const char *mangled, int options); 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 extern int
rust_is_mangled (const char *mangled); rust_demangle_callback (const char *mangled, int options,
demangle_callbackref callback, void *opaque);
/* 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. */
extern char * extern char *
rust_demangle (const char *mangled, int options); rust_demangle (const char *mangled, int options);
@ -481,6 +468,7 @@ struct demangle_component
Initialize to zero. Private to d_print_comp. Initialize to zero. Private to d_print_comp.
All other fields are final after initialization. */ All other fields are final after initialization. */
int d_printing; int d_printing;
int d_counting;
union union
{ {

View File

@ -137,6 +137,10 @@ extern const char *unix_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRI
extern char *lrealpath (const char *); 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 /* Concatenate an arbitrary number of strings. You must pass NULL as
the last argument of this function, to terminate the list of the last argument of this function, to terminate the list of
strings. Allocates memory using xmalloc. */ 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, message to stderr (using the name set by xmalloc_set_program_name,
if any) and then call xexit. */ 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, /* Reallocate memory without fail. This works like xmalloc. Note,
realloc type functions are not suitable for attribute malloc since realloc type functions are not suitable for attribute malloc since
they may return the same address across multiple calls. */ 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 /* Allocate memory without fail and set it to zero. This works like
xmalloc. */ 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. */ /* 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. */ /* 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. */ /* 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. */ /* Physical memory routines. Return values are in BYTES. */
extern double physmem_total (void); 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; 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 /* Like vsprintf but provides a pointer to malloc'd storage, which
must be freed by the caller. */ must be freed by the caller. */

View 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> 2019-08-08 Martin Liska <mliska@suse.cz>
PR bootstrap/91352 PR bootstrap/91352

View File

@ -1,7 +1,7 @@
# Makefile for the libiberty library. # Makefile for the libiberty library.
# Originally written by K. Richard Pixley <rich@cygnus.com>. # 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. # This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or # 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 \ calloc.c choose-temp.c clock.c concat.c cp-demangle.c \
cp-demint.c cplus-dem.c crc32.c \ cp-demint.c cplus-dem.c crc32.c \
d-demangle.c dwarfnames.c dyn-string.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 \ fnmatch.c fopen_unlocked.c \
getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \ getcwd.c getopt.c getopt1.c getpagesize.c getpwd.c getruntime.c \
gettimeofday.c \ gettimeofday.c \
@ -171,6 +171,7 @@ REQUIRED_OFILES = \
./cp-demint.$(objext) ./crc32.$(objext) ./d-demangle.$(objext) \ ./cp-demint.$(objext) ./crc32.$(objext) ./d-demangle.$(objext) \
./dwarfnames.$(objext) ./dyn-string.$(objext) \ ./dwarfnames.$(objext) ./dyn-string.$(objext) \
./fdmatch.$(objext) ./fibheap.$(objext) \ ./fdmatch.$(objext) ./fibheap.$(objext) \
./filedescriptor.$(objext) \
./filename_cmp.$(objext) ./floatformat.$(objext) \ ./filename_cmp.$(objext) ./floatformat.$(objext) \
./fnmatch.$(objext) ./fopen_unlocked.$(objext) \ ./fnmatch.$(objext) ./fopen_unlocked.$(objext) \
./getopt.$(objext) ./getopt1.$(objext) ./getpwd.$(objext) \ ./getopt.$(objext) ./getopt1.$(objext) ./getpwd.$(objext) \
@ -756,6 +757,17 @@ $(CONFIGURED_OFILES): stamp-picdir stamp-noasandir
else true; fi else true; fi
$(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION) $(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 \ ./filename_cmp.$(objext): $(srcdir)/filename_cmp.c config.h $(INCDIR)/ansidecl.h \
$(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/safe-ctype.h

View File

@ -1,5 +1,5 @@
/* Provide a version of _doprnt in terms of fprintf. /* 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 Contributed by Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* Create and destroy argument vectors (argv's) /* 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 Written by Fred Fish @ Cygnus Support
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,6 +1,6 @@
/* Like sprintf but provides a pointer to malloc'd storage, which must /* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. 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. Contributed by Cygnus Solutions.
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,5 +1,5 @@
/* Utility to pick a temporary filename prefix. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* ANSI-compatible clock function. /* 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 This file is part of the libiberty library. This library is free
software; you can redistribute it and/or modify it under the software; you can redistribute it and/or modify it under the

View File

@ -1,5 +1,5 @@
/* Concatenate variable number of strings. /* 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 Written by Fred Fish @ Cygnus Support
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -5,7 +5,7 @@
@center Version 2.1, February 1999 @center Version 2.1, February 1999
@display @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 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies

View File

@ -1,5 +1,5 @@
/* Demangler for g++ V3 ABI. /* 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>. Written by Ian Lance Taylor <ian@wasabisystems.com>.
This file is part of the libiberty library, which is part of GCC. 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 static void
d_print_init (struct d_print_info *, demangle_callbackref, 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 *); 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) if (p == NULL || s == NULL || len <= 0)
return 0; return 0;
p->d_printing = 0; p->d_printing = 0;
p->d_counting = 0;
p->type = DEMANGLE_COMPONENT_NAME; p->type = DEMANGLE_COMPONENT_NAME;
p->u.s_name.s = s; p->u.s_name.s = s;
p->u.s_name.len = len; 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) if (p == NULL || args < 0 || name == NULL)
return 0; return 0;
p->d_printing = 0; p->d_printing = 0;
p->d_counting = 0;
p->type = DEMANGLE_COMPONENT_EXTENDED_OPERATOR; p->type = DEMANGLE_COMPONENT_EXTENDED_OPERATOR;
p->u.s_extended_operator.args = args; p->u.s_extended_operator.args = args;
p->u.s_extended_operator.name = name; 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) || (int) kind > gnu_v3_object_ctor_group)
return 0; return 0;
p->d_printing = 0; p->d_printing = 0;
p->d_counting = 0;
p->type = DEMANGLE_COMPONENT_CTOR; p->type = DEMANGLE_COMPONENT_CTOR;
p->u.s_ctor.kind = kind; p->u.s_ctor.kind = kind;
p->u.s_ctor.name = name; 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) || (int) kind > gnu_v3_object_dtor_group)
return 0; return 0;
p->d_printing = 0; p->d_printing = 0;
p->d_counting = 0;
p->type = DEMANGLE_COMPONENT_DTOR; p->type = DEMANGLE_COMPONENT_DTOR;
p->u.s_dtor.kind = kind; p->u.s_dtor.kind = kind;
p->u.s_dtor.name = name; p->u.s_dtor.name = name;
@ -937,6 +941,7 @@ d_make_empty (struct d_info *di)
return NULL; return NULL;
p = &di->comps[di->next_comp]; p = &di->comps[di->next_comp];
p->d_printing = 0; p->d_printing = 0;
p->d_counting = 0;
++di->next_comp; ++di->next_comp;
return p; return p;
} }
@ -1717,7 +1722,7 @@ d_number (struct d_info *di)
} }
if (ret > ((INT_MAX - (peek - '0')) / 10)) if (ret > ((INT_MAX - (peek - '0')) / 10))
return -1; return -1;
ret = ret * 10 + peek - '0'; ret = ret * 10 + (peek - '0');
d_advance (di, 1); d_advance (di, 1);
peek = d_peek_char (di); 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) && type->u.s_builtin.type->print != D_PRINT_DEFAULT)
di->expansion -= type->u.s_builtin.type->len; 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 /* Rather than try to interpret the literal value, we just
collect it as a string. Note that it's possible to have a collect it as a string. Note that it's possible to have a
floating point literal here. The ABI specifies that the 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 static void
d_count_templates_scopes (struct d_print_info *dpi, 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; return;
++ dc->d_counting;
switch (dc->type) switch (dc->type)
{ {
case DEMANGLE_COMPONENT_NAME: case DEMANGLE_COMPONENT_NAME:
@ -4202,7 +4220,7 @@ d_count_templates_scopes (struct d_print_info *dpi,
static void static void
d_print_init (struct d_print_info *dpi, demangle_callbackref callback, 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->len = 0;
dpi->last_char = '\0'; dpi->last_char = '\0';
@ -5977,10 +5995,10 @@ d_print_mod (struct d_print_info *dpi, int options,
d_append_string (dpi, "&&"); d_append_string (dpi, "&&");
return; return;
case DEMANGLE_COMPONENT_COMPLEX: case DEMANGLE_COMPONENT_COMPLEX:
d_append_string (dpi, "complex "); d_append_string (dpi, " _Complex");
return; return;
case DEMANGLE_COMPONENT_IMAGINARY: case DEMANGLE_COMPONENT_IMAGINARY:
d_append_string (dpi, "imaginary "); d_append_string (dpi, " _Imaginary");
return; return;
case DEMANGLE_COMPONENT_PTRMEM_TYPE: case DEMANGLE_COMPONENT_PTRMEM_TYPE:
if (d_last_char (dpi) != '(') if (d_last_char (dpi) != '(')

View File

@ -1,5 +1,5 @@
/* Internal demangler interface for g++ V3 ABI. /* 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>. Written by Ian Lance Taylor <ian@wasabisystems.com>.
This file is part of the libiberty library, which is part of GCC. This file is part of the libiberty library, which is part of GCC.

View File

@ -1,5 +1,5 @@
/* Demangler component interface functions. /* 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>. Written by Ian Lance Taylor <ian@wasabisystems.com>.
This file is part of the libiberty library, which is part of GCC. 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.left = left;
p->u.s_binary.right = right; p->u.s_binary.right = right;
p->d_printing = 0; p->d_printing = 0;
p->d_counting = 0;
return 1; return 1;
} }
@ -149,6 +150,7 @@ cplus_demangle_fill_builtin_type (struct demangle_component *p,
p->type = DEMANGLE_COMPONENT_BUILTIN_TYPE; p->type = DEMANGLE_COMPONENT_BUILTIN_TYPE;
p->u.s_builtin.type = &cplus_demangle_builtin_types[i]; p->u.s_builtin.type = &cplus_demangle_builtin_types[i];
p->d_printing = 0; p->d_printing = 0;
p->d_counting = 0;
return 1; return 1;
} }
} }
@ -176,6 +178,7 @@ cplus_demangle_fill_operator (struct demangle_component *p,
p->type = DEMANGLE_COMPONENT_OPERATOR; p->type = DEMANGLE_COMPONENT_OPERATOR;
p->u.s_operator.op = &cplus_demangle_operators[i]; p->u.s_operator.op = &cplus_demangle_operators[i];
p->d_printing = 0; p->d_printing = 0;
p->d_counting = 0;
return 1; return 1;
} }
} }

View File

@ -1,5 +1,5 @@
/* Demangler for GNU C++ /* 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) Written by James Clark (jjc@jclark.uucp)
Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
Modified by Satish Pai (pai@apollo.hp.com) for HP demangling Modified by Satish Pai (pai@apollo.hp.com) for HP demangling
@ -52,7 +52,6 @@ void * realloc ();
#define CURRENT_DEMANGLING_STYLE options #define CURRENT_DEMANGLING_STYLE options
#include "libiberty.h" #include "libiberty.h"
#include "rust-demangle.h"
enum demangling_styles current_demangling_style = auto_demangling; 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) if ((options & DMGL_STYLE_MASK) == 0)
options |= (int) current_demangling_style & DMGL_STYLE_MASK; 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. */ /* 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); ret = cplus_demangle_v3 (mangled, options);
if (GNU_V3_DEMANGLING) if (ret || 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)
return ret; return ret;
} }
@ -204,27 +196,6 @@ cplus_demangle (const char *mangled, int options)
return (ret); 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. */ /* Demangle ada names. The encoding is documented in gcc/ada/exp_dbug.ads. */
char * char *

View File

@ -1,5 +1,5 @@
/* crc32.c /* 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. This file is part of the libiberty library.

View File

@ -1,5 +1,5 @@
/* Demangler for the D programming language /* 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) Written by Iain Buclaw (ibuclaw@gdcproject.org)
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,5 +1,5 @@
/* Names of various DWARF tags. /* 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. This file is part of GNU CC.

View File

@ -1,5 +1,5 @@
/* An abstract string datatype. /* 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). Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GNU CC. This file is part of GNU CC.

View File

@ -1,5 +1,5 @@
/* Compare two open file descriptors to see if they refer to the same file. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* A Fibonacci heap datatype. /* 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). Contributed by Daniel Berlin (dan@cgsoftware.com).
This file is part of GNU CC. This file is part of GNU CC.

View File

@ -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
}

View File

@ -1,6 +1,6 @@
/* File name comparison routine. /* 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 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 it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* IEEE floating point support routines, for GDB, the GNU Debugger. /* 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. This file is part of GDB.

View 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 NOTE: This source is derived from an old version taken from the GNU C
Library (glibc). Library (glibc).

View File

@ -1,5 +1,5 @@
/* Implement fopen_unlocked and related functions. /* 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>. Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl
# -*- 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. # This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or # Libiberty is free software; you can redistribute it and/or

View File

@ -3,7 +3,7 @@
"Keep this file name-space clean" means, talk to drepper@gnu.org "Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it! 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 NOTE: This source is derived from an old version taken from the GNU C
Library (glibc). Library (glibc).

View File

@ -1,5 +1,5 @@
/* getopt_long and getopt_long_only entry points for GNU getopt. /* 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 NOTE: This source is derived from an old version taken from the GNU C
Library (glibc). Library (glibc).

View File

@ -1,5 +1,5 @@
/* Return time used so far, in microseconds. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* An expandable hash tables datatype. /* 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). Contributed by Vladimir Makarov (vmakarov@cygnus.com).
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,5 +1,5 @@
/* Hex character manipulation support. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/* Libiberty basename. Like basename, but is not overridden by the /* Libiberty basename. Like basename, but is not overridden by the
system C library. 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -24,7 +24,7 @@
@ifinfo @ifinfo
This manual describes the GNU @libib library of utility subroutines. 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 Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 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 @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 Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 under the terms of the GNU Free Documentation License, Version 1.3

View File

@ -1,7 +1,7 @@
/* Libiberty realpath. Like realpath, but more consistent behavior. /* Libiberty realpath. Like realpath, but more consistent behavior.
Based on gdb_realpath from GDB. 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. 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 #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
/* On GNU libc systems the declaration is only visible with _GNU_SOURCE. */ /* On GNU libc systems the declaration is only visible with _GNU_SOURCE. */
#if defined(HAVE_CANONICALIZE_FILE_NAME) \ #if defined(HAVE_CANONICALIZE_FILE_NAME) \
@ -158,16 +155,3 @@ lrealpath (const char *filename)
/* This system is a lost cause, just duplicate the filename. */ /* This system is a lost cause, just duplicate the filename. */
return strdup (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
}

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl
# -*- 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. # This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or # Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* Relative (relocatable) prefix support. /* 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. This file is part of libiberty.
@ -122,6 +122,9 @@ split_directories (const char *name, int *ptr_num_dirs)
const char *p, *q; const char *p, *q;
int ch; int ch;
if (!*name)
return NULL;
/* Count the number of directories. Special case MSDOS disk names as part /* Count the number of directories. Special case MSDOS disk names as part
of the initial directory. */ of the initial directory. */
p = name; p = name;

View File

@ -1,5 +1,5 @@
/* Utility to pick a temporary filename prefix. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/* md5.c - Functions to compute MD5 message digest of files or memory blocks /* 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. 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 NOTE: This source is derived from an old version taken from the GNU C
Library (glibc). Library (glibc).

View 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 file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
/* Implement the mempcpy function. /* 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>. Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. This file is part of the libiberty library.

View 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. 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 The GNU C Library is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* objalloc.c -- routines to allocate memory for objects /* 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. Written by Ian Lance Taylor, Cygnus Solutions.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* obstack.c - subroutines used implicitly by object stack macros /* 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* List implementation of a partition of consecutive integers. /* 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. Contributed by CodeSourcery, LLC.
This file is part of GNU CC. This file is part of GNU CC.

View File

@ -1,5 +1,5 @@
/* Common code for executing a program in a sub-process. /* 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>. Written by Ian Lance Taylor <ian@airs.com>.
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,6 +1,6 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes /* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Shared logic. 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes /* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. DJGPP specialization. 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes /* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Generic MSDOS specialization. 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* Execute a program and wait for a result. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,7 +1,7 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes /* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Generic Unix version with other subprocesses), and wait for it. Generic Unix version
(also used for UWIN and VMS). (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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes /* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. Generic Win32 specialization. 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes /* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it. 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* Calculate the size of physical memory. /* 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 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 it under the terms of the GNU General Public License as published by

View 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. This file based on putenv.c in the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View File

@ -3,7 +3,7 @@
(Implements POSIX draft P1003.2/D11.2, except for some of the (Implements POSIX draft P1003.2/D11.2, except for some of the
internationalization features.) 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* Demangler for the Rust programming language /* 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). Written by David Tolnay (dtolnay@gmail.com).
This file is part of the libiberty library. 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 "safe-ctype.h"
#include <inttypes.h>
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
@ -47,303 +49,484 @@ extern void *memset(void *s, int c, size_t n);
#include <demangle.h> #include <demangle.h>
#include "libiberty.h" #include "libiberty.h"
#include "rust-demangle.h"
struct rust_demangler
/* 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:
"," => $C$
"@" => $SP$
"*" => $BP$
"&" => $RF$
"<" => $LT$
">" => $GT$
"(" => $LP$
")" => $RP$
" " => $u20$
"\"" => $u22$
"'" => $u27$
"+" => $u2b$
";" => $u3b$
"[" => $u5b$
"]" => $u5d$
"{" => $u7b$
"}" => $u7d$
"~" => $u7e$
A double ".." means "::" and a single "." means "-".
The only characters allowed in the mangled symbol are a-zA-Z0-9 and _.:$ */
static const char *hash_prefix = "::h";
static const size_t hash_prefix_len = 3;
static const size_t hash_len = 16;
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);
/* INPUT: sym: symbol that has been through C++ (gnu v3) demangling
This function looks for the following indicators:
1. The hash must consist of "h" followed by 16 lowercase hex digits.
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.
3. There must be no characters other than a-zA-Z0-9 and _.:$
4. There must be no unrecognized $-sign sequences.
5. There must be no sequence of three or more dots in a row ("..."). */
int
rust_is_mangled (const char *sym)
{ {
size_t len, len_without_hash; const char *sym;
size_t sym_len;
if (!sym) void *callback_opaque;
return 0; demangle_callbackref callback;
len = strlen (sym); /* Position of the next character to read from the symbol. */
if (len <= hash_prefix_len + hash_len) size_t next;
/* Not long enough to contain "::h" + hash + something else */
return 0;
len_without_hash = len - (hash_prefix_len + hash_len); /* Non-zero if any error occurred. */
if (!is_prefixed_hash (sym + len_without_hash)) int errored;
return 0;
return looks_like_rust (sym, len_without_hash); /* Non-zero if printing should be verbose (e.g. include hashes). */
int verbose;
/* Rust mangling version, with legacy mangling being -1. */
int version;
};
/* Parsing functions. */
static char
peek (const struct rust_demangler *rdm)
{
if (rdm->next < rdm->sym_len)
return rdm->sym[rdm->next];
return 0;
} }
/* A hash is the prefix "::h" followed by 16 lowercase hex digits. The static char
hex digits must comprise between 5 and 15 (inclusive) distinct next (struct rust_demangler *rdm)
digits. */ {
char c = peek (rdm);
if (!c)
rdm->errored = 1;
else
rdm->next++;
return c;
}
struct rust_mangled_ident
{
/* ASCII part of the identifier. */
const char *ascii;
size_t ascii_len;
};
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;
}
/* Printing functions. */
static void
print_str (struct rust_demangler *rdm, const char *data, size_t len)
{
if (!rdm->errored)
rdm->callback (data, len, rdm->callback_opaque);
}
#define PRINT(s) print_str (rdm, s, strlen (s))
/* Return a 0x0-0xf value if the char is 0-9a-f, and -1 otherwise. */
static int static int
is_prefixed_hash (const char *str) decode_lower_hex_nibble (char nibble)
{ {
const char *end; if ('0' <= nibble && nibble <= '9')
char seen[16]; return nibble - '0';
size_t i; if ('a' <= nibble && nibble <= 'f')
int count; return 0xa + (nibble - 'a');
return -1;
}
if (strncmp (str, hash_prefix, hash_prefix_len)) /* 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;
if (len < 3 || e[0] != '$')
return 0; return 0;
str += hash_prefix_len;
memset (seen, 0, sizeof(seen)); e++;
for (end = str + hash_len; str < end; str++) len--;
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 */ if (e[0] == 'C')
count = 0; {
for (i = 0; i < 16; i++) escape_len = 1;
if (seen[i])
count++;
return count >= 5 && count <= 15; 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;
*out_len = 2 + escape_len;
return c;
} }
static int static void
looks_like_rust (const char *str, size_t len) print_ident (struct rust_demangler *rdm, struct rust_mangled_ident ident)
{ {
const char *end = str + len; char unescaped;
size_t len;
while (str < end) if (rdm->errored)
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;
}
/*
INPUT: sym: symbol for which rust_is_mangled(sym) returned 1.
The input is demangled in-place because the mangled name is always
longer than the demangled one. */
void
rust_demangle_sym (char *sym)
{
const char *in;
char *out;
const char *end;
if (!sym)
return; return;
in = sym; if (rdm->version == -1)
out = sym; {
end = sym + strlen (sym) - (hash_prefix_len + hash_len); /* 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 (in < end) while (ident.ascii_len > 0)
switch (*in) {
{ /* Handle legacy escape sequences ("$...$", ".." or "."). */
case '$': if (ident.ascii[0] == '$')
if (!(unescape (&in, &out, "$C$", ',') {
|| unescape (&in, &out, "$SP$", '@') unescaped
|| unescape (&in, &out, "$BP$", '*') = decode_legacy_escape (ident.ascii, ident.ascii_len, &len);
|| unescape (&in, &out, "$RF$", '&') if (unescaped)
|| unescape (&in, &out, "$LT$", '<') print_str (rdm, &unescaped, 1);
|| unescape (&in, &out, "$GT$", '>') else
|| unescape (&in, &out, "$LP$", '(') {
|| unescape (&in, &out, "$RP$", ')') /* Unexpected escape sequence, print the rest verbatim. */
|| unescape (&in, &out, "$u20$", ' ') print_str (rdm, ident.ascii, ident.ascii_len);
|| unescape (&in, &out, "$u22$", '\"') return;
|| unescape (&in, &out, "$u27$", '\'') }
|| unescape (&in, &out, "$u2b$", '+') }
|| unescape (&in, &out, "$u3b$", ';') else if (ident.ascii[0] == '.')
|| unescape (&in, &out, "$u5b$", '[') {
|| unescape (&in, &out, "$u5d$", ']') if (ident.ascii_len >= 2 && ident.ascii[1] == '.')
|| unescape (&in, &out, "$u7b$", '{') {
|| unescape (&in, &out, "$u7d$", '}') /* ".." becomes "::" */
|| unescape (&in, &out, "$u7e$", '~'))) { PRINT ("::");
/* unexpected escape sequence, not looks_like_rust. */ len = 2;
goto fail; }
} else
break; {
case '_': /* "." becomes "-" */
/* If this is the start of a path component and the next PRINT ("-");
character is an escape sequence, ignore the underscore. The len = 1;
mangler inserts an underscore to make sure the path }
component begins with a XID_Start character. */ }
if ((in == sym || in[-1] == ':') && in[1] == '$') else
in++; {
else /* Print everything before the next escape sequence, at once. */
*out++ = *in++; for (len = 0; len < ident.ascii_len; len++)
break; if (ident.ascii[len] == '$' || ident.ascii[len] == '.')
case '.': break;
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: print_str (rdm, ident.ascii, len);
*out++ = '?'; /* This is pretty lame, but it's hard to do better. */ }
done:
*out = '\0'; 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 static int
unescape (const char **in, char **out, const char *seq, char value) is_legacy_prefixed_hash (struct rust_mangled_ident ident)
{ {
size_t len = strlen (seq); uint16_t seen;
int nibble;
size_t i, count;
if (strncmp (*in, seq, len)) if (ident.ascii_len != 17 || ident.ascii[0] != 'h')
return 0; return 0;
**out = value; seen = 0;
for (i = 0; i < 16; i++)
{
nibble = decode_lower_hex_nibble (ident.ascii[1 + i]);
if (nibble < 0)
return 0;
seen |= (uint16_t)1 << nibble;
}
*in += len; /* Count how many distinct digits were seen. */
*out += 1; count = 0;
while (seen)
{
if (seen & 1)
count++;
seen >>= 1;
}
return 1; return count >= 5;
}
int
rust_demangle_callback (const char *mangled, int options,
demangle_callbackref callback, void *opaque)
{
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++;
if (*p == '_' || ISALNUM (*p))
continue;
if (rdm.version == -1 && (*p == '$' || *p == '.' || *p == ':'))
continue;
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)
{
size_t available, min_new_cap, new_cap;
char *new_ptr;
/* Allocation failed before. */
if (buf->errored)
return;
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 void
str_buf_append (struct str_buf *buf, const char *data, size_t len)
{
str_buf_reserve (buf, len);
if (buf->errored)
return;
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;
success = rust_demangle_callback (mangled, options,
str_buf_demangle_callback, &out);
if (!success)
{
free (out.ptr);
return NULL;
}
str_buf_append (&out, "\0", 1);
return out.ptr;
} }

View File

@ -1,6 +1,6 @@
/* <ctype.h> replacement macros. /* <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>. Contributed by Zack Weinberg <zackw@stanford.edu>.
This file is part of the libiberty library. This file is part of the libiberty library.

View 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. This file based on setenv.c in the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* Set the title of a process. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,7 +1,7 @@
/* sha1.c - Functions to compute SHA1 message digest of files or /* sha1.c - Functions to compute SHA1 message digest of files or
memory blocks according to the NIST specification FIPS-180-1. 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 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 under the terms of the GNU General Public License as published by the

View File

@ -1,5 +1,5 @@
/* simple-object-coff.c -- routines to manipulate COFF object files. /* 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. Written by Ian Lance Taylor, Google.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* simple-object-common.h -- common structs for object file manipulation. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* simple-object-elf.c -- routines to manipulate ELF object files. /* 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. Written by Ian Lance Taylor, Google.
This program is free software; you can redistribute it and/or modify it 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; return errmsg;
} }
/* If we are processing .symtab purge __gnu_lto_slim symbol /* If we are processing .symtab purge any symbols
from it and any symbols in discarded sections. */ in discarded sections. */
if (sh_type == SHT_SYMTAB) if (sh_type == SHT_SYMTAB)
{ {
unsigned entsize = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, unsigned entsize = ELF_FETCH_FIELD (type_functions, ei_class, Shdr,
shdr, sh_entsize, Elf_Addr); shdr, sh_entsize, Elf_Addr);
unsigned strtab = ELF_FETCH_FIELD (type_functions, ei_class, Shdr, unsigned strtab = ELF_FETCH_FIELD (type_functions, ei_class, Shdr,
shdr, sh_link, Elf_Word); shdr, sh_link, Elf_Word);
unsigned char *strshdr = shdrs + (strtab - 1) * shdr_size; size_t prevailing_name_idx = 0;
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;
unsigned char *ent; unsigned char *ent;
unsigned *shndx_table = NULL; 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. */ /* Read the section index table if present. */
if (symtab_indices_shndx[i - 1] != 0) 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, (unsigned char *)shndx_table,
sidxsz, &errmsg, err); 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) for (ent = buf; ent < buf + length; ent += entsize)
{ {
unsigned st_shndx = ELF_FETCH_FIELD (type_functions, ei_class, 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) if (st_shndx == SHN_XINDEX)
st_shndx = type_functions->fetch_Elf_Word st_shndx = type_functions->fetch_Elf_Word
((unsigned char *)(shndx_table + (ent - buf) / entsize)); ((unsigned char *)(shndx_table + (ent - buf) / entsize));
/* Eliminate all COMMONs - this includes __gnu_lto_v1 /* Eliminate all COMMONs - this includes __gnu_lto_slim
and __gnu_lto_slim which otherwise cause endless which otherwise cause endless LTO plugin invocation.
LTO plugin invocation. */ FIXME: remove the condition once we remove emission
of __gnu_lto_slim symbol. */
if (st_shndx == SHN_COMMON) if (st_shndx == SHN_COMMON)
discard = 1; discard = 1;
/* We also need to remove symbols refering to sections /* 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 else
{ {
/* Make discarded global symbols hidden weak /* 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; bind = STB_WEAK;
other = STV_HIDDEN; other = STV_HIDDEN;
ELF_SET_FIELD (type_functions, ei_class, Sym, ELF_SET_FIELD (type_functions, ei_class, Sym,
ent, st_name, Elf_Word, ent, st_name, Elf_Word,
gnu_lto - strings); prevailing_name_idx);
ELF_SET_FIELD (type_functions, ei_class, Sym, ELF_SET_FIELD (type_functions, ei_class, Sym,
ent, st_shndx, Elf_Half, SHN_UNDEF); 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, ELF_SET_FIELD (type_functions, ei_class, Sym,
ent, st_shndx, Elf_Half, sh_map[st_shndx]); ent, st_shndx, Elf_Half, sh_map[st_shndx]);
} }
XDELETEVEC (strings);
XDELETEVEC (shndx_table); XDELETEVEC (shndx_table);
} }
else if (sh_type == SHT_GROUP) else if (sh_type == SHT_GROUP)

View File

@ -1,5 +1,5 @@
/* simple-object-mach-o.c -- routines to manipulate Mach-O object files. /* 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. Written by Ian Lance Taylor, Google.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* simple-object-coff.c -- routines to manipulate XCOFF object files. /* 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. Written by Ian Lance Taylor, Google and David Edelsohn, IBM.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* simple-object.c -- simple routines to read and write object files. /* 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. Written by Ian Lance Taylor, Google.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* Implement the snprintf function. /* 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>. Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. This library is free This file is part of the libiberty library. This library is free

View File

@ -1,5 +1,5 @@
/* Sorting algorithms. /* 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>. Contributed by Mark Mitchell <mark@codesourcery.com>.
This file is part of GNU CC. This file is part of GNU CC.

View File

@ -1,5 +1,5 @@
/* Allocate memory region filled with spaces. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* A splay-tree datatype. /* 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). Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GNU CC. This file is part of GNU CC.

View File

@ -1,5 +1,5 @@
/* Increase stack size limit if possible. /* 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 This file is part of the libiberty library. This library is free
software; you can redistribute it and/or modify it under the software; you can redistribute it and/or modify it under the

View File

@ -1,5 +1,5 @@
/* Implement the stpcpy function. /* 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>. Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,5 +1,5 @@
/* Implement the stpncpy function. /* 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>. Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,5 +1,5 @@
/* Implement the strndup function. /* 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>. Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,5 +1,5 @@
/* Implementation of strtod for systems with atof. /* 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 This file is part of the libiberty library. This library is free
software; you can redistribute it and/or modify it under the software; you can redistribute it and/or modify it under the

View File

@ -1,5 +1,5 @@
/* Compare strings while treating digits characters numerically. /* 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. This file is part of the libiberty library.
Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997. Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.

View File

@ -1,6 +1,6 @@
# #
# Makefile # 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. # This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or # Libiberty is free software; you can redistribute it and/or

View File

@ -1278,7 +1278,7 @@ int& int_if_addable<Y>(A<sizeof ((*((Y*)(0)))+(*((Y*)(0))))>*)
# #
--format=gnu-v3 --format=gnu-v3
_Z3bazIiEvP1AIXszcl3foocvT__ELCf00000000_00000000EEEE _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 --format=gnu-v3
_Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv _Z3fooI1FEN1XIXszdtcl1PclcvT__EEE5arrayEE4TypeEv
@ -1446,3 +1446,7 @@ Foo<int>()::X::fn
_ZZZ3FooIiEfvENKUlT_E_clIcEEDaS0_EN1X2fnEv _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()
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*)

View File

@ -1,6 +1,6 @@
/* Demangler fuzzer. /* 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. This file is part of GNU libiberty.

View File

@ -41,7 +41,7 @@ main::main::he714a2e23ed7db2g
# $XX$ substitutions should not contain just numbers. # $XX$ substitutions should not contain just numbers.
--format=auto --format=auto
_ZN4main4$99$17he714a2e23ed7db23E _ZN4main4$99$17he714a2e23ed7db23E
main::$99$::he714a2e23ed7db23 main::$99$
# _ at start of path should be removed. # _ at start of path should be removed.
# ".." translates to "::" "$GT$" to ">" and "$LT$" to "<". # ".." translates to "::" "$GT$" to ">" and "$LT$" to "<".
--format=rust --format=rust
@ -159,3 +159,7 @@ _ZN68_$LT$core..nonzero..NonZero$LT$T$GT$$u20$as$u20$core..ops..Deref$GT$5deref1
--format=rust --format=rust
_ZN63_$LT$core..ptr..Unique$LT$T$GT$$u20$as$u20$core..ops..Deref$GT$5deref17h19f2ad4920655e85E _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 <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

View File

@ -1,5 +1,5 @@
/* Demangler test program, /* 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 Written by Zack Weinberg <zack@codesourcery.com
This file is part of GNU libiberty. This file is part of GNU libiberty.

View File

@ -1,5 +1,5 @@
/* expandargv test program, /* 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> Written by Carlos O'Donell <carlos@codesourcery.com>
This file is part of the libiberty library, which is part of GCC. This file is part of the libiberty library, which is part of GCC.

View File

@ -1,5 +1,5 @@
/* Pexecute test program, /* 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>. Written by Ian Lance Taylor <ian@airs.com>.
This file is part of GNU libiberty. This file is part of GNU libiberty.

View File

@ -1,5 +1,5 @@
/* Test program for strtol family of funtions, /* 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> Written by Yury Gribov <y.gribov@samsung.com>
This file is part of the libiberty library, which is part of GCC. This file is part of the libiberty library, which is part of GCC.

View File

@ -1,5 +1,5 @@
/* Basic struct timeval utilities. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* unlink-if-ordinary.c - remove link to a file unless it is special /* 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 This file is part of the libiberty library. This library is free
software; you can redistribute it and/or modify it under the software; you can redistribute it and/or modify it under the

View File

@ -1,6 +1,6 @@
/* Like vsprintf but provides a pointer to malloc'd storage, which must /* Like vsprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/* Provide a version vfprintf in terms of _doprnt. /* Provide a version vfprintf in terms of _doprnt.
By Kaveh Ghazi (ghazi@caip.rutgers.edu) 3/29/98 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" #include "ansidecl.h"

View File

@ -1,6 +1,6 @@
/* Estimate the length of the string generated by a vprintf-like /* Estimate the length of the string generated by a vprintf-like
function. Used by vasprintf and xvasprintf. 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/* Estimate the length of the string generated by a vprintf-like /* Estimate the length of the string generated by a vprintf-like
function. Use by vasprintf and xvasprintf. 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* Implement the vsnprintf function. /* 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>. Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. This library is free This file is part of the libiberty library. This library is free

View File

@ -3,7 +3,7 @@
implementations of stdio; newer ones should already have vsprintf. implementations of stdio; newer ones should already have vsprintf.
Written by Per Bothner of Cygnus Support. Written by Per Bothner of Cygnus Support.
Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu). 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 This file is part of the libiberty library. This library is free
software; you can redistribute it and/or modify it under the software; you can redistribute it and/or modify it under the

View File

@ -1,5 +1,5 @@
/* Implement the xasprintf function. /* 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. Contributed by Manuel Lopez-Ibanez.
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,5 +1,5 @@
/* xexit.c -- Run any exit handlers, then exit. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* memory allocation routines with error checking. /* 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. This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or Libiberty is free software; you can redistribute it and/or

View File

@ -1,5 +1,5 @@
/* Implement the xstrndup function. /* 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>. Written by Kaveh R. Ghazi <ghazi@caip.rutgers.edu>.
This file is part of the libiberty library. This file is part of the libiberty library.

View File

@ -1,5 +1,5 @@
/* Implement the xvasprintf function. /* 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. Contributed by Manuel Lopez-Ibanez.
This file is part of the libiberty library. This file is part of the libiberty library.