commit: 18b1979734f57726c0a601ade0505c2e4615947d
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 11 21:27:08 2019 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Mar 13 09:56:33 2019 +0000
URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=18b19797
configure.ac: fix libc.so.6 detection on ld.gold
As reported by Mike Lothian below failed as:
$ ./configure LDFLAGS=-fuse-ld=gold
> checking libc path... configure: error: Unable to determine LIBC PATH
> (/lib64/libc.so.6")
The regression happened in 3c0010366
("configure.ac: add lld detection support")
where "attempt" keyword in verbose linker log was used as a hint
to use bfd or gold output parser. Unfortunately ld.gold uses
"Attempt" spelling.
The change is to use the "[Aa]ttempt" substring matcher.
Tweak the parser to also match on "[Aa]ttempt" explicitly.
Tested on bfd, gold and lld.
Reported-by: Mike Lothian
Bug: https://bugs.gentoo.org/680034
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
configure.ac | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8269b37..ca59928 100644
--- a/configure.ac
+++ b/configure.ac
@@ -345,10 +345,11 @@ try_link() {
}
LIBC_PATH=$(AS_IF(
dnl GNU linker (bfd & gold) searching for
- dnl "attempt to open
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib64/libc.so succeeded"
+ dnl (bfd) "attempt to open
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib64/libc.so succeeded"
+ dnl (gold)
"/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../x86_64-pc-linux-gnu/bin/ld:
Attempt to open /lib64/libc.so.6 succeeded"
dnl if log does not contain "attempt" word then it's not a GNU linker
- [try_link -Wl,--verbose && grep -q attempt libctest.log],
- [$AWK '/ttempt to open/ { if (($(NF-1) ~ /\/libc\.so/) && ($NF
== "succeeded")) LIBC = $(NF-1); }; END {print LIBC}' libctest.log],
+ [try_link -Wl,--verbose && grep -q '[[Aa]]ttempt' libctest.log],
+ [$AWK '/[[Aa]]ttempt to open/ { if (($(NF-1) ~ /\/libc\.so/) &&
($NF == "succeeded")) LIBC = $(NF-1); }; END {print LIBC}' libctest.log],
dnl LLVM lld searching for latest (successful) entry of
dnl "ld.lld:
/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../lib64/libc.so"
dnl "ld.lld: /lib64/libc.so.6"