aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-01-11 16:26:39 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-01-11 16:26:51 -0800
commit03c02f3116d75721f917c4155cefb18b940a43ff (patch)
tree36b5214bc5a69ce1860aef06581430a57ee9d063 /config
parenteabdd87b2e8d20941d8bfe0b668d6ae4e5dd737f (diff)
downloadgdb-03c02f3116d75721f917c4155cefb18b940a43ff.zip
gdb-03c02f3116d75721f917c4155cefb18b940a43ff.tar.gz
gdb-03c02f3116d75721f917c4155cefb18b940a43ff.tar.bz2
GCC: Check if AR works with --plugin and rc
AR from older binutils doesn't work with --plugin and rc: [hjl@gnu-cfl-2 bin]$ touch foo.c [hjl@gnu-cfl-2 bin]$ ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c [hjl@gnu-cfl-2 bin]$ ./ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c ./ar: no operation specified [hjl@gnu-cfl-2 bin]$ ./ar --version GNU ar (Linux/GNU Binutils) 2.29.51.0.1.20180112 Copyright (C) 2018 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty. [hjl@gnu-cfl-2 bin]$ Check if AR works with --plugin and rc before passing --plugin to AR and RANLIB. PR ld/27173 * configure: Regenerated. * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Check if AR works with --plugin and rc before enabling --plugin. config/ PR ld/27173 * gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with --plugin and rc before enabling --plugin. libiberty/ PR ld/27173 * configure: Regenerated. zlib/ PR ld/27173 * configure: Regenerated.
Diffstat (limited to 'config')
-rw-r--r--config/ChangeLog6
-rw-r--r--config/gcc-plugin.m412
2 files changed, 18 insertions, 0 deletions
diff --git a/config/ChangeLog b/config/ChangeLog
index 1ec5847..a0c1234 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,9 @@
+2021-01-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/27173
+ * gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with
+ --plugin and rc before enabling --plugin.
+
2021-01-09 H.J. Lu <hongjiu.lu@intel.com>
* gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4
index c5b72e9..ca98d67 100644
--- a/config/gcc-plugin.m4
+++ b/config/gcc-plugin.m4
@@ -145,6 +145,18 @@ for plugin in $plugin_names; do
break
fi
done
+dnl Check if ${AR} $plugin_option rc works.
+AC_CHECK_TOOL(AR, ar)
+if test "${AR}" = "" ; then
+ AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
+fi
+touch conftest.c
+${AR} $plugin_option rc conftest.a conftest.c
+if test "$?" != 0; then
+ AC_MSG_WARN([Failed: $AR $plugin_option rc])
+ plugin_option=
+fi
+rm -f conftest.*
if test -n "$plugin_option"; then
$1="$plugin_option"
AC_MSG_RESULT($plugin_option)