Skip to content

Commit e6035b0

Browse files
authored
[MIPS] Add support for the other ABIs supported by rabbitizer (#259)
* [MIPS] Add support for the other abis supported by rabbitizer * update test
1 parent 97bcfe2 commit e6035b0

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

objdiff-core/config-schema.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,25 @@
158158
"value": "o32",
159159
"name": "O32"
160160
},
161+
{
162+
"value": "o64",
163+
"name": "O64"
164+
},
161165
{
162166
"value": "n32",
163167
"name": "N32"
164168
},
165169
{
166170
"value": "n64",
167171
"name": "N64"
172+
},
173+
{
174+
"value": "eabi32",
175+
"name": "eabi32"
176+
},
177+
{
178+
"value": "eabi64",
179+
"name": "eabi64"
168180
}
169181
]
170182
},

objdiff-core/src/arch/mips.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ impl ArchMips {
4646
object::FileFlags::None => {}
4747
object::FileFlags::Elf { e_flags, .. } => {
4848
abi = match e_flags & EF_MIPS_ABI {
49-
elf::EF_MIPS_ABI_O32 | elf::EF_MIPS_ABI_O64 => Abi::O32,
50-
elf::EF_MIPS_ABI_EABI32 | elf::EF_MIPS_ABI_EABI64 => Abi::N32,
49+
elf::EF_MIPS_ABI_O32 => Abi::O32,
50+
elf::EF_MIPS_ABI_O64 if e_flags & elf::EF_MIPS_ABI2 != 0 => Abi::N64,
51+
elf::EF_MIPS_ABI_O64 => Abi::O64,
52+
elf::EF_MIPS_ABI_EABI32 => Abi::EABI32,
53+
elf::EF_MIPS_ABI_EABI64 => Abi::EABI64,
5154
_ => {
5255
if e_flags & elf::EF_MIPS_ABI2 != 0 {
5356
Abi::N32
@@ -170,8 +173,11 @@ impl ArchMips {
170173
.with_abi(match diff_config.mips_abi {
171174
MipsAbi::Auto => self.abi,
172175
MipsAbi::O32 => Abi::O32,
176+
MipsAbi::O64 => Abi::O64,
173177
MipsAbi::N32 => Abi::N32,
174178
MipsAbi::N64 => Abi::N64,
179+
MipsAbi::Eabi32 => Abi::EABI32,
180+
MipsAbi::Eabi64 => Abi::EABI64,
175181
})
176182
}
177183

objdiff-core/tests/snapshots/arch_mips__read_mips.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
source: objdiff-core/tests/arch_mips.rs
3-
assertion_line: 10
3+
assertion_line: 12
44
expression: obj
55
---
66
Object {
77
arch: ArchMips {
88
endianness: Little,
9-
abi: N32,
9+
abi: EABI64,
1010
isa_extension: Some(
1111
R5900EE,
1212
),

0 commit comments

Comments
 (0)