aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-01-09 06:43:11 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-01-09 06:51:51 -0800
commit50ad1254d5030d0804cbf89c758359ae202e8d55 (patch)
treed99205ba73874f43469734356f4f2d71ff8e428b
parenta9fd212a2416406f8503efe9e449718d0becfcb2 (diff)
downloadbinutils-50ad1254d5030d0804cbf89c758359ae202e8d55.zip
binutils-50ad1254d5030d0804cbf89c758359ae202e8d55.tar.gz
binutils-50ad1254d5030d0804cbf89c758359ae202e8d55.tar.bz2
GCC: Pass --plugin to AR and RANLIB
Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO build. * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@ (RANLIB): Add @RANLIB_PLUGIN_OPTION@. * configure.ac: Include config/gcc-plugin.m4. AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION. * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and RANLIB if possible. * Makefile.in: Regenerated. * configure: Likewise. config/ * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New. libiberty/ * 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. * configure: Regenerated. zlib/ * configure: Regenerated.
-rw-r--r--ChangeLog11
-rw-r--r--Makefile.in5
-rw-r--r--Makefile.tpl5
-rw-r--r--config/ChangeLog4
-rw-r--r--config/gcc-plugin.m428
-rwxr-xr-xconfigure39
-rw-r--r--configure.ac15
-rw-r--r--libiberty/ChangeLog10
-rw-r--r--libiberty/Makefile.in5
-rw-r--r--libiberty/aclocal.m41
-rwxr-xr-xlibiberty/configure37
-rw-r--r--libiberty/configure.ac12
-rw-r--r--libtool.m425
-rw-r--r--zlib/ChangeLog.bin-gdb4
-rwxr-xr-xzlib/configure27
15 files changed, 219 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 185bde7..6d3d9a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2021-01-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
+ (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
+ * configure.ac: Include config/gcc-plugin.m4.
+ AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
+ * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
+ RANLIB if possible.
+ * Makefile.in: Regenerated.
+ * configure: Likewise.
+
2021-01-09 Nick Clifton <nickc@redhat.com>
* 2.36 release branch crated.
diff --git a/Makefile.in b/Makefile.in
index 4fe7321..a52ff56 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -387,7 +387,7 @@ MAKEINFOFLAGS = --split-size=5000000
# ---------------------------------------------
AS = @AS@
-AR = @AR@
+AR = @AR@ @AR_PLUGIN_OPTION@
AR_FLAGS = rc
CC = @CC@
CXX = @CXX@
@@ -396,7 +396,7 @@ LD = @LD@
LIPO = @LIPO@
NM = @NM@
OBJDUMP = @OBJDUMP@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
READELF = @READELF@
STRIP = @STRIP@
WINDRES = @WINDRES@
@@ -52646,6 +52646,7 @@ AUTOCONF = autoconf
$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
$(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
$(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
+ $(srcdir)/config/gcc-plugin.m4 \
$(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
$(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
cd $(srcdir) && $(AUTOCONF)
diff --git a/Makefile.tpl b/Makefile.tpl
index 5b118a8..a280a14 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -390,7 +390,7 @@ MAKEINFOFLAGS = --split-size=5000000
# ---------------------------------------------
AS = @AS@
-AR = @AR@
+AR = @AR@ @AR_PLUGIN_OPTION@
AR_FLAGS = rc
CC = @CC@
CXX = @CXX@
@@ -399,7 +399,7 @@ LD = @LD@
LIPO = @LIPO@
NM = @NM@
OBJDUMP = @OBJDUMP@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
READELF = @READELF@
STRIP = @STRIP@
WINDRES = @WINDRES@
@@ -1967,6 +1967,7 @@ AUTOCONF = autoconf
$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
$(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
$(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
+ $(srcdir)/config/gcc-plugin.m4 \
$(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
$(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
cd $(srcdir) && $(AUTOCONF)
diff --git a/config/ChangeLog b/config/ChangeLog
index f2be325..1ec5847 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2021-01-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
+
2021-01-09 Nick Clifton <nickc@redhat.com>
* 2.36 release branch crated.
diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
index 8f27871..c5b72e9 100644
--- a/config/gcc-plugin.m4
+++ b/config/gcc-plugin.m4
@@ -124,3 +124,31 @@ AC_DEFUN([GCC_ENABLE_PLUGINS],
fi
fi
])
+
+dnl
+dnl
+dnl GCC_PLUGIN_OPTION
+dnl (SHELL-CODE_HANDLER)
+dnl
+AC_DEFUN([GCC_PLUGIN_OPTION],[dnl
+AC_MSG_CHECKING([for -plugin option])
+
+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 "$plugin_option"; then
+ $1="$plugin_option"
+ AC_MSG_RESULT($plugin_option)
+else
+ AC_MSG_RESULT([no])
+fi
+])
diff --git a/configure b/configure
index 68779fe..4c9297d 100755
--- a/configure
+++ b/configure
@@ -616,6 +616,8 @@ GFORTRAN_FOR_TARGET
GCC_FOR_TARGET
CXX_FOR_TARGET
CC_FOR_TARGET
+RANLIB_PLUGIN_OPTION
+AR_PLUGIN_OPTION
READELF
OBJDUMP
OBJCOPY
@@ -10007,6 +10009,43 @@ 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 "$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
+
+AR_PLUGIN_OPTION=
+RANLIB_PLUGIN_OPTION=
+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
+
+
+
# Target tools.
# Check whether --with-build-time-tools was given.
diff --git a/configure.ac b/configure.ac
index d16a275..7c4bdff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,7 @@ m4_include(config/acx.m4)
m4_include(config/override.m4)
m4_include(config/proginstall.m4)
m4_include(config/elf.m4)
+m4_include(config/gcc-plugin.m4)
m4_include([libtool.m4])
m4_include([ltoptions.m4])
m4_include([ltsugar.m4])
@@ -3376,6 +3377,20 @@ AC_SUBST(CXX)
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
+GCC_PLUGIN_OPTION(PLUGIN_OPTION)
+AR_PLUGIN_OPTION=
+RANLIB_PLUGIN_OPTION=
+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
+AC_SUBST(AR_PLUGIN_OPTION)
+AC_SUBST(RANLIB_PLUGIN_OPTION)
+
# Target tools.
AC_ARG_WITH([build-time-tools],
[AS_HELP_STRING([--with-build-time-tools=PATH],
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index a6f82ef..3fffbc0 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,13 @@
+2021-01-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+ * configure: Regenerated.
+
2021-01-04 Martin Liska <mliska@suse.cz>
* strverscmp.c: Convert to utf8 from iso8859.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 7885909..711e155 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 = @AR@ @AR_PLUGIN_OPTION@
AR_FLAGS = rc
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
-RANLIB = @RANLIB@
+RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
MAKEINFO = @MAKEINFO@
PERL = @PERL@
@@ -485,6 +485,7 @@ configure_deps = $(srcdir)/aclocal.m4 \
$(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 34c0a5b..b2e54d9 100644
--- a/libiberty/aclocal.m4
+++ b/libiberty/aclocal.m4
@@ -1,6 +1,7 @@
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)
diff --git a/libiberty/configure b/libiberty/configure
index b6af9ba..5d7aee3 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -645,6 +645,8 @@ CPPFLAGS
LDFLAGS
CFLAGS
CC
+RANLIB_PLUGIN_OPTION
+AR_PLUGIN_OPTION
RANLIB
AR
host_os
@@ -2932,6 +2934,41 @@ 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 "$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.
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index ad95296..756d11a 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -108,6 +108,18 @@ 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
diff --git a/libtool.m4 b/libtool.m4
index e993b62..3672e95 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1323,8 +1323,26 @@ need_locks="$enable_libtool_lock"
# _LT_CMD_OLD_ARCHIVE
# -------------------
m4_defun([_LT_CMD_OLD_ARCHIVE],
-[AC_CHECK_TOOL(AR, ar, false)
+[plugin_option=
+plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+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
+
+AC_CHECK_TOOL(AR, ar, false)
test -z "$AR" && AR=ar
+if test -n "$plugin_option"; then
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
+ AR="$AR $plugin_option"
+ fi
+fi
test -z "$AR_FLAGS" && AR_FLAGS=cru
_LT_DECL([], [AR], [1], [The archiver])
_LT_DECL([], [AR_FLAGS], [1])
@@ -1335,6 +1353,11 @@ _LT_DECL([], [STRIP], [1], [A symbol stripping program])
AC_CHECK_TOOL(RANLIB, ranlib, :)
test -z "$RANLIB" && RANLIB=:
+if test -n "$plugin_option" && test "$RANLIB" != ":"; then
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB="$RANLIB $plugin_option"
+ fi
+fi
_LT_DECL([], [RANLIB], [1],
[Commands used to install an old-style archive])
diff --git a/zlib/ChangeLog.bin-gdb b/zlib/ChangeLog.bin-gdb
index 57f1ac7..e30e67d 100644
--- a/zlib/ChangeLog.bin-gdb
+++ b/zlib/ChangeLog.bin-gdb
@@ -1,3 +1,7 @@
+2021-01-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
2020-02-19 Andrew Burgess <andrew.burgess@embecosm.com>
* configure: Regenerate.
diff --git a/zlib/configure b/zlib/configure
index b124acf..79a79c5 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -5407,6 +5407,19 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
+plugin_option=
+plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+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
@@ -5500,6 +5513,11 @@ else
fi
test -z "$AR" && AR=ar
+if test -n "$plugin_option"; then
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
+ AR="$AR $plugin_option"
+ fi
+fi
test -z "$AR_FLAGS" && AR_FLAGS=cru
@@ -5704,6 +5722,11 @@ else
fi
test -z "$RANLIB" && RANLIB=:
+if test -n "$plugin_option" && test "$RANLIB" != ":"; then
+ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+ RANLIB="$RANLIB $plugin_option"
+ fi
+fi
@@ -10634,7 +10657,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10637 "configure"
+#line 10660 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10740,7 +10763,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10743 "configure"
+#line 10766 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H