diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2021-01-12 03:26:39 +0300 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2022-01-12 16:43:14 +0300 |
commit | 88d86e59701b3a747a55554baeb51369ae52bd18 (patch) | |
tree | 36117c56c47bf0fd868fa5a8fe3d4c97f1c50476 /libtool.m4 | |
parent | d8d5dac0fe978d9b0eed3726b863d176809983cd (diff) |
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 'libtool.m4')
-rw-r--r-- | libtool.m4 | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libtool.m4 b/libtool.m4 index 3672e9516..9a13f3b11 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -1340,7 +1340,14 @@ 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" + touch conftest.c + $AR $plugin_option rc conftest.a conftest.c + if test "$?" != 0; then + AC_MSG_WARN([Failed: $AR $plugin_option rc]) + else + AR="$AR $plugin_option" + fi + rm -f conftest.* fi fi test -z "$AR_FLAGS" && AR_FLAGS=cru |