-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable cross compilation on
run-make/relro-levels
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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::llvm_readobj; | ||
use run_make_support::rustc; | ||
use run_make_support::{cwd, env_var}; | ||
|
||
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"); | ||
} |