File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
tests/run-make/branch-protection-check-IBT Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,12 @@ include ../tools.mk
77
88# only-x86_64
99
10+ # ignore-test
11+ # FIXME(jieyouxu): This test never runs because the `ifeq` check on line 17
12+ # compares `x86` to `x86_64`, which always evaluates to false.
13+ # When the test does run, the compilation does not include `.note.gnu.property`.
14+ # See https://github.com/rust-lang/rust/pull/126720 for more information.
15+
1016all :
1117ifeq ($(filter x86,$(LLVM_COMPONENTS ) ) ,x86_64)
1218 $(RUSTC) --target x86_64-unknown-linux-gnu -Z cf-protection=branch -L$(TMPDIR) -C link-args='-nostartfiles' -C save-temps ./main.rs -o $(TMPDIR)/rsmain
Original file line number Diff line number Diff line change 1+ // Check for GNU Property Note
2+
3+ // How to run this
4+ // python3 x.py test --target x86_64-unknown-linux-gnu tests/run-make/branch-protection-check-IBT/
5+
6+ //@ only-x86_64
7+
8+ //@ ignore-test
9+ // FIXME(jieyouxu): see the FIXME in the Makefile
10+
11+ use run_make_support:: llvm_readobj;
12+ use run_make_support:: rustc;
13+ use run_make_support:: { cwd, env_var} ;
14+
15+ fn main ( ) {
16+ let llvm_components = env_var ( "LLVM_COMPONENTS" ) ;
17+ if !format ! ( " {llvm_components} " ) . contains ( " x86 " ) {
18+ return ;
19+ }
20+
21+ rustc ( )
22+ . input ( "main.rs" )
23+ . target ( "x86_64-unknown-linux-gnu" )
24+ . arg ( "-Zcf-protection=branch" )
25+ . arg ( format ! ( "-L{}" , cwd( ) . display( ) ) )
26+ . arg ( "-Clink-args=-nostartfiles" )
27+ . arg ( "-Csave-temps" )
28+ . run ( ) ;
29+
30+ llvm_readobj ( ) . arg ( "-nW" ) . input ( "main" ) . run ( ) . assert_stdout_contains ( ".note.gnu.property" ) ;
31+ }
You can’t perform that action at this time.
0 commit comments