Skip to content

Commit 203c81e

Browse files
committed
Add compiler tests for xray
1 parent a715655 commit 203c81e

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

tests/assembly/x86_64-xray.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ assembly-output: emit-asm
2+
//@ compile-flags: --crate-type lib -Zinstrument-xray=always -C llvm-args=-x86-asm-syntax=intel
3+
//@ only-x86_64
4+
//@ ignore-sgx
5+
6+
// CHECK-LABEL: xray_func:
7+
#[no_mangle]
8+
pub fn xray_func() {
9+
// CHECK: nop word ptr [rax + rax + 512]
10+
11+
std::hint::black_box(());
12+
13+
// CHECK: ret
14+
// CHECK-NEXT: nop word ptr cs:[rax + rax + 512]
15+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Verify that this is still an unstable flag on supported targets
2+
//
3+
//@ needs-llvm-components: x86
4+
//@ rustc-env:RUSTC_BOOTSTRAP=-1
5+
//@ compile-flags: -Z instrument-xray --target x86_64-unknown-linux-gnu
6+
7+
#![feature(no_core)]
8+
#![no_core]
9+
#![no_main]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: the option `Z` is only accepted on the nightly compiler
2+
3+
help: consider switching to a nightly toolchain: `rustup default nightly`
4+
5+
note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see <https://rust-lang.github.io/rustup/concepts/index.html>
6+
7+
note: for more information about Rust's stability policy, see <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features>
8+
9+
error: 1 nightly option were parsed
10+

0 commit comments

Comments
 (0)