Skip to content

Commit 39f2636

Browse files
More mips reloc support (#18)
1 parent 3224be2 commit 39f2636

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/obj/elf.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const R_PPC_REL24: u32 = 10;
7070
const R_PPC_REL14: u32 = 11;
7171
const R_PPC_EMB_SDA21: u32 = 109;
7272

73+
const R_MIPS_32: u32 = 2;
7374
const R_MIPS_26: u32 = 4;
7475
const R_MIPS_HI16: u32 = 5;
7576
const R_MIPS_LO16: u32 = 6;
@@ -231,6 +232,7 @@ fn relocations_by_section(
231232
}
232233
},
233234
ObjArchitecture::Mips => match kind {
235+
R_MIPS_32 => ObjRelocKind::Mips32,
234236
R_MIPS_26 => ObjRelocKind::Mips26,
235237
R_MIPS_HI16 => ObjRelocKind::MipsHi16,
236238
R_MIPS_LO16 => ObjRelocKind::MipsLo16,
@@ -267,9 +269,11 @@ fn relocations_by_section(
267269
section.data[address as usize..address as usize + 4].try_into()?,
268270
);
269271
match kind {
272+
ObjRelocKind::Absolute => addend * 4,
270273
ObjRelocKind::MipsHi16 | ObjRelocKind::MipsLo16 => {
271274
(addend & 0x0000FFFF) * 4
272275
}
276+
ObjRelocKind::Mips32 => addend * 4,
273277
ObjRelocKind::Mips26 => (addend & 0x03FFFFFF) * 4,
274278
_ => todo!(),
275279
}

src/obj/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ pub enum ObjRelocKind {
133133
// PpcAddr14,
134134
PpcRel14,
135135
PpcEmbSda21,
136+
Mips32,
136137
Mips26,
137138
MipsHi16,
138139
MipsLo16,

src/views/function_diff.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ fn write_reloc(reloc: &ObjReloc, color: Color32, job: &mut LayoutJob) {
5555
ObjRelocKind::Absolute
5656
| ObjRelocKind::PpcRel24
5757
| ObjRelocKind::PpcRel14
58+
| ObjRelocKind::Mips32
5859
| ObjRelocKind::Mips26 => {
5960
write_reloc_name(reloc, color, job);
6061
}

0 commit comments

Comments
 (0)