-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Migrate cross-lang-lto-upstream-rlibs
, long-linker-command-lines
and long-linker-command-lines-cmd-exe
run-make
tests to rmake
#128196
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 all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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,57 @@ | ||
// When using the flag -C linker-plugin-lto, static libraries could lose their upstream object | ||
// files during compilation. This bug was fixed in #53031, and this test compiles a staticlib | ||
// dependent on upstream, checking that the upstream object file still exists after no LTO and | ||
// thin LTO. | ||
// See https://github.com/rust-lang/rust/pull/53031 | ||
|
||
use run_make_support::{ | ||
cwd, has_extension, has_prefix, has_suffix, llvm_ar, rfs, rustc, shallow_find_files, | ||
static_lib_name, | ||
}; | ||
|
||
fn main() { | ||
// The test starts with no LTO enabled. | ||
rustc().input("upstream.rs").arg("-Clinker-plugin-lto").codegen_units(1).run(); | ||
rustc() | ||
.input("staticlib.rs") | ||
.arg("-Clinker-plugin-lto") | ||
.codegen_units(1) | ||
.output(static_lib_name("staticlib")) | ||
.run(); | ||
llvm_ar().extract().arg(static_lib_name("staticlib")).run(); | ||
// Ensure the upstream object file was included. | ||
assert_eq!( | ||
shallow_find_files(cwd(), |path| { | ||
has_prefix(path, "upstream.") && has_suffix(path, ".rcgu.o") | ||
}) | ||
.len(), | ||
1 | ||
); | ||
// Remove all output files that are not source Rust code for cleanup. | ||
for file in shallow_find_files(cwd(), |path| !has_extension(path, "rs")) { | ||
rfs::remove_file(file) | ||
} | ||
|
||
// Check it again, with Thin LTO. | ||
rustc() | ||
.input("upstream.rs") | ||
.arg("-Clinker-plugin-lto") | ||
.codegen_units(1) | ||
.arg("-Clto=thin") | ||
.run(); | ||
rustc() | ||
.input("staticlib.rs") | ||
.arg("-Clinker-plugin-lto") | ||
.codegen_units(1) | ||
.arg("-Clto=thin") | ||
.output(static_lib_name("staticlib")) | ||
.run(); | ||
llvm_ar().extract().arg(static_lib_name("staticlib")).run(); | ||
assert_eq!( | ||
shallow_find_files(cwd(), |path| { | ||
has_prefix(path, "upstream.") && has_suffix(path, ".rcgu.o") | ||
}) | ||
.len(), | ||
1 | ||
); | ||
} |
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
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,26 @@ | ||
// Like the `long-linker-command-lines` test this test attempts to blow | ||
// a command line limit for running the linker. Unlike that test, however, | ||
// this test is testing `cmd.exe` specifically rather than the OS. | ||
// | ||
// Unfortunately, the maximum length of the string that you can use at the | ||
// command prompt (`cmd.exe`) is 8191 characters. | ||
// Anyone scripting rustc's linker | ||
// is probably using a `*.bat` script and is likely to hit this limit. | ||
// | ||
// This test uses a `foo.bat` script as the linker which just simply | ||
// delegates back to this program. The compiler should use a lower | ||
// limit for arguments before passing everything via `@`, which | ||
// means that everything should still succeed here. | ||
// See https://github.com/rust-lang/rust/pull/47507 | ||
|
||
//@ ignore-cross-compile | ||
// Reason: the compiled binary is executed | ||
//@ only-windows | ||
// Reason: this test is specific to Windows executables | ||
|
||
use run_make_support::{run, rustc}; | ||
|
||
fn main() { | ||
rustc().input("foo.rs").arg("-g").run(); | ||
run("foo"); | ||
} |
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
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,19 @@ | ||
// This is a test which attempts to blow out the system limit with how many | ||
// arguments can be passed to a process. This'll successively call rustc with | ||
// larger and larger argument lists in an attempt to find one that's way too | ||
// big for the system at hand. This file itself is then used as a "linker" to | ||
// detect when the process creation succeeds. | ||
// | ||
// Eventually we should see an argument that looks like `@` as we switch from | ||
// passing literal arguments to passing everything in the file. | ||
// See https://github.com/rust-lang/rust/issues/41190 | ||
|
||
//@ ignore-cross-compile | ||
// Reason: the compiled binary is executed | ||
|
||
use run_make_support::{run, rustc}; | ||
|
||
fn main() { | ||
rustc().input("foo.rs").arg("-g").opt().run(); | ||
run("foo"); | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.