From 309e9ec576099d472fc07b94f1839b31a487cbe5 Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 13 Dec 2025 20:23:20 -0500 Subject: [PATCH] don't use no_main and no_core to test IBT also assert that the property is IBT and not some random other property. --- tests/run-make/branch-protection-check-IBT/lib.rs | 1 + tests/run-make/branch-protection-check-IBT/main.rs | 5 ----- .../run-make/branch-protection-check-IBT/rmake.rs | 14 ++++++++++---- 3 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 tests/run-make/branch-protection-check-IBT/lib.rs delete mode 100644 tests/run-make/branch-protection-check-IBT/main.rs diff --git a/tests/run-make/branch-protection-check-IBT/lib.rs b/tests/run-make/branch-protection-check-IBT/lib.rs new file mode 100644 index 0000000000000..0c9ac1ac8e4bd --- /dev/null +++ b/tests/run-make/branch-protection-check-IBT/lib.rs @@ -0,0 +1 @@ +#![no_std] diff --git a/tests/run-make/branch-protection-check-IBT/main.rs b/tests/run-make/branch-protection-check-IBT/main.rs deleted file mode 100644 index 445b8795134c5..0000000000000 --- a/tests/run-make/branch-protection-check-IBT/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -#![feature(no_core)] -#![allow(internal_features)] -#![no_core] -#![no_std] -#![no_main] diff --git a/tests/run-make/branch-protection-check-IBT/rmake.rs b/tests/run-make/branch-protection-check-IBT/rmake.rs index 73109df12ae9d..34f0693562c0b 100644 --- a/tests/run-make/branch-protection-check-IBT/rmake.rs +++ b/tests/run-make/branch-protection-check-IBT/rmake.rs @@ -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"); }