From 03f2bcb8b133b50c42a07c48857f861a1a16d5ec Mon Sep 17 00:00:00 2001 From: Ethan Lafrenais Date: Wed, 8 Oct 2025 22:34:35 -0400 Subject: [PATCH] R_MIPS_GPREL32 Support (#270) * R_MIPS_GPREL32 Support * cargo fmt * Add name for R_MIPS_GPREL32 relocation --- objdiff-core/src/arch/mips.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/objdiff-core/src/arch/mips.rs b/objdiff-core/src/arch/mips.rs index 04779ac..0ce2e65 100644 --- a/objdiff-core/src/arch/mips.rs +++ b/objdiff-core/src/arch/mips.rs @@ -293,6 +293,7 @@ impl Arch for ArchMips { } elf::R_MIPS_PC16 => 0, // PC-relative relocation R_MIPS15_S3 => ((code & 0x001FFFC0) >> 3) as i64, + elf::R_MIPS_GPREL32 => (code as i32 as i64) + self.ri_gp_value as i64, flags => bail!("Unsupported MIPS implicit relocation {flags:?}"), }; Ok(Some(RelocationOverride { target: RelocationOverrideTarget::Keep, addend })) @@ -318,6 +319,7 @@ impl Arch for ArchMips { elf::R_MIPS_GOT16 => Some("R_MIPS_GOT16"), elf::R_MIPS_PC16 => Some("R_MIPS_PC16"), elf::R_MIPS_CALL16 => Some("R_MIPS_CALL16"), + elf::R_MIPS_GPREL32 => Some("R_MIPS_GPREL32"), R_MIPS15_S3 => Some("R_MIPS15_S3"), _ => None, },