Skip to content

Commit c3a6809

Browse files
committed
don't use no_main and no_core to test IBT
also assert that the property is IBT and not some random other property.
1 parent fe55364 commit c3a6809

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#![no_std]

tests/run-make/branch-protection-check-IBT/main.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/run-make/branch-protection-check-IBT/rmake.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,16 @@
4141
use run_make_support::{bare_rustc, llvm_readobj};
4242

4343
fn main() {
44-
// `main.rs` is `#![no_std]` to not pull in the currently not-compiled-with-IBT precompiled std.
44+
// `lib.rs` is `#![no_std]` to not pull in the currently not-compiled-with-IBT precompiled std.
4545
bare_rustc()
46-
.input("main.rs")
46+
.input("lib.rs")
47+
.crate_type("lib")
48+
.emit("obj=lib.o")
4749
.target("x86_64-unknown-linux-gnu")
4850
.arg("-Zcf-protection=branch")
49-
.arg("-Clink-args=-nostartfiles")
5051
.run();
5152

52-
llvm_readobj().arg("-nW").input("main").run().assert_stdout_contains(".note.gnu.property");
53+
llvm_readobj().arg("-nW").input("lib.o").run()
54+
.assert_stdout_contains(".note.gnu.property")
55+
.assert_stdout_contains("feature: IBT");
5356
}

0 commit comments

Comments
 (0)