[PATCH] D92028: Fix driver test from e16c0a9a689719

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 06:46:34 PST 2020


thakis created this revision.
thakis added a reviewer: hans.
thakis requested review of this revision.

The test failed silently if lld wasn't built alongside clang.
But the test uses -###, so the "invalid linker name in -fuse-ld=lld"
diag didn't make clang fail, and something else happened to match
"-demangle", so the test passed.

To fix, pass -B to a directory with two empty +x files (which works
on non-Windows), and look for `"-demangle"` instead of just `-demangle`.
Also force linker_version to 0 and pass a darwin triple.


https://reviews.llvm.org/D92028

Files:
  clang/test/Driver/Inputs/lld/ld64.lld
  clang/test/Driver/Inputs/lld/ld64.lld.darwinnew
  clang/test/Driver/darwin-ld-demangle-lld.c


Index: clang/test/Driver/darwin-ld-demangle-lld.c
===================================================================
--- clang/test/Driver/darwin-ld-demangle-lld.c
+++ clang/test/Driver/darwin-ld-demangle-lld.c
@@ -1,6 +1,11 @@
 // With -fuse-ld=lld, -demangle is always passed to the linker on Darwin.
+// REQUIRES: shell
 
-// RUN: %clang -### -fuse-ld=lld %s 2>&1 | FileCheck %s
+// RUN: %clang --target=x86_64-apple-darwin -### \
+// RUN:   -fuse-ld=lld -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
+// RUN:   | FileCheck %s
 // FIXME: Remove ld.darwinnew once it's the default (and only) mach-o lld.
-// RUN: %clang -### -fuse-ld=lld.darwinnew %s 2>&1 | FileCheck %s
-// CHECK: -demangle
+// RUN: %clang --target=x86_64-apple-darwin -### \
+// RUN:   -fuse-ld=lld.darwinnew -B%S/Inputs/lld -mlinker-version=0 %s 2>&1 \
+// RUN:   | FileCheck %s
+// CHECK: "-demangle"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92028.307335.patch
Type: text/x-patch
Size: 874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201124/76d898b7/attachment.bin>


More information about the cfe-commits mailing list