Skip to content

Commit a3d3b19

Browse files
committed
rewrite pointer-auth-link-with-c to rmake
1 parent f00f850 commit a3d3b19

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ run-make/pdb-buildinfo-cl-cmd/Makefile
8888
run-make/pgo-gen-lto/Makefile
8989
run-make/pgo-gen-no-imp-symbols/Makefile
9090
run-make/pgo-indirect-call-promotion/Makefile
91-
run-make/pointer-auth-link-with-c/Makefile
9291
run-make/print-calling-conventions/Makefile
9392
run-make/print-target-list/Makefile
9493
run-make/raw-dylib-alt-calling-convention/Makefile

tests/run-make/pointer-auth-link-with-c/Makefile

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// `-Z branch protection` is an unstable compiler feature which adds pointer-authentication
2+
// code (PAC), a useful hashing measure for verifying that pointers have not been modified.
3+
// This test checks that compilation and execution is successful when this feature is activated,
4+
// with some of its possible extra arguments (bti, pac-ret, leaf).
5+
// See https://github.com/rust-lang/rust/pull/88354
6+
7+
//@ only-aarch64
8+
// Reason: branch protection is not supported on other architectures
9+
//@ ignore-cross-compile
10+
// Reason: the compiled binary is executed
11+
12+
use run_make_support::{build_native_static_lib, cc, is_msvc, llvm_ar, run, rustc};
13+
14+
fn main() {
15+
build_native_static_lib("test");
16+
rustc().arg("-Zbranch-protection=bti,pac-ret,leaf").input("test.rs").run();
17+
run("test");
18+
cc().arg("-v")
19+
.arg("-c")
20+
.out_exe("test")
21+
.input("test.c")
22+
.arg("-mbranch-protection=bti+pac-ret+leaf")
23+
.run();
24+
let obj_file = if is_msvc() { "test.obj" } else { "test" };
25+
llvm_ar().obj_to_ar().output_input("libtest.a", &obj_file).run();
26+
rustc().arg("-Zbranch-protection=bti,pac-ret,leaf").input("test.rs").run();
27+
run("test");
28+
}

0 commit comments

Comments
 (0)