Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore branch-protection-check-IBT run-make test #126720

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/run-make/branch-protection-check-IBT/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ include ../tools.mk

# only-x86_64

# ignore-test
# FIXME(jieyouxu): This test never runs because the `ifeq` check on line 17
# compares `x86` to `x86_64`, which always evaluates to false.
# When the test does run, the compilation does not include `.note.gnu.property`.
# See https://github.com/rust-lang/rust/pull/126720 for more information.

all:
ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86_64)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This compares x86 to x86_64, which always evaluates to false.

$(RUSTC) --target x86_64-unknown-linux-gnu -Z cf-protection=branch -L$(TMPDIR) -C link-args='-nostartfiles' -C save-temps ./main.rs -o $(TMPDIR)/rsmain
Expand Down
31 changes: 31 additions & 0 deletions tests/run-make/branch-protection-check-IBT/_rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Check for GNU Property Note

// How to run this
// python3 x.py test --target x86_64-unknown-linux-gnu tests/run-make/branch-protection-check-IBT/

//@ only-x86_64

//@ ignore-test
// FIXME(jieyouxu): see the FIXME in the Makefile

use run_make_support::llvm_readobj;
use run_make_support::rustc;
use run_make_support::{cwd, env_var};

fn main() {
let llvm_components = env_var("LLVM_COMPONENTS");
if !format!(" {llvm_components} ").contains(" x86 ") {
return;
}

rustc()
.input("main.rs")
.target("x86_64-unknown-linux-gnu")
.arg("-Zcf-protection=branch")
.arg(format!("-L{}", cwd().display()))
.arg("-Clink-args=-nostartfiles")
.arg("-Csave-temps")
.run();

llvm_readobj().arg("-nW").input("main").run().assert_stdout_contains(".note.gnu.property");
}
Loading