From 9c7797a8c2d707ba4516d3d96d8dff6201476fb6 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 11 Jan 2021 16:26:39 -0800 Subject: 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. ChangeLog: * configure: Regenerated. * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Check if AR works with --plugin and rc before enabling --plugin. config/ChangeLog: * gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with --plugin and rc before enabling --plugin. gcc/ChangeLog: * configure: Regenerate. libatomic/ChangeLog: * configure: Regenerate. libbacktrace/ChangeLog: * configure: Regenerate. libcc1/ChangeLog: * configure: Regenerate. libffi/ChangeLog: * configure: Regenerate. libgfortran/ChangeLog: * configure: Regenerate. libgm2/ChangeLog: * configure: Regenerate. libgomp/ChangeLog: * configure: Regenerate. libiberty/ChangeLog: * configure: Regenerate. libitm/ChangeLog: * configure: Regenerate. libobjc/ChangeLog: * configure: Regenerate. libphobos/ChangeLog: * configure: Regenerate. libquadmath/ChangeLog: * configure: Regenerate. libsanitizer/ChangeLog: * configure: Regenerate. libssp/ChangeLog: * configure: Regenerate. libstdc++-v3/ChangeLog: * configure: Regenerate. libvtv/ChangeLog: * configure: Regenerate. lto-plugin/ChangeLog: * configure: Regenerate. zlib/ChangeLog: * configure: Regenerate. --- config/gcc-plugin.m4 | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'config') diff --git a/config/gcc-plugin.m4 b/config/gcc-plugin.m4 index d782d52..c731a6f 100644 --- a/config/gcc-plugin.m4 +++ b/config/gcc-plugin.m4 @@ -150,6 +150,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) -- cgit v1.1