-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #125642 - khuey:zstd, r=<try>
Enable zstd for debug compression. Set LLVM_ENABLE_ZSTD alongside LLVM_ENABLE_ZLIB so that --compress-debug-sections=zstd is an option. See #120953
- Loading branch information
Showing
11 changed files
with
143 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Change this file to make users of the `download-ci-llvm` configuration download | ||
a new version of LLVM from CI, even if the LLVM submodule hasn’t changed. | ||
|
||
Last change is for: https://github.com/rust-lang/rust/pull/126298 | ||
Last change is for: https://github.com/rust-lang/rust/pull/125642 |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
hide_output() { | ||
set +x | ||
on_err=" | ||
echo ERROR: An error was encountered with the build. | ||
cat /tmp/zstd_build.log | ||
exit 1 | ||
" | ||
trap "$on_err" ERR | ||
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & | ||
PING_LOOP_PID=$! | ||
"$@" &> /tmp/zstd_build.log | ||
trap - ERR | ||
kill $PING_LOOP_PID | ||
rm /tmp/zstd_build.log | ||
set -x | ||
} | ||
|
||
ZSTD=1.5.6 | ||
curl -L https://github.com/facebook/zstd/releases/download/v$ZSTD/zstd-$ZSTD.tar.gz | tar xzf - | ||
|
||
cd zstd-$ZSTD | ||
CFLAGS=-fPIC hide_output make -j$(nproc) VERBOSE=1 | ||
hide_output make install | ||
|
||
cd .. | ||
rm -rf zstd-$ZSTD |
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 @@ | ||
fn main() {} |
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,39 @@ | ||
// Checks the `compress-debug-sections` option on rust-lld. | ||
|
||
//@ needs-rust-lld | ||
//@ only-linux | ||
//@ ignore-cross-compile | ||
|
||
// FIXME: This test isn't comprehensive and isn't covering all possible combinations. | ||
|
||
use run_make_support::{assert_contains, cmd, llvm_readobj, run_in_tmpdir, rustc}; | ||
|
||
fn check_compression(compression: &str, to_find: &str) { | ||
run_in_tmpdir(|| { | ||
let out = rustc() | ||
.arg("-Zlinker-features=+lld") | ||
.arg("-Clink-self-contained=+linker") | ||
.arg("-Zunstable-options") | ||
.arg("-Cdebuginfo=full") | ||
.link_arg(&format!("-Wl,--compress-debug-sections={compression}")) | ||
.input("main.rs") | ||
.run_unchecked(); | ||
let stderr = out.stderr_utf8(); | ||
if stderr.is_empty() { | ||
llvm_readobj().arg("-t").arg("main").run().assert_stdout_contains(to_find); | ||
} else { | ||
assert_contains( | ||
stderr, | ||
format!( | ||
"LLVM was not built with LLVM_ENABLE_{to_find} \ | ||
or did not find {compression} at build time" | ||
), | ||
); | ||
} | ||
}); | ||
} | ||
|
||
fn main() { | ||
check_compression("zlib", "ZLIB"); | ||
check_compression("zstd", "ZSTD"); | ||
} |