Skip to content

Commit

Permalink
ruzstd: Make optional for now
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Jan 2, 2025
1 parent 426d02d commit 1a37fdb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
if: contains(matrix.os, 'ubuntu')
env:
RUSTFLAGS: "-C link-arg=-Wl,--compress-debug-sections=zlib"
- run: cargo test
- run: cargo test --features "zstd"
if: contains(matrix.os, 'ubuntu-24.04') ||
(contains(matrix.os, 'ubuntu') && contains(matrix.rust, 'nightly'))
env:
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ windows-targets = "0.52.6"

[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies]
miniz_oxide = { version = "0.8", default-features = false }
ruzstd = { version = "0.7.2", default-features = false }
ruzstd = { version = "0.7.2", default-features = false, optional = true }
addr2line = { version = "0.24.0", default-features = false }
libc = { version = "0.2.156", default-features = false }

Expand All @@ -65,6 +65,8 @@ std = []

serialize-serde = ["serde"]

zstd = ["dep:ruzstd"]

#=======================================
# Deprecated/internal features
#
Expand Down
8 changes: 5 additions & 3 deletions src/symbolize/gimli/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use super::{gimli, Context, Endian, EndianSlice, Mapping, Stash, Vec};
use alloc::sync::Arc;
use core::convert::{TryFrom, TryInto};
use core::str;
use object::elf::{
ELFCOMPRESS_ZLIB, ELFCOMPRESS_ZSTD, ELF_NOTE_GNU, NT_GNU_BUILD_ID, SHF_COMPRESSED,
};
#[cfg(any(feature = "zstd", backtrace_ruzstd))]
use object::elf::ELFCOMPRESS_ZSTD;
use object::elf::{ELFCOMPRESS_ZLIB, ELF_NOTE_GNU, NT_GNU_BUILD_ID, SHF_COMPRESSED};
use object::read::elf::{CompressionHeader, FileHeader, SectionHeader, SectionTable, Sym};
use object::read::StringTable;
use object::{BigEndian, Bytes, NativeEndian};
Expand Down Expand Up @@ -231,6 +231,7 @@ impl<'a> Object<'a> {
decompress_zlib(data.0, buf)?;
return Some(buf);
}
#[cfg(any(feature = "zstd", backtrace_ruzstd))]
ELFCOMPRESS_ZSTD => {
let size = usize::try_from(header.ch_size(self.endian)).ok()?;
let buf = stash.allocate(size);
Expand Down Expand Up @@ -357,6 +358,7 @@ fn decompress_zlib(input: &[u8], output: &mut [u8]) -> Option<()> {
}
}

#[cfg(any(feature = "zstd", backtrace_ruzstd))]
fn decompress_zstd(mut input: &[u8], mut output: &mut [u8]) -> Option<()> {
use ruzstd::frame::ReadFrameHeaderError;
use ruzstd::frame_decoder::FrameDecoderError;
Expand Down

0 comments on commit 1a37fdb

Please sign in to comment.