don't use no_main and no_core to test IBT
also assert that the property is IBT and not some random other property.
This commit is contained in:
parent
fe55364329
commit
309e9ec576
3 changed files with 11 additions and 9 deletions
1
tests/run-make/branch-protection-check-IBT/lib.rs
Normal file
1
tests/run-make/branch-protection-check-IBT/lib.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
#![no_std]
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
#![feature(no_core)]
|
||||
#![allow(internal_features)]
|
||||
#![no_core]
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
|
@ -41,13 +41,19 @@
|
|||
use run_make_support::{bare_rustc, llvm_readobj};
|
||||
|
||||
fn main() {
|
||||
// `main.rs` is `#![no_std]` to not pull in the currently not-compiled-with-IBT precompiled std.
|
||||
// `lib.rs` is `#![no_std]` to not pull in the currently not-compiled-with-IBT precompiled std.
|
||||
bare_rustc()
|
||||
.input("main.rs")
|
||||
.input("lib.rs")
|
||||
.crate_type("lib")
|
||||
.emit("obj=lib.o")
|
||||
.target("x86_64-unknown-linux-gnu")
|
||||
.arg("-Zcf-protection=branch")
|
||||
.arg("-Clink-args=-nostartfiles")
|
||||
.run();
|
||||
|
||||
llvm_readobj().arg("-nW").input("main").run().assert_stdout_contains(".note.gnu.property");
|
||||
llvm_readobj()
|
||||
.arg("-nW")
|
||||
.input("lib.o")
|
||||
.run()
|
||||
.assert_stdout_contains(".note.gnu.property")
|
||||
.assert_stdout_contains("feature: IBT");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue