Skip to content

Commit 22bb95b

Browse files
authored
Update object to 0.36.0. (#633)
1 parent 2273afb commit 22bb95b

File tree

5 files changed

+13
-35
lines changed

5 files changed

+13
-35
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ addr2line = { version = "0.22.0", default-features = false }
4545
libc = { version = "0.2.146", default-features = false }
4646

4747
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies.object]
48-
version = "0.35.0"
48+
version = "0.36.0"
4949
default-features = false
5050
features = ['read_core', 'elf', 'macho', 'pe', 'xcoff', 'unaligned', 'archive']
5151

crates/as-if-std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ miniz_oxide = { version = "0.7.0", optional = true, default-features = false }
2121
addr2line = { version = "0.22.0", optional = true, default-features = false }
2222

2323
[target.'cfg(not(all(windows, target_env = "msvc", not(target_vendor = "uwp"))))'.dependencies.object]
24-
version = "0.35.0"
24+
version = "0.36.0"
2525
default-features = false
2626
optional = true
2727
features = ['read_core', 'elf', 'macho', 'pe', 'xcoff', 'unaligned', 'archive']

src/symbolize/gimli/coff.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,15 @@ impl<'a> Object<'a> {
5151
// note that the sections are 1-indexed because the zero section
5252
// is special (apparently).
5353
let mut symbols = Vec::new();
54-
let mut i = 0;
55-
let len = symtab.len();
56-
while i < len {
57-
let sym = symtab.symbol(i).ok()?;
58-
i += 1 + sym.number_of_aux_symbols as usize;
59-
let section_number = sym.section_number.get(LE);
60-
if sym.derived_type() != object::pe::IMAGE_SYM_DTYPE_FUNCTION || section_number == 0 {
54+
for (_, sym) in symtab.iter() {
55+
if sym.derived_type() != object::pe::IMAGE_SYM_DTYPE_FUNCTION {
6156
continue;
6257
}
58+
let Some(section_index) = sym.section() else {
59+
continue;
60+
};
6361
let addr = usize::try_from(sym.value.get(LE)).ok()?;
64-
let section = sections
65-
.section(usize::try_from(section_number).ok()?)
66-
.ok()?;
62+
let section = sections.section(section_index).ok()?;
6763
let va = usize::try_from(section.virtual_address.get(LE)).ok()?;
6864
symbols.push((addr + va + image_base, sym));
6965
}

src/symbolize/gimli/macho.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -281,20 +281,12 @@ impl<'a> Object<'a> {
281281
}
282282
}
283283

284-
fn object_mapping(path: &[u8]) -> Option<Mapping> {
284+
fn object_mapping(file: &object::read::ObjectMapFile<'_>) -> Option<Mapping> {
285285
use super::mystd::ffi::OsStr;
286286
use super::mystd::os::unix::prelude::*;
287287

288-
let map;
289-
290-
// `N_OSO` symbol names can be either `/path/to/object.o` or `/path/to/archive.a(object.o)`.
291-
let member_name = if let Some((archive_path, member_name)) = split_archive_path(path) {
292-
map = super::mmap(Path::new(OsStr::from_bytes(archive_path)))?;
293-
Some(member_name)
294-
} else {
295-
map = super::mmap(Path::new(OsStr::from_bytes(path)))?;
296-
None
297-
};
288+
let map = super::mmap(Path::new(OsStr::from_bytes(file.path())))?;
289+
let member_name = file.member();
298290
Mapping::mk(map, |data, stash| {
299291
let data = match member_name {
300292
Some(member_name) => {
@@ -314,16 +306,6 @@ fn object_mapping(path: &[u8]) -> Option<Mapping> {
314306
})
315307
}
316308

317-
fn split_archive_path(path: &[u8]) -> Option<(&[u8], &[u8])> {
318-
let (last, path) = path.split_last()?;
319-
if *last != b')' {
320-
return None;
321-
}
322-
let index = path.iter().position(|&x| x == b'(')?;
323-
let (archive, rest) = path.split_at(index);
324-
Some((archive, &rest[1..]))
325-
}
326-
327309
pub(super) fn handle_split_dwarf<'data>(
328310
_package: Option<&gimli::DwarfPackage<EndianSlice<'data, Endian>>>,
329311
_stash: &'data Stash,

0 commit comments

Comments
 (0)