-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Port the 2 rust-lld run-make tests to rmake
#123975
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
96e7d25
add missing lld directive to compiletest
lqd 682535e
add regex to run_make_support
lqd 9779592
port `rust-lld` test to rmake
lqd 8fa6984
port `rust-lld-custom-target` test to rmake
lqd 8acfe9a
add `link_arg` helper to `run_make_support`
lqd af887d3
mention json target specs in `run_make_support`
lqd 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
port
rust-lld test to rmake
also check that turning off the linker feature does not use lld
- Loading branch information
commit 97795923fc06fa3a944337cd5c4461b2c4833cb1
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,64 @@ | ||
| // Test linking using `cc` with `rust-lld`, using the unstable CLI described in MCP 510 | ||
| // see https://github.com/rust-lang/compiler-team/issues/510 for more info | ||
|
|
||
| //@ needs-rust-lld | ||
| //@ ignore-msvc | ||
| //@ ignore-s390x lld does not yet support s390x as target | ||
|
|
||
| extern crate run_make_support; | ||
|
|
||
| use run_make_support::regex::Regex; | ||
| use run_make_support::rustc; | ||
| use std::process::Output; | ||
|
|
||
| fn main() { | ||
| // Opt-in to lld and the self-contained linker, to link with rust-lld. We'll check that by | ||
| // asking the linker to display its version number with a link-arg. | ||
| let output = rustc() | ||
| .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info") | ||
| .arg("-Zlinker-features=+lld") | ||
| .arg("-Clink-self-contained=+linker") | ||
| .arg("-Zunstable-options") | ||
| .arg("-Clink-args=-Wl,-v") | ||
| .input("main.rs") | ||
| .run(); | ||
| assert!( | ||
| find_lld_version_in_logs(output), | ||
| "the LLD version string should be present in the output logs" | ||
| ); | ||
|
|
||
| // It should not be used when we explictly opt-out of lld. | ||
| let output = rustc() | ||
| .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info") | ||
| .arg("-Clink-args=-Wl,-v") | ||
| .arg("-Zlinker-features=-lld") | ||
| .input("main.rs") | ||
| .run(); | ||
| assert!( | ||
| !find_lld_version_in_logs(output), | ||
| "the LLD version string should not be present in the output logs" | ||
| ); | ||
|
|
||
| // While we're here, also check that the last linker feature flag "wins" when passed multiple | ||
| // times to rustc. | ||
| let output = rustc() | ||
| .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info") | ||
| .arg("-Clink-args=-Wl,-v") | ||
| .arg("-Clink-self-contained=+linker") | ||
| .arg("-Zunstable-options") | ||
| .arg("-Zlinker-features=-lld") | ||
| .arg("-Zlinker-features=+lld") | ||
| .arg("-Zlinker-features=-lld,+lld") | ||
| .input("main.rs") | ||
| .run(); | ||
| assert!( | ||
| find_lld_version_in_logs(output), | ||
| "the LLD version string should be present in the output logs" | ||
| ); | ||
| } | ||
|
|
||
| fn find_lld_version_in_logs(output: Output) -> bool { | ||
| let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap(); | ||
| let stderr = std::str::from_utf8(&output.stderr).unwrap(); | ||
| stderr.lines().any(|line| lld_version_re.is_match(line)) | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.