commit:     3c001036637930152c038d084334d9a7311ffc6e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Mar  7 23:41:54 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Mar  8 07:35:55 2019 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=3c001036

configure.ac: add lld detection support

With this change
    $ ./configure CC=clang LDFLAGS='-Wl,--hash-style=gnu -fuse-ld=lld'
    $ make check
exposes 35 test failures

Bug: https://bugs.gentoo.org/672918
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 configure.ac | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8c1866c..3f242b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -344,9 +344,16 @@ try_link() {
        ) 1>&AS_MESSAGE_LOG_FD
 }
 LIBC_PATH=$(AS_IF(
-       dnl GNU linker (bfd & gold)
-       [try_link -Wl,--verbose],
+       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 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],
+       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"
+       [try_link -Wl,--verbose],
+               [$EGREP -o '/[[^ ]]*/libc.so.*' libctest.log | tail -n1],
        dnl Solaris linker
        [try_link -Wl,-m],
                [set -- `$EGREP -o '/[[^ ]]*/libc.so' libctest.log`; echo $1]

Reply via email to