Skip to content

Commit 1a37fdb

Browse files
ruzstd: Make optional for now
1 parent 426d02d commit 1a37fdb

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
if: contains(matrix.os, 'ubuntu')
9393
env:
9494
RUSTFLAGS: "-C link-arg=-Wl,--compress-debug-sections=zlib"
95-
- run: cargo test
95+
- run: cargo test --features "zstd"
9696
if: contains(matrix.os, 'ubuntu-24.04') ||
9797
(contains(matrix.os, 'ubuntu') && contains(matrix.rust, 'nightly'))
9898
env:

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ windows-targets = "0.52.6"
4343

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

@@ -65,6 +65,8 @@ std = []
6565

6666
serialize-serde = ["serde"]
6767

68+
zstd = ["dep:ruzstd"]
69+
6870
#=======================================
6971
# Deprecated/internal features
7072
#

src/symbolize/gimli/elf.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use super::{gimli, Context, Endian, EndianSlice, Mapping, Stash, Vec};
99
use alloc::sync::Arc;
1010
use core::convert::{TryFrom, TryInto};
1111
use core::str;
12-
use object::elf::{
13-
ELFCOMPRESS_ZLIB, ELFCOMPRESS_ZSTD, ELF_NOTE_GNU, NT_GNU_BUILD_ID, SHF_COMPRESSED,
14-
};
12+
#[cfg(any(feature = "zstd", backtrace_ruzstd))]
13+
use object::elf::ELFCOMPRESS_ZSTD;
14+
use object::elf::{ELFCOMPRESS_ZLIB, ELF_NOTE_GNU, NT_GNU_BUILD_ID, SHF_COMPRESSED};
1515
use object::read::elf::{CompressionHeader, FileHeader, SectionHeader, SectionTable, Sym};
1616
use object::read::StringTable;
1717
use object::{BigEndian, Bytes, NativeEndian};
@@ -231,6 +231,7 @@ impl<'a> Object<'a> {
231231
decompress_zlib(data.0, buf)?;
232232
return Some(buf);
233233
}
234+
#[cfg(any(feature = "zstd", backtrace_ruzstd))]
234235
ELFCOMPRESS_ZSTD => {
235236
let size = usize::try_from(header.ch_size(self.endian)).ok()?;
236237
let buf = stash.allocate(size);
@@ -357,6 +358,7 @@ fn decompress_zlib(input: &[u8], output: &mut [u8]) -> Option<()> {
357358
}
358359
}
359360

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

0 commit comments

Comments
 (0)