Skip to content

Commit 0dc8f76

Browse files
committed
add more i386 elf relocs
1 parent 7834185 commit 0dc8f76

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

objdiff-core/src/arch/x86.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ impl ArchX86 {
6868
_ => None,
6969
},
7070
RelocationFlags::Elf(typ) => match typ {
71-
elf::R_386_32 | elf::R_386_PC32 => Some(4),
71+
elf::R_386_32
72+
| elf::R_386_PC32
73+
| elf::R_386_GOT32
74+
| elf::R_386_PLT32
75+
| elf::R_386_GOTOFF
76+
| elf::R_386_GOTPC => Some(4),
7277
elf::R_386_16 => Some(2),
7378
_ => None,
7479
},
@@ -272,7 +277,14 @@ impl Arch for ArchX86 {
272277
object::RelocationFlags::Coff {
273278
typ: pe::IMAGE_REL_I386_DIR32 | pe::IMAGE_REL_I386_REL32,
274279
}
275-
| object::RelocationFlags::Elf { r_type: elf::R_386_32 | elf::R_386_PC32 } => {
280+
| object::RelocationFlags::Elf {
281+
r_type: elf::R_386_32
282+
| elf::R_386_PC32
283+
| elf::R_386_GOT32
284+
| elf::R_386_PLT32
285+
| elf::R_386_GOTOFF
286+
| elf::R_386_GOTPC,
287+
} => {
276288
let data =
277289
section.data()?[address as usize..address as usize + 4].try_into()?;
278290
self.endianness.read_i32_bytes(data) as i64
@@ -308,7 +320,16 @@ impl Arch for ArchX86 {
308320
pe::IMAGE_REL_I386_REL32 => Some("IMAGE_REL_I386_REL32"),
309321
_ => None,
310322
},
311-
_ => None,
323+
RelocationFlags::Elf(typ) => match typ {
324+
elf::R_386_32 => Some("R_386_32"),
325+
elf::R_386_PC32 => Some("R_386_PC32"),
326+
elf::R_386_GOT32 => Some("R_386_GOT32"),
327+
elf::R_386_PLT32 => Some("R_386_PLT32"),
328+
elf::R_386_GOTOFF => Some("R_386_GOTOFF"),
329+
elf::R_386_GOTPC => Some("R_386_GOTPC"),
330+
elf::R_386_16 => Some("R_386_16"),
331+
_ => None,
332+
},
312333
},
313334
Architecture::X86_64 => match flags {
314335
RelocationFlags::Coff(typ) => match typ {

0 commit comments

Comments
 (0)