Skip to content

Commit

Permalink
A couple process_elf fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
encounter committed Oct 13, 2024
1 parent bee4570 commit 8d8d801
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/util/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub fn process_elf(path: &Utf8NativePath) -> Result<ObjInfo> {
.context("While reading .comment section")?;
log::debug!("Loaded .comment section header {:?}", header);
let mut comment_syms = Vec::with_capacity(obj_file.symbols().count());
CommentSym::from_reader(&mut reader, Endian::Big)?; // ELF null symbol
comment_syms.push(CommentSym::from_reader(&mut reader, Endian::Big)?); // ELF null symbol
for symbol in obj_file.symbols() {
let comment_sym = CommentSym::from_reader(&mut reader, Endian::Big)?;
log::debug!("Symbol {:?} -> Comment {:?}", symbol, comment_sym);
Expand Down Expand Up @@ -239,7 +239,9 @@ pub fn process_elf(path: &Utf8NativePath) -> Result<ObjInfo> {
.and_then(|m| m.virtual_addresses.as_ref())
.and_then(|v| v.get(symbol.index().0).cloned())
{
sections[section_index.0].virtual_address = Some(addr);
if let Some(section_index) = section_indexes[section_index.0] {
sections[section_index].virtual_address = Some(addr);
}
}

let section = obj_file.section_by_index(section_index)?;
Expand Down

0 comments on commit 8d8d801

Please sign in to comment.