rust/tests/run-make/branch-protection-check-IBT/_rmake.rs
Nicholas Nethercote 84ac80f192 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00

30 lines
798 B
Rust

// Check for GNU Property Note
// How to run this
// python3 x.py test --target x86_64-unknown-linux-gnu tests/run-make/branch-protection-check-IBT/
//@ only-x86_64
//@ ignore-test
// FIXME(jieyouxu): see the FIXME in the Makefile
use run_make_support::{cwd, env_var, llvm_readobj, rustc};
fn main() {
let llvm_components = env_var("LLVM_COMPONENTS");
if !format!(" {llvm_components} ").contains(" x86 ") {
return;
}
rustc()
.input("main.rs")
.target("x86_64-unknown-linux-gnu")
.arg("-Zcf-protection=branch")
.arg(format!("-L{}", cwd().display()))
.arg("-Clink-args=-nostartfiles")
.arg("-Csave-temps")
.run();
llvm_readobj().arg("-nW").input("main").run().assert_stdout_contains(".note.gnu.property");
}