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:
jyn 2025-12-13 20:23:20 -05:00
parent fe55364329
commit 309e9ec576
3 changed files with 11 additions and 9 deletions

View file

@ -0,0 +1 @@
#![no_std]

View file

@ -1,5 +0,0 @@
#![feature(no_core)]
#![allow(internal_features)]
#![no_core]
#![no_std]
#![no_main]

View file

@ -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");
}