-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Migrate pointer-auth-link-with-c
, c-dynamic-rlib
and c-dynamic-dylib
run-make
tests to rmake
#127872
Merged
+113
−57
Merged
Migrate pointer-auth-link-with-c
, c-dynamic-rlib
and c-dynamic-dylib
run-make
tests to rmake
#127872
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" }; | ||
jieyouxu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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"); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obviously not a job for here, but maybe run-make should switch from a
&str
-based API toPath
-based so these turn into e.g.path_buf.set_extension(...)
andpath.extension().unwrap()
, rather than manipulating the strings directly. And then just takeimpl AsRef<OsStr>
everywhere so&str
still works.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, feel free to leave a FIXME here for me.