forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#127872 - Oneirical:antestral-traditions, r=…
…jieyouxu Migrate `pointer-auth-link-with-c`, `c-dynamic-rlib` and `c-dynamic-dylib` `run-make` tests to rmake Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Please try: try-job: x86_64-msvc try-job: i686-mingw try-job: aarch64-apple
- Loading branch information
Showing
10 changed files
with
113 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// This test checks that dynamic Rust linking with C does not encounter any errors in both | ||
// compilation and execution, with dynamic dependencies given preference over static. | ||
// See https://github.com/rust-lang/rust/issues/10434 | ||
|
||
//@ ignore-cross-compile | ||
// Reason: the compiled binary is executed | ||
|
||
use run_make_support::{build_native_dynamic_lib, dynamic_lib_name, rfs, run, run_fail, rustc}; | ||
|
||
fn main() { | ||
build_native_dynamic_lib("cfoo"); | ||
rustc().input("foo.rs").arg("-Cprefer-dynamic").run(); | ||
rustc().input("bar.rs").run(); | ||
run("bar"); | ||
rfs::remove_file(dynamic_lib_name("cfoo")); | ||
run_fail("bar"); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// This test checks that dynamic Rust linking with C does not encounter any errors in both | ||
// compilation and execution, with static dependencies given preference over dynamic. | ||
// (This is the default behaviour.) | ||
// See https://github.com/rust-lang/rust/issues/10434 | ||
|
||
//@ ignore-cross-compile | ||
// Reason: the compiled binary is executed | ||
|
||
use run_make_support::{build_native_dynamic_lib, dynamic_lib_name, rfs, run, run_fail, rustc}; | ||
|
||
fn main() { | ||
build_native_dynamic_lib("cfoo"); | ||
rustc().input("foo.rs").run(); | ||
rustc().input("bar.rs").run(); | ||
run("bar"); | ||
rfs::remove_file(dynamic_lib_name("cfoo")); | ||
run_fail("bar"); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// `-Z branch protection` is an unstable compiler feature which adds pointer-authentication | ||
// code (PAC), a useful hashing measure for verifying that pointers have not been modified. | ||
// This test checks that compilation and execution is successful when this feature is activated, | ||
// with some of its possible extra arguments (bti, pac-ret, leaf). | ||
// See https://github.com/rust-lang/rust/pull/88354 | ||
|
||
//@ only-aarch64 | ||
// Reason: branch protection is not supported on other architectures | ||
//@ ignore-cross-compile | ||
// Reason: the compiled binary is executed | ||
|
||
use run_make_support::{build_native_static_lib, cc, is_msvc, llvm_ar, run, rustc}; | ||
|
||
fn main() { | ||
build_native_static_lib("test"); | ||
rustc().arg("-Zbranch-protection=bti,pac-ret,leaf").input("test.rs").run(); | ||
run("test"); | ||
cc().arg("-v") | ||
.arg("-c") | ||
.out_exe("test") | ||
.input("test.c") | ||
.arg("-mbranch-protection=bti+pac-ret+leaf") | ||
.run(); | ||
let obj_file = if is_msvc() { "test.obj" } else { "test" }; | ||
llvm_ar().obj_to_ar().output_input("libtest.a", &obj_file).run(); | ||
rustc().arg("-Zbranch-protection=bti,pac-ret,leaf").input("test.rs").run(); | ||
run("test"); | ||
} |