aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog119
-rw-r--r--libiberty/Makefile.in29
-rw-r--r--libiberty/aclocal.m41
-rwxr-xr-xlibiberty/configure177
-rw-r--r--libiberty/configure.ac32
-rw-r--r--libiberty/cp-demangle.c5
-rw-r--r--libiberty/d-demangle.c101
-rw-r--r--libiberty/make-temp-file.c16
-rw-r--r--libiberty/simple-object-mach-o.c5
-rw-r--r--libiberty/testsuite/d-demangle-expected58
-rw-r--r--libiberty/testsuite/demangle-expected5
-rw-r--r--libiberty/xmalloc.c2
12 files changed, 352 insertions, 198 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index b45c748..b283655 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,10 +1,123 @@
-2021-07-03 Nick Clifton <nickc@redhat.com>
+2021-12-30 Lancelot SIX <lsix@lancelotsix.com>
+
+ * cp-demangle.c (d_clone_suffix): Support digits in clone tag
+ names.
+ * testsuite/demangle-expected: Check demangling of clone symbols
+ with digits in name.
+
+2021-12-16 H.J. Lu <hjl.tools@gmail.com>
+
+ Revert:
+ 2021-12-16 H.J. Lu <hjl.tools@gmail.com>
+
+ * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
+ (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
+ (configure_deps): Depend on ../config/gcc-plugin.m4.
+ * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
+ RANLIB_PLUGIN_OPTION.
+ * aclocal.m4: Regenerated.
+ * configure: Likewise.
+
+2021-12-15 H.J. Lu <hjl.tools@gmail.com>
+
+ * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
+ (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
+ (configure_deps): Depend on ../config/gcc-plugin.m4.
+ * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
+ RANLIB_PLUGIN_OPTION.
+ * aclocal.m4: Regenerated.
+ * configure: Likewise.
+
+2021-11-29 Eric Gallager <egallager@gcc.gnu.org>
+
+ PR other/103021
+ * Makefile.in: Use ETAGS variable in TAGS target.
+ * configure: Regenerate.
+ * configure.ac: Allow ETAGS variable to be overridden.
+
+2021-11-29 Andrew Pinski <apinski@marvell.com>
+
+ * make-temp-file.c (try_dir): Check to see if the dir
+ is actually a directory.
+
+2021-10-22 Eric Gallager <egallager@gcc.gnu.org>
+
+ PR other/102663
+ * Makefile.in: Allow dvi-formatted documentation
+ to be installed.
+
+2021-10-17 Luís Ferreira <contact@lsferreira.net>
+
+ PR d/102618
+ * d-demangle.c (dlang_parse_qualified): Handle anonymous
+ symbols correctly.
+ * testsuite/d-demangle-expected: New tests to cover anonymous
+ symbols.
+
+2021-10-14 Luís Ferreira <contact@lsferreira.net>
+
+ * testsuite/d-demangle-expected: Add test case for function literals.
+
+2021-10-14 Luís Ferreira <contact@lsferreira.net>
+
+ * testsuite/d-demangle-expected: Add test cases for simple special
+ mangles.
+
+2021-10-12 Luís Ferreira <contact@lsferreira.net>
+
+ * d-demangle.c (dlang_parse_qualified): Remove redudant parenthesis
+ around lhs and rhs of assignments.
+
+2021-10-01 Luís Ferreira <contact@lsferreira.net>
+
+ * testsuite/d-demangle-expected: Add missing format for new test
+
+2021-09-23 Luís Ferreira <contact@lsferreira.net>
+
+ * d-demangle.c (dlang_Type): Validate MANGLED is nonnull.
+ * testsuite/d-demangle-expected: New test.
+
+2021-09-23 Luís Ferreira <contact@lsferreira.net>
+
+ * d-demangle.c (dlang_symbol_backref): Ensure strlen of
+ string is less than length computed by dlang_number.
+
+2021-09-01 Iain Sandoe <iain@sandoe.co.uk>
* configure: Regenerate.
+ * configure.ac: Do not search for sbrk on Darwin.
+ * xmalloc.c: Do not declare sbrk unless it has been found
+ by configure.
+
+2021-08-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_identifier): Skip over fake parent manglings.
+ * testsuite/d-demangle-expected: Add tests.
+
+2021-08-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_parse_arrayliteral): Add 'info' parameter.
+ (dlang_parse_assocarray): Likewise.
+ (dlang_parse_structlit): Likewise.
+ (dlang_value): Likewise. Handle function literal symbols.
+ (dlang_template_args): Pass 'info' to dlang_value.
+ * testsuite/d-demangle-expected: Add new test.
+
+2021-08-29 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_attributes): Handle typeof(*null).
+ (dlang_type): Likewise. Demangle 'n' as typeof(null).
+ * testsuite/d-demangle-expected: Update tests.
+
+2021-08-23 Iain Sandoe <iain@sandoe.co.uk>
+
+ * simple-object-mach-o.c (simple_object_mach_o_write_segment):
+ Cast the first argument to set_32 as needed.
-2021-07-03 Nick Clifton <nickc@redhat.com>
+2021-08-18 Iain Sandoe <iain@sandoe.co.uk>
- * 2.37 release branch created.
+ * simple-object-mach-o.c (simple_object_mach_o_write_segment):
+ Arrange to swap the LTO index tables where needed.
2021-06-30 Gerald Pfeifer <gerald@pfeifer.com>
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index a99122b..1b17c2e 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -29,6 +29,7 @@ bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
target_header_dir = @target_header_dir@
+dvidir = @dvidir@
objext = @OBJEXT@
SHELL = @SHELL@
@@ -49,13 +50,13 @@ mkinstalldirs = $(SHELL) $(libiberty_topdir)/mkinstalldirs
# Some compilers can't handle cc -c blah.c -o foo/blah.o.
OUTPUT_OPTION = @OUTPUT_OPTION@
-AR = @AR@ @AR_PLUGIN_OPTION@
+AR = @AR@
AR_FLAGS = rc
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
-RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
+RANLIB = @RANLIB@
MAKEINFO = @MAKEINFO@
PERL = @PERL@
@@ -276,7 +277,24 @@ $(TESTLIB): $(REQUIRED_OFILES) $(CONFIGURED_OFILES)
info: libiberty.info info-subdir
install-info: install-info-subdir
clean-info: clean-info-subdir
-dvi: libiberty.dvi dvi-subdir
+
+LIBIBERTY_DVIFILES = libiberty.dvi
+
+dvi: $(LIBIBERTY_DVIFILES) dvi-subdir
+
+.PHONY: install-dvi
+
+dvi__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+
+install-dvi: $(LIBIBERTY_DVIFILES)
+ @$(NORMAL_INSTALL)
+ test -z "$(dvidir)" || $(mkinstalldirs) "$(DESTDIR)$(dvidir)"
+ @list='$(LIBIBERTY_DVIFILES)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(dvi__strip_dir) \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(dvidir)/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(dvidir)/$$f"; \
+ done
LIBIBERTY_PDFFILES = libiberty.pdf
@@ -411,8 +429,10 @@ stamp-noasandir:
.PHONY: all etags tags TAGS ls clean stage1 stage2
+ETAGS = @ETAGS@
+
etags tags TAGS: etags-subdir
- cd $(srcdir) && etags $(CFILES)
+ cd $(srcdir) && $(ETAGS) $(CFILES)
# The standalone demangler (c++filt) has been moved to binutils.
# But make this target work anyway for demangler hacking.
@@ -487,7 +507,6 @@ aclocal_deps = \
$(srcdir)/../config/acx.m4 \
$(srcdir)/../config/cet.m4 \
$(srcdir)/../config/enable.m4 \
- $(srcdir)/../config/gcc-plugin.m4 \
$(srcdir)/../config/no-executables.m4 \
$(srcdir)/../config/override.m4 \
$(srcdir)/../config/picflag.m4 \
diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
index 0757688..3378316 100644
--- a/libiberty/aclocal.m4
+++ b/libiberty/aclocal.m4
@@ -15,7 +15,6 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun
m4_include([../config/acx.m4])
m4_include([../config/cet.m4])
m4_include([../config/enable.m4])
-m4_include([../config/gcc-plugin.m4])
m4_include([../config/no-executables.m4])
m4_include([../config/picflag.m4])
m4_include([../config/warnings.m4])
diff --git a/libiberty/configure b/libiberty/configure
index f4169b4..56c8e6b 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -645,8 +645,6 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
-RANLIB_PLUGIN_OPTION
-AR_PLUGIN_OPTION
RANLIB
AR
host_os
@@ -661,6 +659,7 @@ HAVE_PERL
PERL
BUILD_INFO
MAKEINFO
+ETAGS
NOTMAINT
MAINT
libiberty_topdir
@@ -683,6 +682,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -762,6 +762,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
@@ -1014,6 +1015,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1151,7 +1161,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1304,6 +1314,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -2560,6 +2571,11 @@ else
NOTMAINT=''
fi
+if test -z "$ETAGS"; then
+ ETAGS=etags
+fi
+
+
# Do we have a single-tree copy of texinfo? Even if we do, we can't
# rely on it - libiberty is built before texinfo.
# Extract the first word of "makeinfo", so it can be a program name with args.
@@ -2931,144 +2947,6 @@ else
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5
-$as_echo_n "checking for -plugin option... " >&6; }
-
-plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
-plugin_option=
-for plugin in $plugin_names; do
- plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
- if test x$plugin_so = x$plugin; then
- plugin_so=`${CC} ${CFLAGS} --print-file-name $plugin`
- fi
- if test x$plugin_so != x$plugin; then
- plugin_option="--plugin $plugin_so"
- break
- fi
-done
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AR+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-AR=$ac_cv_prog_AR
-if test -n "$AR"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
-$as_echo "$AR" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_AR"; then
- ac_ct_AR=$AR
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AR+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_AR"; then
- ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_AR="ar"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_AR=$ac_cv_prog_ac_ct_AR
-if test -n "$ac_ct_AR"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_AR" = x; then
- AR=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- AR=$ac_ct_AR
- fi
-else
- AR="$ac_cv_prog_AR"
-fi
-
-if test "${AR}" = "" ; then
- as_fn_error $? "Required archive tool 'ar' not found on PATH." "$LINENO" 5
-fi
-touch conftest.c
-${AR} $plugin_option rc conftest.a conftest.c
-if test "$?" != 0; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5
-$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;}
- plugin_option=
-fi
-rm -f conftest.*
-if test -n "$plugin_option"; then
- PLUGIN_OPTION="$plugin_option"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_option" >&5
-$as_echo "$plugin_option" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-if test -n "$PLUGIN_OPTION"; then
- if $AR --help 2>&1 | grep -q "\--plugin"; then
- AR_PLUGIN_OPTION="$PLUGIN_OPTION"
-
- fi
- if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
- RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION"
-
- fi
-fi
-
# Add --enable-multilib to configure.
# Default to --enable-multilib
# Check whether --enable-multilib was given.
@@ -6155,9 +6033,16 @@ vars="sys_errlist sys_nerr sys_siglist"
checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \
getsysinfo gettimeofday on_exit pipe2 psignal pstat_getdynamic pstat_getstatic \
- realpath setrlimit sbrk spawnve spawnvpe strerror strsignal sysconf sysctl \
+ realpath setrlimit spawnve spawnvpe strerror strsignal sysconf sysctl \
sysmp table times wait3 wait4"
+# Darwin has sbrk, but it is deprecated and that produces build-time warnings
+# so do not check for it.
+case "${host}" in
+ *-*-darwin*) ;;
+ *) checkfuncs="$checkfuncs sbrk"
+esac
+
# These are neither executed nor required, but they help keep
# autoheader happy without adding a bunch of text to acconfig.h.
if test "x" = "y"; then
@@ -7386,7 +7271,10 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_REALLOC $ac_have_decl
_ACEOF
-ac_fn_c_check_decl "$LINENO" "sbrk" "ac_cv_have_decl_sbrk" "$ac_includes_default"
+
+ case "${host}" in
+ *-*-darwin*) ;; # Darwin's sbrk implementation is deprecated.
+ *) ac_fn_c_check_decl "$LINENO" "sbrk" "ac_cv_have_decl_sbrk" "$ac_includes_default"
if test "x$ac_cv_have_decl_sbrk" = xyes; then :
ac_have_decl=1
else
@@ -7396,7 +7284,8 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_SBRK $ac_have_decl
_ACEOF
-
+;;
+ esac
ac_fn_c_check_decl "$LINENO" "strtol" "ac_cv_have_decl_strtol" "$ac_includes_default"
if test "x$ac_cv_have_decl_strtol" = xyes; then :
ac_have_decl=1
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index 9b451a4..84a7b37 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -61,6 +61,11 @@ fi
AC_SUBST(MAINT)dnl
AC_SUBST(NOTMAINT)dnl
+if test -z "$ETAGS"; then
+ ETAGS=etags
+fi
+AC_SUBST([ETAGS])
+
# Do we have a single-tree copy of texinfo? Even if we do, we can't
# rely on it - libiberty is built before texinfo.
AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, )
@@ -108,18 +113,6 @@ dnl to call AC_CHECK_PROG.
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
-GCC_PLUGIN_OPTION(PLUGIN_OPTION)
-if test -n "$PLUGIN_OPTION"; then
- if $AR --help 2>&1 | grep -q "\--plugin"; then
- AR_PLUGIN_OPTION="$PLUGIN_OPTION"
- AC_SUBST(AR_PLUGIN_OPTION)
- fi
- if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
- RANLIB_PLUGIN_OPTION="$PLUGIN_OPTION"
- AC_SUBST(RANLIB_PLUGIN_OPTION)
- fi
-fi
-
dnl When switching to automake, replace the following with AM_ENABLE_MULTILIB.
# Add --enable-multilib to configure.
# Default to --enable-multilib
@@ -407,9 +400,16 @@ vars="sys_errlist sys_nerr sys_siglist"
checkfuncs="__fsetlocking canonicalize_file_name dup3 getrlimit getrusage \
getsysinfo gettimeofday on_exit pipe2 psignal pstat_getdynamic pstat_getstatic \
- realpath setrlimit sbrk spawnve spawnvpe strerror strsignal sysconf sysctl \
+ realpath setrlimit spawnve spawnvpe strerror strsignal sysconf sysctl \
sysmp table times wait3 wait4"
+# Darwin has sbrk, but it is deprecated and that produces build-time warnings
+# so do not check for it.
+case "${host}" in
+ *-*-darwin*) ;;
+ *) checkfuncs="$checkfuncs sbrk"
+esac
+
# These are neither executed nor required, but they help keep
# autoheader happy without adding a bunch of text to acconfig.h.
if test "x" = "y"; then
@@ -707,7 +707,11 @@ if test -z "${setobjs}"; then
AC_CHECK_FUNCS($checkfuncs)
AC_CHECK_DECLS([basename(char *), ffs, asprintf, vasprintf, snprintf, vsnprintf])
- AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc, sbrk])
+ AC_CHECK_DECLS([calloc, getenv, getopt, malloc, realloc])
+ case "${host}" in
+ *-*-darwin*) ;; # Darwin's sbrk implementation is deprecated.
+ *) AC_CHECK_DECLS([sbrk]);;
+ esac
AC_CHECK_DECLS([strtol, strtoul, strtoll, strtoull])
AC_CHECK_DECLS([strverscmp])
AC_CHECK_DECLS([strnlen])
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 3d1e5ec..6dff7d2 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -3884,10 +3884,11 @@ d_clone_suffix (struct d_info *di, struct demangle_component *encoding)
const char *pend = suffix;
struct demangle_component *n;
- if (*pend == '.' && (IS_LOWER (pend[1]) || pend[1] == '_'))
+ if (*pend == '.' && (IS_LOWER (pend[1]) || IS_DIGIT (pend[1])
+ || pend[1] == '_'))
{
pend += 2;
- while (IS_LOWER (*pend) || *pend == '_')
+ while (IS_LOWER (*pend) || IS_DIGIT (*pend) || *pend == '_')
++pend;
}
while (*pend == '.' && IS_DIGIT (pend[1]))
diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 4d14a4a..e53990e 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -191,7 +191,8 @@ static const char *dlang_function_args (string *, const char *,
static const char *dlang_type (string *, const char *, struct dlang_info *);
-static const char *dlang_value (string *, const char *, const char *, char);
+static const char *dlang_value (string *, const char *, const char *, char,
+ struct dlang_info *);
static const char *dlang_parse_qualified (string *, const char *,
struct dlang_info *, int);
@@ -252,15 +253,15 @@ dlang_hexdigit (const char *mangled, char *ret)
c = mangled[0];
if (!ISDIGIT (c))
- (*ret) = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
+ *ret = c - (ISUPPER (c) ? 'A' : 'a') + 10;
else
- (*ret) = (c - '0');
+ *ret = c - '0';
c = mangled[1];
if (!ISDIGIT (c))
- (*ret) = (*ret << 4) | (c - (ISUPPER (c) ? 'A' : 'a') + 10);
+ *ret = (*ret << 4) | (c - (ISUPPER (c) ? 'A' : 'a') + 10);
else
- (*ret) = (*ret << 4) | (c - '0');
+ *ret = (*ret << 4) | (c - '0');
mangled += 2;
@@ -337,7 +338,7 @@ dlang_decode_backref (const char *mangled, long *ret)
static const char *
dlang_backref (const char *mangled, const char **ret, struct dlang_info *info)
{
- (*ret) = NULL;
+ *ret = NULL;
if (mangled == NULL || *mangled != 'Q')
return NULL;
@@ -355,7 +356,7 @@ dlang_backref (const char *mangled, const char **ret, struct dlang_info *info)
return NULL;
/* Set the position of the back reference. */
- (*ret) = qpos - refpos;
+ *ret = qpos - refpos;
return mangled;
}
@@ -380,7 +381,7 @@ dlang_symbol_backref (string *decl, const char *mangled,
/* Must point to a simple identifier. */
backref = dlang_number (backref, &len);
- if (backref == NULL)
+ if (backref == NULL || strlen(backref) < len)
return NULL;
backref = dlang_lname (decl, backref, len);
@@ -573,9 +574,11 @@ dlang_attributes (string *decl, const char *mangled)
case 'g':
case 'h':
case 'k':
+ case 'n':
/* inout parameter is represented as 'Ng'.
vector parameter is represented as 'Nh'.
- return paramenter is represented as 'Nk'.
+ return parameter is represented as 'Nk'.
+ typeof(*null) parameter is represented as 'Nn'.
If we see this, then we know we're really in the
parameter list. Rewind and break. */
mangled--;
@@ -787,6 +790,12 @@ dlang_type (string *decl, const char *mangled, struct dlang_info *info)
string_append (decl, ")");
return mangled;
}
+ else if (*mangled == 'n') /* typeof(*null) */
+ {
+ mangled++;
+ string_append (decl, "typeof(*null)");
+ return mangled;
+ }
else
return NULL;
case 'A': /* dynamic array (T[]) */
@@ -866,7 +875,7 @@ dlang_type (string *decl, const char *mangled, struct dlang_info *info)
szmods = string_length (&mods);
/* Back referenced function type. */
- if (*mangled == 'Q')
+ if (mangled && *mangled == 'Q')
mangled = dlang_type_backref (decl, mangled, info, 1);
else
mangled = dlang_function_type (decl, mangled, info);
@@ -884,7 +893,7 @@ dlang_type (string *decl, const char *mangled, struct dlang_info *info)
/* Basic types */
case 'n':
mangled++;
- string_append (decl, "none");
+ string_append (decl, "typeof(null)");
return mangled;
case 'v':
mangled++;
@@ -1035,6 +1044,25 @@ dlang_identifier (string *decl, const char *mangled, struct dlang_info *info)
&& (mangled[2] == 'T' || mangled[2] == 'U'))
return dlang_parse_template (decl, mangled, info, len);
+ /* There can be multiple different declarations in the same function that have
+ the same mangled name. To make the mangled names unique, a fake parent in
+ the form `__Sddd' is added to the symbol. */
+ if (len >= 4 && mangled[0] == '_' && mangled[1] == '_' && mangled[2] == 'S')
+ {
+ const char *numptr = mangled + 3;
+ while (numptr < (mangled + len) && ISDIGIT (*numptr))
+ numptr++;
+
+ if (mangled + len == numptr)
+ {
+ /* Skip over the fake parent. */
+ mangled += len;
+ return dlang_identifier (decl, mangled, info);
+ }
+
+ /* else demangle it as a plain identifier. */
+ }
+
return dlang_lname (decl, mangled, len);
}
@@ -1378,7 +1406,8 @@ dlang_parse_string (string *decl, const char *mangled)
/* Extract the static array value from MANGLED and append it to DECL.
Return the remaining string on success or NULL on failure. */
static const char *
-dlang_parse_arrayliteral (string *decl, const char *mangled)
+dlang_parse_arrayliteral (string *decl, const char *mangled,
+ struct dlang_info *info)
{
unsigned long elements;
@@ -1389,7 +1418,7 @@ dlang_parse_arrayliteral (string *decl, const char *mangled)
string_append (decl, "[");
while (elements--)
{
- mangled = dlang_value (decl, mangled, NULL, '\0');
+ mangled = dlang_value (decl, mangled, NULL, '\0', info);
if (mangled == NULL)
return NULL;
@@ -1404,7 +1433,8 @@ dlang_parse_arrayliteral (string *decl, const char *mangled)
/* Extract the associative array value from MANGLED and append it to DECL.
Return the remaining string on success or NULL on failure. */
static const char *
-dlang_parse_assocarray (string *decl, const char *mangled)
+dlang_parse_assocarray (string *decl, const char *mangled,
+ struct dlang_info *info)
{
unsigned long elements;
@@ -1415,12 +1445,12 @@ dlang_parse_assocarray (string *decl, const char *mangled)
string_append (decl, "[");
while (elements--)
{
- mangled = dlang_value (decl, mangled, NULL, '\0');
+ mangled = dlang_value (decl, mangled, NULL, '\0', info);
if (mangled == NULL)
return NULL;
string_append (decl, ":");
- mangled = dlang_value (decl, mangled, NULL, '\0');
+ mangled = dlang_value (decl, mangled, NULL, '\0', info);
if (mangled == NULL)
return NULL;
@@ -1435,7 +1465,8 @@ dlang_parse_assocarray (string *decl, const char *mangled)
/* Extract the struct literal value for NAME from MANGLED and append it to DECL.
Return the remaining string on success or NULL on failure. */
static const char *
-dlang_parse_structlit (string *decl, const char *mangled, const char *name)
+dlang_parse_structlit (string *decl, const char *mangled, const char *name,
+ struct dlang_info *info)
{
unsigned long args;
@@ -1449,7 +1480,7 @@ dlang_parse_structlit (string *decl, const char *mangled, const char *name)
string_append (decl, "(");
while (args--)
{
- mangled = dlang_value (decl, mangled, NULL, '\0');
+ mangled = dlang_value (decl, mangled, NULL, '\0', info);
if (mangled == NULL)
return NULL;
@@ -1464,7 +1495,8 @@ dlang_parse_structlit (string *decl, const char *mangled, const char *name)
/* Extract the value from MANGLED and append it to DECL.
Return the remaining string on success or NULL on failure. */
static const char *
-dlang_value (string *decl, const char *mangled, const char *name, char type)
+dlang_value (string *decl, const char *mangled, const char *name, char type,
+ struct dlang_info *info)
{
if (mangled == NULL || *mangled == '\0')
return NULL;
@@ -1525,15 +1557,24 @@ dlang_value (string *decl, const char *mangled, const char *name, char type)
case 'A':
mangled++;
if (type == 'H')
- mangled = dlang_parse_assocarray (decl, mangled);
+ mangled = dlang_parse_assocarray (decl, mangled, info);
else
- mangled = dlang_parse_arrayliteral (decl, mangled);
+ mangled = dlang_parse_arrayliteral (decl, mangled, info);
break;
/* Struct values. */
case 'S':
mangled++;
- mangled = dlang_parse_structlit (decl, mangled, name);
+ mangled = dlang_parse_structlit (decl, mangled, name, info);
+ break;
+
+ /* Function literal symbol. */
+ case 'f':
+ mangled++;
+ if (strncmp (mangled, "_D", 2) != 0
+ || !dlang_symbol_name_p (mangled + 2, info))
+ return NULL;
+ mangled = dlang_parse_mangle (decl, mangled, info);
break;
default:
@@ -1609,13 +1650,19 @@ dlang_parse_qualified (string *decl, const char *mangled,
size_t n = 0;
do
{
+ /* Skip over anonymous symbols. */
+ if (*mangled == '0')
+ {
+ do
+ mangled++;
+ while (*mangled == '0');
+
+ continue;
+ }
+
if (n++)
string_append (decl, ".");
- /* Skip over anonymous symbols. */
- while (*mangled == '0')
- mangled++;
-
mangled = dlang_identifier (decl, mangled, info);
/* Consume the encoded arguments. However if this is not followed by the
@@ -1806,7 +1853,7 @@ dlang_template_args (string *decl, const char *mangled, struct dlang_info *info)
string_need (&name, 1);
*(name.p) = '\0';
- mangled = dlang_value (decl, mangled, name.b, type);
+ mangled = dlang_value (decl, mangled, name.b, type, info);
string_delete (&name);
break;
}
diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c
index b05df56..7bfc65e 100644
--- a/libiberty/make-temp-file.c
+++ b/libiberty/make-temp-file.c
@@ -39,6 +39,10 @@ Boston, MA 02110-1301, USA. */
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h>
#endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
#ifndef R_OK
#define R_OK 4
@@ -76,7 +80,17 @@ try_dir (const char *dir, const char *base)
return base;
if (dir != 0
&& access (dir, R_OK | W_OK | X_OK) == 0)
- return dir;
+ {
+ /* Check to make sure dir is actually a directory. */
+#ifdef S_ISDIR
+ struct stat s;
+ if (stat (dir, &s))
+ return NULL;
+ if (!S_ISDIR (s.st_mode))
+ return NULL;
+#endif
+ return dir;
+ }
return 0;
}
diff --git a/libiberty/simple-object-mach-o.c b/libiberty/simple-object-mach-o.c
index 03954d2..bbb7d75 100644
--- a/libiberty/simple-object-mach-o.c
+++ b/libiberty/simple-object-mach-o.c
@@ -1225,6 +1225,11 @@ simple_object_mach_o_write_segment (simple_object_write *sobj, int descriptor,
index[4 * i] -= index[0];
index[0] = 0;
+ /* Swap the indices, if required. */
+
+ for (i = 0; i < (nsects_in * 4); ++i)
+ set_32 ((unsigned char *) &index[i], index[i]);
+
sechdr_offset += sechdrsize;
/* Write out the section names.
diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
index ba0ffed..47b059c 100644
--- a/libiberty/testsuite/d-demangle-expected
+++ b/libiberty/testsuite/d-demangle-expected
@@ -18,6 +18,14 @@ _Dmain
D main
#
--format=dlang
+_D8demangleZ
+demangle
+#
+--format=dlang
+_D8demangle4testZ
+demangle.test
+#
+--format=dlang
_D8demangle4testPFLAiYi
demangle.test
#
@@ -83,7 +91,11 @@ demangle.test(ulong)
#
--format=dlang
_D8demangle4testFnZv
-demangle.test(none)
+demangle.test(typeof(null))
+#
+--format=dlang
+_D8demangle4testFNnZv
+demangle.test(typeof(*null))
#
--format=dlang
_D8demangle4testFoZv
@@ -969,6 +981,10 @@ demangle.test(char)
_D8demangle000000004testFaZv
demangle.test(char)
#
+--format=dlang
+_D8demangle__T3abcS_DQt10__lambda13FNaNbNiNfZiZQBhFZi
+demangle.abc!(demangle.__lambda13()).abc()
+#
# Unittests
#
--format=dlang
@@ -992,6 +1008,10 @@ _D00
_D00
#
--format=dlang
+_D01_D
+_D01_D
+#
+--format=dlang
_D9223372036854775817
_D9223372036854775817
#
@@ -1414,3 +1434,39 @@ std.algorithm.iteration.FilterResult!(std.typecons.Tuple!(int, "a", int, "b", in
--format=dlang
_D3std3uni__T6toCaseS_DQvQt12toLowerIndexFNaNbNiNewZtVii1043S_DQCjQCi10toLowerTabFNaNbNiNemZwSQDo5ascii7toLowerTAyaZQDzFNaNeQmZ14__foreachbody2MFNaNeKmKwZ14__foreachbody3MFNaNeKwZi
std.uni.toCase!(std.uni.toLowerIndex(dchar), 1043, std.uni.toLowerTab(ulong), std.ascii.toLower, immutable(char)[]).toCase(immutable(char)[]).__foreachbody2(ref ulong, ref dchar).__foreachbody3(ref dchar)
+#
+--format=dlang
+_D8demangle4mainFZ1xi
+demangle.main().x
+#
+--format=dlang
+_D8demangle4mainFZ4__S11xi
+demangle.main().x
+#
+--format=dlang
+_D8demangle4mainFZ1fMFNaNbNiNfZv
+demangle.main().f()
+#
+--format=dlang
+_D8demangle4mainFZ4__S11fMFNaNbNiNfZv
+demangle.main().f()
+#
+--format=dlang
+_D3mod4funcFZ__T6nestedTiZQkMFNaNbNiNfZi
+mod.func().nested!(int).nested()
+#
+--format=dlang
+_D3mod4funcFZ__T6nestedTiZ4__S1QpMFNaNbNiNfZi
+mod.func().nested!(int).nested()
+#
+--format=dlang
+_D6mangle__T8fun21753VSQv6S21753S1f_DQBj10__lambda71MFNaNbNiNfZvZQCbQp
+mangle.fun21753!(mangle.S21753(mangle.__lambda71())).fun21753
+#
+--format=dlang
+_D8demangle9anonymous0Z
+demangle.anonymous
+#
+--format=dlang
+_D8demangle9anonymous03fooZ
+demangle.anonymous.foo
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 19a0d62..de54ad7 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -1164,6 +1164,11 @@ foo(int) [clone ._omp_cpyfn.6]
foo
#
--format=gnu-v3 --no-params
+_Z3fooPfS_S_j.sse4_1.2
+foo(float*, float*, float*, unsigned int) [clone .sse4_1.2]
+foo
+#
+--format=gnu-v3 --no-params
_Z1fIKFvvES0_Evv
void f<void () const, void () const>()
f<void () const, void () const>
diff --git a/libiberty/xmalloc.c b/libiberty/xmalloc.c
index 3971c8f..e7d5268 100644
--- a/libiberty/xmalloc.c
+++ b/libiberty/xmalloc.c
@@ -87,7 +87,9 @@ extern "C" {
void *malloc (size_t);
void *realloc (void *, size_t);
void *calloc (size_t, size_t);
+#ifdef HAVE_SBRK
void *sbrk (ptrdiff_t);
+#endif
# ifdef __cplusplus
}
# endif /* __cplusplus */