From c3ab203ec19415f49fdfa27c863b7384a6949d4b Mon Sep 17 00:00:00 2001 From: Ethan Lafrenais Date: Wed, 8 Oct 2025 18:42:03 -0400 Subject: [PATCH 1/3] R_MIPS_GPREL32 Support --- objdiff-core/src/arch/mips.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/objdiff-core/src/arch/mips.rs b/objdiff-core/src/arch/mips.rs index 04779ac4..0a88f544 100644 --- a/objdiff-core/src/arch/mips.rs +++ b/objdiff-core/src/arch/mips.rs @@ -293,6 +293,9 @@ 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 })) From b5846cc1c871257ef93c336fc59c23a74a97864f Mon Sep 17 00:00:00 2001 From: Ethan Lafrenais Date: Wed, 8 Oct 2025 18:47:29 -0400 Subject: [PATCH 2/3] cargo fmt --- objdiff-core/src/arch/mips.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/objdiff-core/src/arch/mips.rs b/objdiff-core/src/arch/mips.rs index 0a88f544..50525edc 100644 --- a/objdiff-core/src/arch/mips.rs +++ b/objdiff-core/src/arch/mips.rs @@ -293,9 +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 - }, + 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 })) From 9123928b76ad1503378aea1ca91398a21cbe1992 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 8 Oct 2025 20:21:47 -0600 Subject: [PATCH 3/3] Add name for R_MIPS_GPREL32 relocation --- objdiff-core/src/arch/mips.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/objdiff-core/src/arch/mips.rs b/objdiff-core/src/arch/mips.rs index 50525edc..0ce2e65b 100644 --- a/objdiff-core/src/arch/mips.rs +++ b/objdiff-core/src/arch/mips.rs @@ -319,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, },