aboutsummaryrefslogtreecommitdiff
path: root/libiberty
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 /libiberty
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.
Diffstat (limited to 'libiberty')
-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
5 files changed, 63 insertions, 2 deletions
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