From 38e37cb79d05d87530c2f3696ecb39f39437ec9e Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Tue, 16 Nov 2021 12:03:19 -0500 Subject: [PATCH 1/2] Support using unversioend lld as linker too On Fedora and RHEL the `lld` executable is the plain unversioned `lld`. That's also usable as a linker if it's recent enough. See https://github.com/dotnet/runtime/pull/58959#issuecomment-933916056 for more details and discussion. --- eng/common/native/init-compiler.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index 8c944f30b28..66655180991 100755 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -112,7 +112,7 @@ if [[ -z "$CC" ]]; then fi if [[ "$compiler" == "clang" ]]; then - if command -v "lld$desired_version" > /dev/null; then + if command -v lld || command -v "lld$desired_version" > /dev/null; then # Only lld version >= 9 can be considered stable if [[ "$majorVersion" -ge 9 ]]; then LDFLAGS="-fuse-ld=lld" From 116fabd25963e77310e3f8487ab8fabb13cb4b94 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Tue, 16 Nov 2021 14:21:33 -0500 Subject: [PATCH 2/2] Query clang's -fuse-ld to decide whether lld is okay to use Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com> --- eng/common/native/init-compiler.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index 66655180991..03a996062a7 100755 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -112,7 +112,7 @@ if [[ -z "$CC" ]]; then fi if [[ "$compiler" == "clang" ]]; then - if command -v lld || command -v "lld$desired_version" > /dev/null; then + if "$CC" -fuse-ld=lld -Wl,--version 2>&1; then # Only lld version >= 9 can be considered stable if [[ "$majorVersion" -ge 9 ]]; then LDFLAGS="-fuse-ld=lld"