Skip to content

Enable xray support for Mac #140790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub(crate) fn target() -> Target {
| SanitizerSet::CFI
| SanitizerSet::LEAK
| SanitizerSet::THREAD,
supports_xray: true,
..opts
},
}
Expand Down
16 changes: 16 additions & 0 deletions tests/assembly/x86_64-xray.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@ assembly-output: emit-asm
//@ compile-flags: --crate-type lib -Zinstrument-xray=always -C llvm-args=-x86-asm-syntax=intel --target x86_64-unknown-linux-gnu
//@ needs-llvm-components: x86
//@ only-x86_64
//@ ignore-sgx

// CHECK-LABEL: xray_func:
#[no_mangle]
pub fn xray_func() {
// CHECK: nop word ptr [rax + rax + 512]

std::hint::black_box(());

// CHECK: ret
// CHECK-NEXT: nop word ptr cs:[rax + rax + 512]
}
27 changes: 27 additions & 0 deletions tests/ui/instrument-xray/platform-support.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//@ only-nightly (flag is still unstable)
//@ needs-xray

//@ revisions: unsupported
//@[unsupported] needs-llvm-components: x86
//@[unsupported] compile-flags: -Z instrument-xray --target=x86_64-pc-windows-msvc

//@ revisions: x86_64-linux
//@[x86_64-linux] needs-llvm-components: x86
//@[x86_64-linux] compile-flags: -Z instrument-xray --target=x86_64-unknown-linux-gnu
//@[x86_64-linux] check-pass

//@ revisions: x86_64-darwin
//@[x86_64-darwin] needs-llvm-components: x86
//@[x86_64-darwin] compile-flags: -Z instrument-xray --target=x86_64-apple-darwin
//@[x86_64-darwin] check-pass

//@ revisions: aarch64-darwin
//@[aarch64-darwin] needs-llvm-components: aarch64
//@[aarch64-darwin] compile-flags: -Z instrument-xray --target=aarch64-apple-darwin
//@[aarch64-darwin] check-pass

#![feature(no_core)]
#![no_core]
#![no_main]

//[unsupported]~? ERROR XRay instrumentation is not supported for this target
10 changes: 0 additions & 10 deletions tests/ui/instrument-xray/target-not-supported.rs

This file was deleted.

Loading