Fix ELF relocation processing

Another bug caused by object removing ELF null section / symbol
from their iterators.
This commit is contained in:
Luke Street 2024-10-18 00:24:34 -06:00
parent 3ada073da1
commit fa5068fd6d
1 changed files with 6 additions and 5 deletions

View File

@ -352,11 +352,12 @@ pub fn process_elf(path: &Utf8NativePath) -> Result<ObjInfo> {
// TODO rebuild common symbols // TODO rebuild common symbols
} }
for (section_idx, section) in obj_file.sections().enumerate() { for section in obj_file.sections() {
let out_section = match section_indexes[section_idx].and_then(|idx| sections.get_mut(idx)) { let out_section =
Some(s) => s, match section_indexes[section.index().0].and_then(|idx| sections.get_mut(idx)) {
None => continue, Some(s) => s,
}; None => continue,
};
// Generate relocations // Generate relocations
for (address, reloc) in section.relocations() { for (address, reloc) in section.relocations() {
let Some(reloc) = let Some(reloc) =