about summary refs log tree commit diff
diff options
context:
space:
mode:
authorquininer <quininer@live.com>2025-05-08 17:56:09 +0800
committerquininer <quininer@live.com>2025-05-24 15:06:53 +0800
commit1758f07cb832e9a854f34af437878a10f22dae82 (patch)
treed9c6be2e76d2db0200ba3a180fa0739e74f28518
parent105354db48223b7bf799b05d4dd3a412aca7bd05 (diff)
downloadrust-1758f07cb832e9a854f34af437878a10f22dae82.tar.gz
rust-1758f07cb832e9a854f34af437878a10f22dae82.zip
Enable xray support for Mac
* https://maskray.me/blog/2023-06-18-port-llvm-xray-to-apple-systems
* https://github.com/llvm/llvm-project/blob/llvmorg-20.1.4/clang/lib/Driver/XRayArgs.cpp#L31
-rw-r--r--compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs1
-rw-r--r--compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs1
-rw-r--r--tests/ui/instrument-xray/target-not-supported.rs2
3 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs
index d3e0a32c8b8..6587abb2ba7 100644
--- a/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs
@@ -22,6 +22,7 @@ pub(crate) fn target() -> Target {
             max_atomic_width: Some(128),
             // FIXME: The leak sanitizer currently fails the tests, see #88132.
             supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD,
+            supports_xray: true,
             ..opts
         },
     }
diff --git a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
index 2f868e38f1a..64c17054780 100644
--- a/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
+++ b/compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs
@@ -23,6 +23,7 @@ pub(crate) fn target() -> Target {
                 | SanitizerSet::CFI
                 | SanitizerSet::LEAK
                 | SanitizerSet::THREAD,
+            supports_xray: true,
             ..opts
         },
     }
diff --git a/tests/ui/instrument-xray/target-not-supported.rs b/tests/ui/instrument-xray/target-not-supported.rs
index 2045913b186..697db6bd4b7 100644
--- a/tests/ui/instrument-xray/target-not-supported.rs
+++ b/tests/ui/instrument-xray/target-not-supported.rs
@@ -1,7 +1,7 @@
 // Verifies that `-Z instrument-xray` cannot be used with unsupported targets,
 //
 //@ needs-llvm-components: x86
-//@ compile-flags: -Z instrument-xray --target x86_64-apple-darwin
+//@ compile-flags: -Z instrument-xray --target x86_64-pc-windows-msvc
 
 #![feature(no_core)]
 #![no_core]