https://github.com/wanders updated https://github.com/llvm/llvm-project/pull/186250
>From 5a555fb9b865815470ac8305e0646d950ebaa00f Mon Sep 17 00:00:00 2001 From: Anders Waldenborg <[email protected]> Date: Tue, 10 Mar 2026 21:03:52 +0000 Subject: [PATCH] [clang][test] Fix solaris ld driver test to not assume gnu ld location AFAICU This test intends to check that system ld is invoked by clang, and not some other "ld" that happens to be in path. Part of doing that it checked that "/usr/gnu/bin/ld" existed, and if it doesn't the test fails. But not all opensolaris/illumos distributions have it there. E.g SmartOS has gnu ld in /opt/local/bin/. One could build llvm without having gnu ld installed at all, so it would be nice to not require it to be installed to be able to run one single test (which tests that gnu ld is _not_ executed). Instead of requiring a real gnu ld, that causes the test to fail if it executed (due to getting arguments it doesn't understand) this adds a fake "ld" script that always fails and makes the test put that into PATH to make sure it is not picked up. This makes the test pass on systems without gnu ld installed, or where it is installed in a different path. --- clang/test/Driver/Inputs/fake_ld/ld | 5 +++++ clang/test/Driver/solaris-ld-sld.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100755 clang/test/Driver/Inputs/fake_ld/ld diff --git a/clang/test/Driver/Inputs/fake_ld/ld b/clang/test/Driver/Inputs/fake_ld/ld new file mode 100755 index 0000000000000..b8df112f9c2dc --- /dev/null +++ b/clang/test/Driver/Inputs/fake_ld/ld @@ -0,0 +1,5 @@ +#!/bin/sh + +echo "Unexpectedly running fake ld" 1>&2 + +exit 1 diff --git a/clang/test/Driver/solaris-ld-sld.c b/clang/test/Driver/solaris-ld-sld.c index f65153784b769..e5c5d0fc2c83b 100644 --- a/clang/test/Driver/solaris-ld-sld.c +++ b/clang/test/Driver/solaris-ld-sld.c @@ -1,7 +1,7 @@ // REQUIRES: system-solaris -// Check that clang invokes the native ld. +// Check that clang invokes the native ld, not whatever "ld" that happens to be in PATH -// RUN: test -f /usr/gnu/bin/ld && env PATH=/usr/gnu/bin %clang -o %t.o %s +// RUN: env PATH=%S/Inputs/fake_ld/ %clang -v -o %t.o %s int main() { return 0; } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
