[MIPS] Add support for the other ABIs supported by rabbitizer (#259)

* [MIPS] Add support for the other abis supported by rabbitizer

* update test
This commit is contained in:
Anghelo Carvajal 2025-09-10 12:01:08 -03:00 committed by GitHub
parent 97bcfe23d4
commit e6035b00df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 4 deletions

View File

@ -158,6 +158,10 @@
"value": "o32",
"name": "O32"
},
{
"value": "o64",
"name": "O64"
},
{
"value": "n32",
"name": "N32"
@ -165,6 +169,14 @@
{
"value": "n64",
"name": "N64"
},
{
"value": "eabi32",
"name": "eabi32"
},
{
"value": "eabi64",
"name": "eabi64"
}
]
},

View File

@ -46,8 +46,11 @@ impl ArchMips {
object::FileFlags::None => {}
object::FileFlags::Elf { e_flags, .. } => {
abi = match e_flags & EF_MIPS_ABI {
elf::EF_MIPS_ABI_O32 | elf::EF_MIPS_ABI_O64 => Abi::O32,
elf::EF_MIPS_ABI_EABI32 | elf::EF_MIPS_ABI_EABI64 => Abi::N32,
elf::EF_MIPS_ABI_O32 => Abi::O32,
elf::EF_MIPS_ABI_O64 if e_flags & elf::EF_MIPS_ABI2 != 0 => Abi::N64,
elf::EF_MIPS_ABI_O64 => Abi::O64,
elf::EF_MIPS_ABI_EABI32 => Abi::EABI32,
elf::EF_MIPS_ABI_EABI64 => Abi::EABI64,
_ => {
if e_flags & elf::EF_MIPS_ABI2 != 0 {
Abi::N32
@ -170,8 +173,11 @@ impl ArchMips {
.with_abi(match diff_config.mips_abi {
MipsAbi::Auto => self.abi,
MipsAbi::O32 => Abi::O32,
MipsAbi::O64 => Abi::O64,
MipsAbi::N32 => Abi::N32,
MipsAbi::N64 => Abi::N64,
MipsAbi::Eabi32 => Abi::EABI32,
MipsAbi::Eabi64 => Abi::EABI64,
})
}

View File

@ -1,12 +1,12 @@
---
source: objdiff-core/tests/arch_mips.rs
assertion_line: 10
assertion_line: 12
expression: obj
---
Object {
arch: ArchMips {
endianness: Little,
abi: N32,
abi: EABI64,
isa_extension: Some(
R5900EE,
),