From fa5068fd6de49cdc0b979c426f9f94b6a4706c79 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 18 Oct 2024 00:24:34 -0600 Subject: [PATCH] Fix ELF relocation processing Another bug caused by object removing ELF null section / symbol from their iterators. --- src/util/elf.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/util/elf.rs b/src/util/elf.rs index a229c83..c50572f 100644 --- a/src/util/elf.rs +++ b/src/util/elf.rs @@ -352,11 +352,12 @@ pub fn process_elf(path: &Utf8NativePath) -> Result { // 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) =