Skip to content

Commit

Permalink
Fix ELF relocation processing
Browse files Browse the repository at this point in the history
Another bug caused by object removing ELF null section / symbol
from their iterators.
  • Loading branch information
encounter committed Oct 18, 2024
1 parent 3ada073 commit fa5068f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/util/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,12 @@ pub fn process_elf(path: &Utf8NativePath) -> Result<ObjInfo> {
// TODO rebuild common symbols
}

for (section_idx, section) in obj_file.sections().enumerate() {
let out_section = match section_indexes[section_idx].and_then(|idx| sections.get_mut(idx)) {
Some(s) => s,
None => continue,
};
for section in obj_file.sections() {
let out_section =
match section_indexes[section.index().0].and_then(|idx| sections.get_mut(idx)) {
Some(s) => s,
None => continue,
};
// Generate relocations
for (address, reloc) in section.relocations() {
let Some(reloc) =
Expand Down

0 comments on commit fa5068f

Please sign in to comment.