forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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#128935 - lqd:needs-zstd, r=Kobzol
More work on `zstd` compression r? `@Kobzol` as we've discussed this. This is a draft to show the current approach of supporting zstd in compiletest, and making the tests using it unconditional. Knowing whether llvm/lld was built with `LLVM_ENABLE_ZSTD` is quite hard, so there are two strategies. There are details in the code, and we can discuss this approach. Until we know the config used to build CI artifacts, it seems our options are somewhat limited in any case. zlib compression seems always enabled, so we only check this in its dedicated test, allowing the test to ignore errors due to zstd not being supported. The zstd test is made unconditional in what it tests, by relying on `needs-llvm-zstd` to be ignored when `llvm.libzstd` isn't enabled in `config.toml`. try-job: x86_64-gnu try-job: x86_64-msvc try-job: x86_64-gnu-distcheck
- Loading branch information
Showing
10 changed files
with
175 additions
and
46 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
File renamed without changes.
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
File renamed without changes.
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,42 @@ | ||
// Checks debuginfo compression both for the always-enabled zlib, and when the optional zstd is | ||
// enabled: | ||
// - via rustc's `debuginfo-compression`, | ||
// - and via rust-lld's `compress-debug-sections` | ||
|
||
//@ needs-llvm-zstd: we want LLVM/LLD to be built with zstd support | ||
//@ needs-rust-lld: the system linker will most likely not support zstd | ||
//@ only-linux | ||
//@ ignore-cross-compile | ||
|
||
use run_make_support::{llvm_readobj, run_in_tmpdir, Rustc}; | ||
|
||
fn check_compression(compression: &str, to_find: &str) { | ||
// check compressed debug sections via rustc flag | ||
prepare_and_check(to_find, |rustc| { | ||
rustc.arg(&format!("-Zdebuginfo-compression={compression}")) | ||
}); | ||
|
||
// check compressed debug sections via rust-lld flag | ||
prepare_and_check(to_find, |rustc| { | ||
rustc.link_arg(&format!("-Wl,--compress-debug-sections={compression}")) | ||
}); | ||
} | ||
|
||
fn prepare_and_check<F: FnOnce(&mut Rustc) -> &mut Rustc>(to_find: &str, prepare_rustc: F) { | ||
run_in_tmpdir(|| { | ||
let mut rustc = Rustc::new(); | ||
rustc | ||
.arg("-Zlinker-features=+lld") | ||
.arg("-Clink-self-contained=+linker") | ||
.arg("-Zunstable-options") | ||
.arg("-Cdebuginfo=full") | ||
.input("main.rs"); | ||
prepare_rustc(&mut rustc).run(); | ||
llvm_readobj().arg("-t").arg("main").run().assert_stdout_contains(to_find); | ||
}); | ||
} | ||
|
||
fn main() { | ||
check_compression("zlib", "ZLIB"); | ||
check_compression("zstd", "ZSTD"); | ||
} |
This file was deleted.
Oops, something went wrong.