-
Notifications
You must be signed in to change notification settings - Fork 237
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
Support zstd-compressed ELF sections. #626
base: master
Are you sure you want to change the base?
Conversation
This itself will also wait for a bit due to dependency chains. I would rather not have two syns in my dependency tree, so I will be waiting for a version with KillingSpark/zstd-rs#60 |
It also needs rustc-dep-of-std support, right? |
hmm probably. |
.github/workflows/main.yml
Outdated
- run: cargo test | ||
if: contains(matrix.os, 'ubuntu-24.04') | ||
env: | ||
RUSTFLAGS: "-C link-arg=-Wl,--compress-debug-sections=zstd" |
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.
see #627
- os: ubuntu-24.04 | ||
rust: stable | ||
- os: ubuntu-24.04 | ||
rust: beta | ||
- os: ubuntu-24.04 | ||
rust: nightly |
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.
hmm, why are we bumping this? I kinda think we should just bump ahead to a recent ubuntu if we gotta?
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.
--compress-debug-sections=zstd is only available in the binutils/etc that ships with 24.04, not with 20.04 or 22.04.
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.
And no chance of installing that stuff on ubuntu 20 without exploding the world, huh?
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.
I would be scared to try :)
If rust-lld propagates out to the stable branches I think it'll just work there though.
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.
Oh cool. Can you give that a whirl against our CI for nightly + ubuntu 20.04, then?
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.
Looks like that's rust-lang/rust#120953
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.
huh.
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.
...wait, can we just install lld and test with that or something? (not sure if that actually works out with all the versions involved...)
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.
rust-lang/rust#125642 is also good lmao.
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.
According to rust-lang/rust#124129 we can just use -Zlinker-features=-lld
but I feel like rust-lld should be fixed.
# Starting with Ubuntu 22.04 libc6-dbg is needed. | ||
- name: Install libc debug info | ||
run: sudo apt-get install -y libc6-dbg | ||
shell: bash |
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.
which would make this unconditional.
match header.ch_type(self.endian) { | ||
ELFCOMPRESS_ZLIB => { | ||
let size = usize::try_from(header.ch_size(self.endian)).ok()?; | ||
let buf = stash.allocate(size); | ||
decompress_zlib(data.0, buf)?; | ||
return Some(buf); | ||
} | ||
ELFCOMPRESS_ZSTD => { | ||
let size = usize::try_from(header.ch_size(self.endian)).ok()?; | ||
let buf = stash.allocate(size); | ||
decompress_zstd(data.0, buf)?; | ||
return Some(buf); | ||
} | ||
_ => return None, // Unknown compression type. |
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, the actual implementation seems basically fine.
It's also ever-so-slightly nicer to be able to submit PRs to a Rust crate if I want their code to operate differently somehow (run faster, jump higher, whatever) rather than have to also dive into a tangled pile of C, y'know? |
Personally I'd take the dependency that's professionally maintained and used by everyone else on the planet but it's not my crate. |
Alas, no one is really paying for professional maintenance of backtrace-rs, unfortunately. |
zstd has been introduced as an alternative to zlib for the compression of debug sections.[0] Toolchain support is widely present at this time but lack of support in backtrace is a severe limitation on using this feature in Rust programs. This uses a Rust reimplementation of zstd (the ruzstd crate). This has the benefit of simplifying the build process, but this crate is less used and admittedly slower than the zstd crate that binds to the C libzstd. [0] https://maskray.me/blog/2022-09-09-zstd-compressed-debug-sections
zstd has been introduced as an alternative to zlib for the compression of debug sections.[0] Toolchain support is widely present at this time but lack of support in backtrace is a severe limitation on using this feature in Rust programs.
This uses a Rust reimplementation of zstd (the ruzstd crate). This has the benefit of simplifying the build process, but this crate is less used and admittedly slower than the zstd crate that binds to the C libzstd.
[0] https://maskray.me/blog/2022-09-09-zstd-compressed-debug-sections