diff --git a/src/obj/elf.rs b/src/obj/elf.rs index dad2f46..6155992 100644 --- a/src/obj/elf.rs +++ b/src/obj/elf.rs @@ -70,6 +70,7 @@ const R_PPC_REL24: u32 = 10; const R_PPC_REL14: u32 = 11; const R_PPC_EMB_SDA21: u32 = 109; +const R_MIPS_32: u32 = 2; const R_MIPS_26: u32 = 4; const R_MIPS_HI16: u32 = 5; const R_MIPS_LO16: u32 = 6; @@ -231,6 +232,7 @@ fn relocations_by_section( } }, ObjArchitecture::Mips => match kind { + R_MIPS_32 => ObjRelocKind::Mips32, R_MIPS_26 => ObjRelocKind::Mips26, R_MIPS_HI16 => ObjRelocKind::MipsHi16, R_MIPS_LO16 => ObjRelocKind::MipsLo16, @@ -267,9 +269,11 @@ fn relocations_by_section( section.data[address as usize..address as usize + 4].try_into()?, ); match kind { + ObjRelocKind::Absolute => addend * 4, ObjRelocKind::MipsHi16 | ObjRelocKind::MipsLo16 => { (addend & 0x0000FFFF) * 4 } + ObjRelocKind::Mips32 => addend * 4, ObjRelocKind::Mips26 => (addend & 0x03FFFFFF) * 4, _ => todo!(), } diff --git a/src/obj/mod.rs b/src/obj/mod.rs index 89521a2..9b32de8 100644 --- a/src/obj/mod.rs +++ b/src/obj/mod.rs @@ -133,6 +133,7 @@ pub enum ObjRelocKind { // PpcAddr14, PpcRel14, PpcEmbSda21, + Mips32, Mips26, MipsHi16, MipsLo16, diff --git a/src/views/function_diff.rs b/src/views/function_diff.rs index e55063b..983ac2d 100644 --- a/src/views/function_diff.rs +++ b/src/views/function_diff.rs @@ -55,6 +55,7 @@ fn write_reloc(reloc: &ObjReloc, color: Color32, job: &mut LayoutJob) { ObjRelocKind::Absolute | ObjRelocKind::PpcRel24 | ObjRelocKind::PpcRel14 + | ObjRelocKind::Mips32 | ObjRelocKind::Mips26 => { write_reloc_name(reloc, color, job); }