From c805c62562e2d19116e8a4099c498276ae08aebf Mon Sep 17 00:00:00 2001 From: Rémy Rakic Date: Tue, 6 Sep 2022 17:19:46 +0200 Subject: fix compiletest detection of needs-rust-lld tests for both windows and unixes --- src/tools/compiletest/src/header.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 8f097f47b45..3ff1cbf20cd 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -897,15 +897,27 @@ pub fn make_test_description( let has_hwasan = util::HWASAN_SUPPORTED_TARGETS.contains(&&*config.target); let has_memtag = util::MEMTAG_SUPPORTED_TARGETS.contains(&&*config.target); let has_shadow_call_stack = util::SHADOWCALLSTACK_SUPPORTED_TARGETS.contains(&&*config.target); - // for `-Z gcc-ld=lld` + + // For tests using the `needs-rust-lld` directive (e.g. for `-Zgcc-ld=lld`), we need to find + // whether `rust-lld` is present in the compiler under test. + // + // The --compile-lib-path is the path to host shared libraries, but depends on the OS. For + // example: + // - on linux, it can be /lib + // - on windows, it can be /bin + // + // However, `rust-lld` is only located under the lib path, so we look for it there. let has_rust_lld = config .compile_lib_path + .parent() + .expect("couldn't traverse to the parent of the specified --compile-lib-path") + .join("lib") .join("rustlib") .join(&config.target) .join("bin") - .join("gcc-ld") - .join(if config.host.contains("windows") { "ld.exe" } else { "ld" }) + .join(if config.host.contains("windows") { "rust-lld.exe" } else { "rust-lld" }) .exists(); + iter_header(path, src, &mut |revision, ln| { if revision.is_some() && revision != cfg { return; -- cgit 1.4.1-3-g733a5