From ad669a4d2962ea175624583a1fbdfa806839af7d Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 11 Mar 2019 21:27:08 +0000 Subject: [PATCH v3] 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 --- 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" -- 2.21.0