From 052778366ca7bc91d4f0a1a518fcf82613587883 Mon Sep 17 00:00:00 2001 From: Ayrton Date: Sun, 1 May 2022 01:27:54 -0400 Subject: [PATCH] elf: add EF_MIPS_ABI_* e_flags constants --- crates/examples/src/readobj/elf.rs | 7 +++++++ src/elf.rs | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/crates/examples/src/readobj/elf.rs b/crates/examples/src/readobj/elf.rs index 0fef40d2..22068717 100644 --- a/crates/examples/src/readobj/elf.rs +++ b/crates/examples/src/readobj/elf.rs @@ -52,6 +52,7 @@ fn print_file_header(p: &mut Printer<'_>, endian: Elf::Endian, EM_MIPS => { p.flags(flags, 0, &FLAGS_EF_MIPS); p.flags(flags, EF_MIPS_ARCH, &FLAGS_EF_MIPS_ARCH); + p.flags(flags, EF_MIPS_ABI, &FLAGS_EF_MIPS_ABI); } EM_PARISC => { p.flags(flags, 0, &FLAGS_EF_PARISC); @@ -1022,6 +1023,12 @@ static FLAGS_EF_MIPS_ARCH: &[Flag] = &flags!( EF_MIPS_ARCH_32R2, EF_MIPS_ARCH_64R2, ); +static FLAGS_EF_MIPS_ABI: &[Flag] = &flags!( + EF_MIPS_ABI_O32, + EF_MIPS_ABI_O64, + EF_MIPS_ABI_EABI32, + EF_MIPS_ABI_EABI64, +); static FLAGS_EF_PARISC: &[Flag] = &flags!( EF_PARISC_TRAPNIL, EF_PARISC_EXT, diff --git a/src/elf.rs b/src/elf.rs index 73b97292..e69e21eb 100644 --- a/src/elf.rs +++ b/src/elf.rs @@ -2373,6 +2373,17 @@ pub const EF_MIPS_NAN2008: u32 = 1024; /// MIPS architecture level. pub const EF_MIPS_ARCH: u32 = 0xf000_0000; +/// The first MIPS 32 bit ABI +pub const EF_MIPS_ABI_O32: u32 = 0x0000_1000; +/// O32 ABI extended for 64-bit architectures +pub const EF_MIPS_ABI_O64: u32 = 0x0000_2000; +/// EABI in 32-bit mode +pub const EF_MIPS_ABI_EABI32: u32 = 0x0000_3000; +/// EABI in 64-bit mode +pub const EF_MIPS_ABI_EABI64: u32 = 0x0000_4000; +/// Mask for selecting EF_MIPS_ABI_ variant +pub const EF_MIPS_ABI: u32 = 0x0000_f000; + // Legal values for MIPS architecture level. /// -mips1 code.