mirror of https://github.com/encounter/objdiff.git
More mips reloc support (#18)
This commit is contained in:
parent
3224be21db
commit
39f263639a
|
@ -70,6 +70,7 @@ const R_PPC_REL24: u32 = 10;
|
||||||
const R_PPC_REL14: u32 = 11;
|
const R_PPC_REL14: u32 = 11;
|
||||||
const R_PPC_EMB_SDA21: u32 = 109;
|
const R_PPC_EMB_SDA21: u32 = 109;
|
||||||
|
|
||||||
|
const R_MIPS_32: u32 = 2;
|
||||||
const R_MIPS_26: u32 = 4;
|
const R_MIPS_26: u32 = 4;
|
||||||
const R_MIPS_HI16: u32 = 5;
|
const R_MIPS_HI16: u32 = 5;
|
||||||
const R_MIPS_LO16: u32 = 6;
|
const R_MIPS_LO16: u32 = 6;
|
||||||
|
@ -231,6 +232,7 @@ fn relocations_by_section(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ObjArchitecture::Mips => match kind {
|
ObjArchitecture::Mips => match kind {
|
||||||
|
R_MIPS_32 => ObjRelocKind::Mips32,
|
||||||
R_MIPS_26 => ObjRelocKind::Mips26,
|
R_MIPS_26 => ObjRelocKind::Mips26,
|
||||||
R_MIPS_HI16 => ObjRelocKind::MipsHi16,
|
R_MIPS_HI16 => ObjRelocKind::MipsHi16,
|
||||||
R_MIPS_LO16 => ObjRelocKind::MipsLo16,
|
R_MIPS_LO16 => ObjRelocKind::MipsLo16,
|
||||||
|
@ -267,9 +269,11 @@ fn relocations_by_section(
|
||||||
section.data[address as usize..address as usize + 4].try_into()?,
|
section.data[address as usize..address as usize + 4].try_into()?,
|
||||||
);
|
);
|
||||||
match kind {
|
match kind {
|
||||||
|
ObjRelocKind::Absolute => addend * 4,
|
||||||
ObjRelocKind::MipsHi16 | ObjRelocKind::MipsLo16 => {
|
ObjRelocKind::MipsHi16 | ObjRelocKind::MipsLo16 => {
|
||||||
(addend & 0x0000FFFF) * 4
|
(addend & 0x0000FFFF) * 4
|
||||||
}
|
}
|
||||||
|
ObjRelocKind::Mips32 => addend * 4,
|
||||||
ObjRelocKind::Mips26 => (addend & 0x03FFFFFF) * 4,
|
ObjRelocKind::Mips26 => (addend & 0x03FFFFFF) * 4,
|
||||||
_ => todo!(),
|
_ => todo!(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ pub enum ObjRelocKind {
|
||||||
// PpcAddr14,
|
// PpcAddr14,
|
||||||
PpcRel14,
|
PpcRel14,
|
||||||
PpcEmbSda21,
|
PpcEmbSda21,
|
||||||
|
Mips32,
|
||||||
Mips26,
|
Mips26,
|
||||||
MipsHi16,
|
MipsHi16,
|
||||||
MipsLo16,
|
MipsLo16,
|
||||||
|
|
|
@ -55,6 +55,7 @@ fn write_reloc(reloc: &ObjReloc, color: Color32, job: &mut LayoutJob) {
|
||||||
ObjRelocKind::Absolute
|
ObjRelocKind::Absolute
|
||||||
| ObjRelocKind::PpcRel24
|
| ObjRelocKind::PpcRel24
|
||||||
| ObjRelocKind::PpcRel14
|
| ObjRelocKind::PpcRel14
|
||||||
|
| ObjRelocKind::Mips32
|
||||||
| ObjRelocKind::Mips26 => {
|
| ObjRelocKind::Mips26 => {
|
||||||
write_reloc_name(reloc, color, job);
|
write_reloc_name(reloc, color, job);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue