diff options
| author | bors <bors@rust-lang.org> | 2023-05-28 04:41:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-05-28 04:41:13 +0000 |
| commit | 2560b80a08597e4192aa3ee5a4670e36a5e4a7dd (patch) | |
| tree | ec75c4a52fa5946872d23a4cc34216d775700e3e /src/tools/compiletest | |
| parent | b9c5fdc888e05be88269a47d40fd0d911ec2be0b (diff) | |
| parent | 019d75b44e3f4349495890453d2d154a8f7ba116 (diff) | |
| download | rust-2560b80a08597e4192aa3ee5a4670e36a5e4a7dd.tar.gz rust-2560b80a08597e4192aa3ee5a4670e36a5e4a7dd.zip | |
Auto merge of #112000 - wesleywiser:safestack, r=Amanieu
Add support for LLVM SafeStack Adds support for LLVM [SafeStack] which provides backward edge control flow protection by separating the stack into two parts: data which is only accessed in provable safe ways is allocated on the normal stack (the "safe stack") and all other data is placed in a separate allocation (the "unsafe stack"). SafeStack support is enabled by passing `-Zsanitizer=safestack`. [SafeStack]: https://clang.llvm.org/docs/SafeStack.html cc `@rcvalle` #39699
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/header/needs.rs | 7 | ||||
| -rw-r--r-- | src/tools/compiletest/src/util.rs | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/header/needs.rs b/src/tools/compiletest/src/header/needs.rs index 4a57c61406c..18b3b913a68 100644 --- a/src/tools/compiletest/src/header/needs.rs +++ b/src/tools/compiletest/src/header/needs.rs @@ -71,6 +71,11 @@ pub(super) fn handle_needs( ignore_reason: "ignored on targets without shadow call stacks", }, Need { + name: "needs-sanitizer-safestack", + condition: cache.sanitizer_safestack, + ignore_reason: "ignored on targets without SafeStack support", + }, + Need { name: "needs-run-enabled", condition: config.run_enabled(), ignore_reason: "ignored when running the resulting test binaries is disabled", @@ -184,6 +189,7 @@ pub(super) struct CachedNeedsConditions { sanitizer_hwaddress: bool, sanitizer_memtag: bool, sanitizer_shadow_call_stack: bool, + sanitizer_safestack: bool, xray: bool, rust_lld: bool, i686_dlltool: bool, @@ -220,6 +226,7 @@ impl CachedNeedsConditions { sanitizer_hwaddress: util::HWASAN_SUPPORTED_TARGETS.contains(target), sanitizer_memtag: util::MEMTAG_SUPPORTED_TARGETS.contains(target), sanitizer_shadow_call_stack: util::SHADOWCALLSTACK_SUPPORTED_TARGETS.contains(target), + sanitizer_safestack: util::SAFESTACK_SUPPORTED_TARGETS.contains(target), xray: util::XRAY_SUPPORTED_TARGETS.contains(target), // For tests using the `needs-rust-lld` directive (e.g. for `-Zgcc-ld=lld`), we need to find diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index 748240cc94b..17bed38b65e 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -104,6 +104,8 @@ pub const XRAY_SUPPORTED_TARGETS: &[&str] = &[ "x86_64-unknown-openbsd", ]; +pub const SAFESTACK_SUPPORTED_TARGETS: &[&str] = &["x86_64-unknown-linux-gnu"]; + pub fn make_new_path(path: &str) -> String { assert!(cfg!(windows)); // Windows just uses PATH as the library search path, so we have to |
