From 767c4b9ef17370622aafdb1eae86c12d962f45ad Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 17 May 2023 10:41:41 +0200 Subject: [PATCH] add support for needs-dynamic-linking --- src/tools/compiletest/src/header/needs.rs | 5 +++++ tests/ui/issues/issue-12133-3.rs | 2 +- tests/ui/issues/issue-85461.rs | 1 + tests/ui/proc-macro/crt-static.rs | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/header/needs.rs b/src/tools/compiletest/src/header/needs.rs index 18b3b913a68..0e306696a90 100644 --- a/src/tools/compiletest/src/header/needs.rs +++ b/src/tools/compiletest/src/header/needs.rs @@ -130,6 +130,11 @@ pub(super) fn handle_needs( condition: config.git_hash, ignore_reason: "ignored when git hashes have been omitted for building", }, + Need { + name: "needs-dynamic-linking", + condition: config.target_cfg().dynamic_linking, + ignore_reason: "ignored on targets without dynamic linking", + }, ]; let (name, comment) = match ln.split_once([':', ' ']) { diff --git a/tests/ui/issues/issue-12133-3.rs b/tests/ui/issues/issue-12133-3.rs index e6b16e2da1d..988b61e3baf 100644 --- a/tests/ui/issues/issue-12133-3.rs +++ b/tests/ui/issues/issue-12133-3.rs @@ -4,7 +4,7 @@ // aux-build:issue-12133-dylib2.rs // ignore-emscripten no dylib support // ignore-musl -// ignore-sgx no dylib support +// needs-dynamic-linking // pretty-expanded FIXME #23616 diff --git a/tests/ui/issues/issue-85461.rs b/tests/ui/issues/issue-85461.rs index 9655108876f..092105df24e 100644 --- a/tests/ui/issues/issue-85461.rs +++ b/tests/ui/issues/issue-85461.rs @@ -1,6 +1,7 @@ // compile-flags: -Cinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0 // build-pass // needs-profiler-support +// needs-dynamic-linking // Regression test for #85461 where MSVC sometimes fails to link instrument-coverage binaries // with dead code and #[inline(always)]. diff --git a/tests/ui/proc-macro/crt-static.rs b/tests/ui/proc-macro/crt-static.rs index 020128fa214..78592f82709 100644 --- a/tests/ui/proc-macro/crt-static.rs +++ b/tests/ui/proc-macro/crt-static.rs @@ -7,6 +7,7 @@ // build-pass // force-host // no-prefer-dynamic +// needs-dynamic-linking #![crate_type = "proc-macro"]