[clang] [clang][Driver] Allow -fuse-lld=lld-link when lto is enabled on *windows-msvc targets (PR #113966)

Max Winkler via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 18:49:45 PDT 2024


================
@@ -0,0 +1,15 @@
+// REQUIRES: aarch64-registered-target
+//
+// RUN: echo "int main() {} " > %t.c
+//
+// RUN: %clang --target=aarch64-pc-windows-msvc -O3 -flto -fuse-ld=lld -c %t.c -o %t.o
+// RUN: %clang --target=aarch64-pc-windows-msvc -O3 -flto -fuse-ld=lld -### %t.o 2>&1 | FileCheck %s
+// RUN: %clang --target=aarch64-pc-windows-msvc -O3 -flto=thin -fuse-ld=lld -c %t.c -o %t.o
+// RUN: %clang --target=aarch64-pc-windows-msvc -O3 -flto=thin -fuse-ld=lld -### %t.o 2>&1 | FileCheck %s
+//
+// RUN: %clang --target=aarch64-pc-windows-msvc -O3 -flto -fuse-ld=lld-link -c %t.c -o %t.o
+// RUN: %clang --target=aarch64-pc-windows-msvc -O3 -flto -fuse-ld=lld-link -### %t.o 2>&1 | FileCheck %s
+// RUN: %clang --target=aarch64-pc-windows-msvc -O3 -flto=thin -fuse-ld=lld-link -c %t.c -o %t.o
+// RUN: %clang --target=aarch64-pc-windows-msvc -O3 -flto=thin -fuse-ld=lld-link -### %t.o 2>&1 | FileCheck %s
+//
+// CHECK: "{{.*}}lld-link" "-out:a.exe" "-defaultlib:libcmt" "-defaultlib:oldnames"
----------------
MaxEW707 wrote:

This will most likely fail on windows targets where `lld-link` is `lld-link.exe`.

Probably do something like `"{{.*}}lld-link{{.*}}` to cover any existence of a file extension.

https://github.com/llvm/llvm-project/pull/113966


More information about the cfe-commits mailing list