From 20c4b12e937b20f0998bd25ad37c77145650e826 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Sat, 3 Jul 2021 14:00:33 +0100 Subject: Synchronize libiberty sources (and include/demangle.h) with GCC master version --- libiberty/ChangeLog | 85 ++++++++++++--- libiberty/Makefile.in | 17 ++- libiberty/acinclude.m4 | 185 +++++++++++++++++++++++++++++++ libiberty/aclocal.m4 | 199 ++++------------------------------ libiberty/argv.c | 5 +- libiberty/configure | 189 +++++++------------------------- libiberty/configure.ac | 20 ++-- libiberty/cp-demangle.c | 47 ++++---- libiberty/dyn-string.c | 2 +- libiberty/make-temp-file.c | 5 +- libiberty/rust-demangle.c | 9 +- libiberty/sha1.c | 2 +- libiberty/simple-object.c | 6 + libiberty/testsuite/demangle-expected | 4 +- 14 files changed, 382 insertions(+), 393 deletions(-) create mode 100644 libiberty/acinclude.m4 (limited to 'libiberty') diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 70d7209bf0a..0143d429eb8 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,23 +1,82 @@ -2021-03-18 H.J. Lu +2021-06-30 Gerald Pfeifer - PR binutils/27397 - * configure: Regenerated. + * make-temp-file.c (usrtmp): Remove. + (choose_tmpdir): Remove use of usrtmp. -2021-01-11 H.J. Lu +2021-06-28 Indu Bhagat - PR ld/27173 - * configure: Regenerated. + * simple-object.c (handle_lto_debug_sections): Copy over .BTF section. + +2021-06-28 Indu Bhagat + David Faust + Jose E. Marchesi + Weimin Pan + + * simple-object.c (handle_lto_debug_sections): Copy over .ctf + sections. + +2021-06-05 John David Anglin + + PR target/100734 + * configure.ac: Use libiberty snprintf and vsnprintf on + hppa*-*-hpux*. + * configure: Regenerate. -2021-01-09 H.J. Lu +2021-05-06 Tom Tromey - * Makefile.in (AR): Add @AR_PLUGIN_OPTION@ - (RANLIB): Add @RANLIB_PLUGIN_OPTION@. - (configure_deps): Depend on ../config/gcc-plugin.m4. - * aclocal.m4: Include ../config/gcc-plugin.m4. - * configure.ac: AC_SUBST AR_PLUGIN_OPTION and - RANLIB_PLUGIN_OPTION. + * hashtab.c (htab_eq_string): New function. + +2021-05-04 Eric Botcazou + + * configure.ac: Make test for variables more robust. + * configure: Regenerate. + +2021-05-03 H.J. Lu + + PR bootstrap/99703 * configure: Regenerated. +2021-04-21 Andreas Schwab + + PR demangler/100177 + * rust-demangle.c (demangle_const_char): Properly print the + character value. + +2021-03-31 Patrick Palka + + PR c++/88115 + * cp-demangle.c (d_dump, d_make_comp, d_expression_1) + (d_count_templates_scopes): Handle DEMANGLE_COMPONENT_VENDOR_EXPR. + (d_print_comp_inner): Likewise. + : Revert r11-4926 + change. + : Likewise. + * testsuite/demangle-expected: Adjust __alignof__ tests. + +2021-03-16 Nick Clifton + + * sha1.c (sha1_process_bytes): Use memmove in place of memcpy. + +2021-02-20 Mike Frysinger + + * Makefile.in (ACLOCAL, ACLOCAL_AMFLAGS, $(srcdir)/aclocal.m4): Define. + (configure_deps): Rename to ... + (aclocal_deps): ... this. Replace aclocal.m4 with acinclude.m4. + ($(srcdir)/configure): Replace $(configure_deps) with + $(srcdir)/aclocal.m4. + * aclocal.m4: Move libiberty macros to acinclude.m4, then regenerate. + * acinclude.m4: New file. + * configure: Regenerate. + +2021-02-19 Ayush Mittal + + * argv.c (expandargv): free allocated buffer if read fails. + +2021-02-01 Martin Sebor + + * dyn-string.c (dyn_string_insert_cstr): Use memcpy instead of strncpy + to avoid -Wstringop-truncation. + 2021-01-04 Martin Liska * strverscmp.c: Convert to utf8 from iso8859. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 711e155b075..4f1213b983b 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -49,13 +49,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@ @@ -481,19 +481,24 @@ config.status: $(srcdir)/configure $(SHELL) ./config.status --recheck AUTOCONF = autoconf -configure_deps = $(srcdir)/aclocal.m4 \ +ACLOCAL = aclocal +ACLOCAL_AMFLAGS = -I ../config -I .. +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 \ - $(srcdir)/../config/warnings.m4 + $(srcdir)/../config/warnings.m4 \ + $(srcdir)/acinclude.m4 -$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps) +$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/aclocal.m4 cd $(srcdir) && $(AUTOCONF) +$(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + # Depending on config.h makes sure that config.status has been re-run # if needed. This prevents problems with parallel builds, in case # subdirectories need to run config.status also. diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4 new file mode 100644 index 00000000000..6db0e508517 --- /dev/null +++ b/libiberty/acinclude.m4 @@ -0,0 +1,185 @@ +dnl Copyright (C) 2000-2021 Free Software Foundation, Inc. +dnl +dnl GCC is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 3, or (at your option) +dnl any later version. +dnl +dnl GCC is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GCC; see the file COPYING3. If not see +dnl . + +dnl See whether strncmp reads past the end of its string parameters. +dnl On some versions of SunOS4 at least, strncmp reads a word at a time +dnl but erroneously reads past the end of strings. This can cause +dnl a SEGV in some cases. +AC_DEFUN([libiberty_AC_FUNC_STRNCMP], +[AC_REQUIRE([AC_FUNC_MMAP]) +AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works, +[AC_TRY_RUN([ +/* Test by Jim Wilson and Kaveh Ghazi. + Check whether strncmp reads past the end of its string parameters. */ +#include + +#ifdef HAVE_FCNTL_H +#include +#endif + +#ifdef HAVE_SYS_MMAN_H +#include +#endif + +#ifndef MAP_ANON +#ifdef MAP_ANONYMOUS +#define MAP_ANON MAP_ANONYMOUS +#else +#define MAP_ANON MAP_FILE +#endif +#endif + +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif +#ifndef O_RDONLY +#define O_RDONLY 0 +#endif + +#define MAP_LEN 0x10000 + +main () +{ +#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) + char *p; + int dev_zero; + + dev_zero = open ("/dev/zero", O_RDONLY); + if (dev_zero < 0) + exit (1); + + p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, dev_zero, 0); + if (p == (char *)-1) + p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, -1, 0); + if (p == (char *)-1) + exit (2); + else + { + char *string = "__si_type_info"; + char *q = (char *) p + MAP_LEN - strlen (string) - 2; + char *r = (char *) p + 0xe; + + strcpy (q, string); + strcpy (r, string); + strncmp (r, q, 14); + } +#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */ + exit (0); +} +], ac_cv_func_strncmp_works=yes, ac_cv_func_strncmp_works=no, + ac_cv_func_strncmp_works=yes) +rm -f core core.* *.core]) +if test $ac_cv_func_strncmp_works = no ; then + AC_LIBOBJ([strncmp]) +fi +]) + +dnl See if errno must be declared even when is included. +AC_DEFUN([libiberty_AC_DECLARE_ERRNO], +[AC_CACHE_CHECK(whether errno must be declared, libiberty_cv_declare_errno, +[AC_TRY_COMPILE( +[#include ], +[int x = errno;], +libiberty_cv_declare_errno=no, +libiberty_cv_declare_errno=yes)]) +if test $libiberty_cv_declare_errno = yes +then AC_DEFINE(NEED_DECLARATION_ERRNO, 1, + [Define if errno must be declared even when is included.]) +fi +]) + +dnl See whether we need a declaration for a function. +AC_DEFUN([libiberty_NEED_DECLARATION], +[AC_MSG_CHECKING([whether $1 must be declared]) +AC_CACHE_VAL(libiberty_cv_decl_needed_$1, +[AC_TRY_COMPILE([ +#include "confdefs.h" +#include +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif], +[char *(*pfn) = (char *(*)) $1], +libiberty_cv_decl_needed_$1=no, libiberty_cv_decl_needed_$1=yes)]) +AC_MSG_RESULT($libiberty_cv_decl_needed_$1) +if test $libiberty_cv_decl_needed_$1 = yes; then + AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1, + [Define if $1 is not declared in system header files.]) +fi +])dnl + +# We always want a C version of alloca() compiled into libiberty, +# because native-compiler support for the real alloca is so !@#$% +# unreliable that GCC has decided to use it only when being compiled +# by GCC. This is the part of AC_FUNC_ALLOCA that calculates the +# information alloca.c needs. +AC_DEFUN([libiberty_AC_FUNC_C_ALLOCA], +[AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray, +[AC_EGREP_CPP(webecray, +[#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif +], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + AC_CHECK_FUNC($ac_func, + [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, + [Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP + systems. This function is required for alloca.c support on those + systems.]) break]) + done +fi + +AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, +[AC_TRY_RUN([find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +}], + ac_cv_c_stack_direction=1, + ac_cv_c_stack_direction=-1, + ac_cv_c_stack_direction=0)]) +AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction, + [Define if you know the direction of stack growth for your system; + otherwise it will be automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown]) +]) diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4 index b2e54d9e32a..3378316dced 100644 --- a/libiberty/aclocal.m4 +++ b/libiberty/aclocal.m4 @@ -1,178 +1,21 @@ -sinclude(../config/acx.m4) -sinclude(../config/cet.m4) -sinclude(../config/enable.m4) -sinclude(../config/gcc-plugin.m4) -sinclude(../config/no-executables.m4) -sinclude(../config/override.m4) -sinclude(../config/picflag.m4) -sinclude(../config/warnings.m4) - -dnl See whether strncmp reads past the end of its string parameters. -dnl On some versions of SunOS4 at least, strncmp reads a word at a time -dnl but erroneously reads past the end of strings. This can cause -dnl a SEGV in some cases. -AC_DEFUN(libiberty_AC_FUNC_STRNCMP, -[AC_REQUIRE([AC_FUNC_MMAP]) -AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works, -[AC_TRY_RUN([ -/* Test by Jim Wilson and Kaveh Ghazi. - Check whether strncmp reads past the end of its string parameters. */ -#include - -#ifdef HAVE_FCNTL_H -#include -#endif - -#ifdef HAVE_SYS_MMAN_H -#include -#endif - -#ifndef MAP_ANON -#ifdef MAP_ANONYMOUS -#define MAP_ANON MAP_ANONYMOUS -#else -#define MAP_ANON MAP_FILE -#endif -#endif - -#ifndef MAP_FILE -#define MAP_FILE 0 -#endif -#ifndef O_RDONLY -#define O_RDONLY 0 -#endif - -#define MAP_LEN 0x10000 - -main () -{ -#if defined(HAVE_MMAP) || defined(HAVE_MMAP_ANYWHERE) - char *p; - int dev_zero; - - dev_zero = open ("/dev/zero", O_RDONLY); - if (dev_zero < 0) - exit (1); - - p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, - MAP_ANON|MAP_PRIVATE, dev_zero, 0); - if (p == (char *)-1) - p = (char *) mmap (0, MAP_LEN, PROT_READ|PROT_WRITE, - MAP_ANON|MAP_PRIVATE, -1, 0); - if (p == (char *)-1) - exit (2); - else - { - char *string = "__si_type_info"; - char *q = (char *) p + MAP_LEN - strlen (string) - 2; - char *r = (char *) p + 0xe; - - strcpy (q, string); - strcpy (r, string); - strncmp (r, q, 14); - } -#endif /* HAVE_MMAP || HAVE_MMAP_ANYWHERE */ - exit (0); -} -], ac_cv_func_strncmp_works=yes, ac_cv_func_strncmp_works=no, - ac_cv_func_strncmp_works=yes) -rm -f core core.* *.core]) -if test $ac_cv_func_strncmp_works = no ; then - AC_LIBOBJ([strncmp]) -fi -]) - -dnl See if errno must be declared even when is included. -AC_DEFUN(libiberty_AC_DECLARE_ERRNO, -[AC_CACHE_CHECK(whether errno must be declared, libiberty_cv_declare_errno, -[AC_TRY_COMPILE( -[#include ], -[int x = errno;], -libiberty_cv_declare_errno=no, -libiberty_cv_declare_errno=yes)]) -if test $libiberty_cv_declare_errno = yes -then AC_DEFINE(NEED_DECLARATION_ERRNO, 1, - [Define if errno must be declared even when is included.]) -fi -]) - -dnl See whether we need a declaration for a function. -AC_DEFUN(libiberty_NEED_DECLARATION, -[AC_MSG_CHECKING([whether $1 must be declared]) -AC_CACHE_VAL(libiberty_cv_decl_needed_$1, -[AC_TRY_COMPILE([ -#include "confdefs.h" -#include -#ifdef HAVE_STRING_H -#include -#else -#ifdef HAVE_STRINGS_H -#include -#endif -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif], -[char *(*pfn) = (char *(*)) $1], -libiberty_cv_decl_needed_$1=no, libiberty_cv_decl_needed_$1=yes)]) -AC_MSG_RESULT($libiberty_cv_decl_needed_$1) -if test $libiberty_cv_decl_needed_$1 = yes; then - AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1, - [Define if $1 is not declared in system header files.]) -fi -])dnl - -# We always want a C version of alloca() compiled into libiberty, -# because native-compiler support for the real alloca is so !@#$% -# unreliable that GCC has decided to use it only when being compiled -# by GCC. This is the part of AC_FUNC_ALLOCA that calculates the -# information alloca.c needs. -AC_DEFUN(libiberty_AC_FUNC_C_ALLOCA, -[AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray, -[AC_EGREP_CPP(webecray, -[#if defined(CRAY) && ! defined(CRAY2) -webecray -#else -wenotbecray -#endif -], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) -if test $ac_cv_os_cray = yes; then - for ac_func in _getb67 GETB67 getb67; do - AC_CHECK_FUNC($ac_func, - [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, - [Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP - systems. This function is required for alloca.c support on those - systems.]) break]) - done -fi - -AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, -[AC_TRY_RUN([find_stack_direction () -{ - static char *addr = 0; - auto char dummy; - if (addr == 0) - { - addr = &dummy; - return find_stack_direction (); - } - else - return (&dummy > addr) ? 1 : -1; -} -main () -{ - exit (find_stack_direction() < 0); -}], - ac_cv_c_stack_direction=1, - ac_cv_c_stack_direction=-1, - ac_cv_c_stack_direction=0)]) -AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction, - [Define if you know the direction of stack growth for your system; - otherwise it will be automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown]) -]) +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- + +# Copyright (C) 1996-2017 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_include([../config/acx.m4]) +m4_include([../config/cet.m4]) +m4_include([../config/enable.m4]) +m4_include([../config/no-executables.m4]) +m4_include([../config/picflag.m4]) +m4_include([../config/warnings.m4]) +m4_include([acinclude.m4]) diff --git a/libiberty/argv.c b/libiberty/argv.c index cd97f9071c2..48dcd102461 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -442,7 +442,10 @@ expandargv (int *argcp, char ***argvp) due to CR/LF->CR translation when reading text files. That does not in-and-of itself indicate failure. */ && ferror (f)) - goto error; + { + free (buffer); + goto error; + } /* Add a NUL terminator. */ buffer[len] = '\0'; /* If the file is empty or contains only whitespace, buildargv would diff --git a/libiberty/configure b/libiberty/configure index 29a690d44fc..f7449d6a368 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 @@ -683,6 +681,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -762,6 +761,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 +1014,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 +1160,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 +1313,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] @@ -2460,9 +2470,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - # This works around the fact that libtool configuration may change LD # for this particular configuration, but some shells, instead of # keeping the changes in LD private, export them just because LD is @@ -2934,144 +2941,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. @@ -4426,7 +4295,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4472,7 +4341,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4496,7 +4365,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4541,7 +4410,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -4565,7 +4434,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -6731,6 +6600,22 @@ if test -z "${setobjs}"; then ac_cv_func_getpagesize=yes ;; + hppa*-*-hpux*) + # Replace system snprintf and vsnprintf with libiberty implementations. + case " $LIBOBJS " in + *" snprintf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS snprintf.$ac_objext" + ;; +esac + + case " $LIBOBJS " in + *" vsnprintf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS vsnprintf.$ac_objext" + ;; +esac + + ;; + *-*-mingw32*) # Under mingw32, sys_nerr and sys_errlist exist, but they are # macros, so the test below won't find them. @@ -7192,11 +7077,11 @@ else fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int *p; +extern int $v []; int main () { -extern int $v []; p = $v; +if ($v [0]) return 1; ; return 0; } @@ -7690,6 +7575,8 @@ main () if (*(data + i) != *(data3 + i)) return 14; close (fd); + free (data); + free (data3); return 0; } _ACEOF diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 756d11a8260..a85ff25501a 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -108,18 +108,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 @@ -623,6 +611,12 @@ if test -z "${setobjs}"; then ac_cv_func_getpagesize=yes ;; + hppa*-*-hpux*) + # Replace system snprintf and vsnprintf with libiberty implementations. + AC_LIBOBJ([snprintf]) + AC_LIBOBJ([vsnprintf]) + ;; + *-*-mingw32*) # Under mingw32, sys_nerr and sys_errlist exist, but they are # macros, so the test below won't find them. @@ -677,7 +671,7 @@ if test -z "${setobjs}"; then for v in $vars; do AC_MSG_CHECKING([for $v]) AC_CACHE_VAL(libiberty_cv_var_$v, - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[int *p;]],[[extern int $v []; p = $v;]])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int $v [];]],[[if ($v [0]) return 1;]])], [eval "libiberty_cv_var_$v=yes"], [eval "libiberty_cv_var_$v=no"])]) if eval "test \"`echo '$libiberty_cv_var_'$v`\" = yes"; then diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index d3e798455cc..33490f60285 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -815,6 +815,9 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_LITERAL_NEG: printf ("negative literal\n"); break; + case DEMANGLE_COMPONENT_VENDOR_EXPR: + printf ("vendor expression\n"); + break; case DEMANGLE_COMPONENT_JAVA_RESOURCE: printf ("java resource\n"); break; @@ -976,6 +979,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_TRINARY_ARG1: case DEMANGLE_COMPONENT_LITERAL: case DEMANGLE_COMPONENT_LITERAL_NEG: + case DEMANGLE_COMPONENT_VENDOR_EXPR: case DEMANGLE_COMPONENT_COMPOUND_NAME: case DEMANGLE_COMPONENT_VECTOR_TYPE: case DEMANGLE_COMPONENT_CLONE: @@ -3344,6 +3348,7 @@ d_unresolved_name (struct d_info *di) ::= cl + E ::= st ::= + ::= u * E # vendor extended expression ::= ::= @@ -3425,6 +3430,15 @@ d_expression_1 (struct d_info *di) return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST, type, d_exprlist (di, 'E')); } + else if (peek == 'u') + { + /* A vendor extended expression. */ + struct demangle_component *name, *args; + d_advance (di, 1); + name = d_source_name (di); + args = d_template_args_1 (di); + return d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_EXPR, name, args); + } else { struct demangle_component *op; @@ -4229,6 +4243,7 @@ d_count_templates_scopes (struct d_print_info *dpi, case DEMANGLE_COMPONENT_TRINARY_ARG2: case DEMANGLE_COMPONENT_LITERAL: case DEMANGLE_COMPONENT_LITERAL_NEG: + case DEMANGLE_COMPONENT_VENDOR_EXPR: case DEMANGLE_COMPONENT_JAVA_RESOURCE: case DEMANGLE_COMPONENT_COMPOUND_NAME: case DEMANGLE_COMPONENT_DECLTYPE: @@ -5509,18 +5524,9 @@ d_print_comp_inner (struct d_print_info *dpi, int options, } case DEMANGLE_COMPONENT_EXTENDED_OPERATOR: - { - struct demangle_component *name = dc->u.s_extended_operator.name; - if (name->type == DEMANGLE_COMPONENT_NAME - && !strncmp (name->u.s_name.s, "__alignof__", name->u.s_name.len)) - d_print_comp (dpi, options, dc->u.s_extended_operator.name); - else - { - d_append_string (dpi, "operator "); - d_print_comp (dpi, options, dc->u.s_extended_operator.name); - } - return; - } + d_append_string (dpi, "operator "); + d_print_comp (dpi, options, dc->u.s_extended_operator.name); + return; case DEMANGLE_COMPONENT_CONVERSION: d_append_string (dpi, "operator "); @@ -5585,14 +5591,8 @@ d_print_comp_inner (struct d_print_info *dpi, int options, if (code && !strcmp (code, "gs")) /* Avoid parens after '::'. */ d_print_comp (dpi, options, operand); - else if ((code && !strcmp (code, "st")) - || (op->type == DEMANGLE_COMPONENT_EXTENDED_OPERATOR - && (op->u.s_extended_operator.name->type - == DEMANGLE_COMPONENT_NAME) - && !strncmp (op->u.s_extended_operator.name->u.s_name.s, - "__alignof__", - op->u.s_extended_operator.name->u.s_name.len))) - /* Always print parens for sizeof (type) and __alignof__. */ + else if (code && !strcmp (code, "st")) + /* Always print parens for sizeof (type). */ { d_append_char (dpi, '('); d_print_comp (dpi, options, operand); @@ -5805,6 +5805,13 @@ d_print_comp_inner (struct d_print_info *dpi, int options, } return; + case DEMANGLE_COMPONENT_VENDOR_EXPR: + d_print_comp (dpi, options, d_left (dc)); + d_append_char (dpi, '('); + d_print_comp (dpi, options, d_right (dc)); + d_append_char (dpi, ')'); + return; + case DEMANGLE_COMPONENT_NUMBER: d_append_num (dpi, dc->u.s_number.number); return; diff --git a/libiberty/dyn-string.c b/libiberty/dyn-string.c index ea711182ca5..8d2456b86c8 100644 --- a/libiberty/dyn-string.c +++ b/libiberty/dyn-string.c @@ -277,7 +277,7 @@ dyn_string_insert_cstr (dyn_string_t dest, int pos, const char *src) for (i = dest->length; i >= pos; --i) dest->s[i + length] = dest->s[i]; /* Splice in the new stuff. */ - strncpy (dest->s + pos, src, length); + memcpy (dest->s + pos, src, length); /* Compute the new length. */ dest->length += length; return 1; diff --git a/libiberty/make-temp-file.c b/libiberty/make-temp-file.c index 7465cec5ea6..31f87fbcfde 100644 --- a/libiberty/make-temp-file.c +++ b/libiberty/make-temp-file.c @@ -81,8 +81,6 @@ try_dir (const char *dir, const char *base) } static const char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 }; -static const char usrtmp[] = -{ DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 }; static const char vartmp[] = { DIR_SEPARATOR, 'v', 'a', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 }; @@ -129,9 +127,8 @@ choose_tmpdir (void) base = try_dir (P_tmpdir, base); #endif - /* Try /var/tmp, /usr/tmp, then /tmp. */ + /* Try /var/tmp, then /tmp. */ base = try_dir (vartmp, base); - base = try_dir (usrtmp, base); base = try_dir (tmp, base); /* If all else fails, use the current directory! */ diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c index 6fd8f6a4db0..449941b56dc 100644 --- a/libiberty/rust-demangle.c +++ b/libiberty/rust-demangle.c @@ -1253,9 +1253,12 @@ demangle_const_char (struct rust_demangler *rdm) else if (value == '\n') PRINT ("\\n"); else if (value > ' ' && value < '~') - /* Rust also considers many non-ASCII codepoints to be printable, but - that logic is not easily ported to C. */ - print_str (rdm, (char *) &value, 1); + { + /* Rust also considers many non-ASCII codepoints to be printable, but + that logic is not easily ported to C. */ + char c = value; + print_str (rdm, &c, 1); + } else { PRINT ("\\u{"); diff --git a/libiberty/sha1.c b/libiberty/sha1.c index e3d7f86e351..7d15d48d11d 100644 --- a/libiberty/sha1.c +++ b/libiberty/sha1.c @@ -258,7 +258,7 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) { sha1_process_block (ctx->buffer, 64, ctx); left_over -= 64; - memcpy (ctx->buffer, &ctx->buffer[16], left_over); + memmove (ctx->buffer, &ctx->buffer[16], left_over); } ctx->buflen = left_over; } diff --git a/libiberty/simple-object.c b/libiberty/simple-object.c index 6d70b95a00b..facbf94fd09 100644 --- a/libiberty/simple-object.c +++ b/libiberty/simple-object.c @@ -304,6 +304,12 @@ handle_lto_debug_sections (const char *name, int rename) /* Copy over .GCC.command.line section under the same name if present. */ else if (strcmp (name, ".GCC.command.line") == 0) return strcpy (newname, name); + /* Copy over .ctf section under the same name if present. */ + else if (strcmp (name, ".ctf") == 0) + return strcpy (newname, name); + /* Copy over .BTF section under the same name if present. */ + else if (strcmp (name, ".BTF") == 0) + return strcpy (newname, name); free (newname); return NULL; } diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index e6b5b64b9a9..19a0d621bc0 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -1471,10 +1471,10 @@ _Z2F2IZ1FvEUlvE_EN1AIT_E1XES2_ A::X F2(F()::{lambda()#1}) # PR 88115 -_Z1fIiEvDTv111__alignof__T_E +_Z1fIiEvDTu11__alignof__T_EE void f(decltype (__alignof__(int))) -_Z1fIiEvDTv111__alignof__tlT_EE +_Z1fIiEvDTu11__alignof__XtlT_EEEE void f(decltype (__alignof__(int{}))) _Z1gI1AEv1SIXadsrT_oncviEE -- cgit v1.2.1