| Backport the lld patch in sandbox to Chrome OS sandbox version. |
| Patch is slightly modified from upstream to apply to Chrome OS. |
| |
| https://gitweb.gentoo.org/proj/sandbox.git/patch/?id=3c001036637930152c038d084334d9a7311ffc6e |
| |
| From: Sergei Trofimovich <slyfox@gentoo.org> |
| Date: Thu, 7 Mar 2019 23:41:54 +0000 |
| Subject: 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@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 |
| @@ -352,9 +352,17 @@ try_link() { |
| ) 1>&AS_MESSAGE_LOG_FD |
| } |
| LIBC_PATH=$(AS_IF( |
| - dnl GNU linker (bfd & gold) |
| + dnl GNU linker (bfd & gold) searching for |
| + 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 '[[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" |
| [try_link -Wl,--verbose], |
| - [$AWK '/ttempt to open/ { if (($(NF-1) ~ /\/libc\.so/) && ($NF == "succeeded")) LIBC = $(NF-1); }; END {print LIBC}' libctest.log], |
| + [$EGREP -o '/[[^ ]]*/libc.so.*' libctest.log | tail -n1], |
| dnl Solaris linker |
| [try_link -Wl,-m], |
| [set -- `$EGREP -o '/[[^ ]]*/libc.so' libctest.log`; echo $1] |