Skip to content

Commit 1b7cc44

Browse files
authored
Rollup merge of #149969 - jyn514:ibt, r=jieyouxu
don't use no_main and no_core to test IBT The previous test was quite fragile and depended on a bunch of internal features. Simplify it. Split out of #149937. cc ``@jieyouxu`` ``@Oneirical``
2 parents 21974c5 + 309e9ec commit 1b7cc44

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-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: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,19 @@
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()
54+
.arg("-nW")
55+
.input("lib.o")
56+
.run()
57+
.assert_stdout_contains(".note.gnu.property")
58+
.assert_stdout_contains("feature: IBT");
5359
}

0 commit comments

Comments
 (0)