Skip to content

Commit 2c8d446

Browse files
Bleh
1 parent 7a65e07 commit 2c8d446

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

objdiff-core/src/arch/arm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl ArchArm {
162162
}
163163

164164
impl Arch for ArchArm {
165-
fn post_init(&mut self, sections: &[Section], symbols: &[Symbol]) {
165+
fn post_init(&mut self, sections: &[Section], symbols: &[Symbol], _symbol_indices: &[usize]) {
166166
self.disasm_modes = Self::get_mapping_symbols(sections, symbols);
167167
}
168168

objdiff-core/src/arch/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl dyn Arch {
340340

341341
pub trait Arch: Any + Debug + Send + Sync {
342342
/// Finishes arch-specific initialization that must be done after sections have been combined.
343-
fn post_init(&mut self, _sections: &[Section], _symbols: &[Symbol]) {}
343+
fn post_init(&mut self, _sections: &[Section], _symbols: &[Symbol], _symbol_indices: &[usize]) {}
344344

345345
/// Generate a list of instructions references (offset, size, opcode) from the given code.
346346
///

objdiff-core/src/arch/ppc/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,18 @@ impl Arch for ArchPpc {
472472
}
473473
Ok(next_address.saturating_sub(symbol.address))
474474
}
475+
476+
fn post_init(&mut self, _sections: &[Section], _symbols: &[Symbol], symbol_indices: &[usize]) {
477+
// Change the indices used as keys from the original symbol indices to the new symbol array indices
478+
if let Some(extab) = self.extab.as_ref() {
479+
let new_map: BTreeMap<usize, ExceptionInfo> = extab.iter().map(|e| {
480+
(symbol_indices[*e.0 + 1], e.1.clone())
481+
}).collect();
482+
483+
self.extab.replace(new_map);
484+
}
485+
486+
}
475487
}
476488

477489
impl ArchPpc {

objdiff-core/src/obj/read.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ pub fn parse(data: &[u8], config: &DiffObjConfig, diff_side: DiffSide) -> Result
10891089
combine_sections(&mut sections, &mut symbols, config)?;
10901090
}
10911091
add_section_symbols(&sections, &mut symbols);
1092-
arch.post_init(&sections, &symbols);
1092+
arch.post_init(&sections, &symbols, &symbol_indices);
10931093
let mut obj = Object {
10941094
arch,
10951095
endianness: obj_file.endianness(),

0 commit comments

Comments
 (0)