Skip to content

Commit

Permalink
elf: add EF_MIPS_ABI_* e_flags constants
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrtonm committed May 1, 2022
1 parent f18fc4b commit a043291
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/examples/src/readobj/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn print_file_header<Elf: FileHeader>(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);
Expand Down Expand Up @@ -1022,6 +1023,12 @@ static FLAGS_EF_MIPS_ARCH: &[Flag<u32>] = &flags!(
EF_MIPS_ARCH_32R2,
EF_MIPS_ARCH_64R2,
);
static FLAGS_EF_MIPS_ABI: &[Flag<u32>] = &flags!(
EF_MIPS_ABI_O32,
EF_MIPS_ABI_O64,
EF_MIPS_ABI_EABI32,
EF_MIPS_ABI_EABI64,
);
static FLAGS_EF_PARISC: &[Flag<u32>] = &flags!(
EF_PARISC_TRAPNIL,
EF_PARISC_EXT,
Expand Down
1 change: 1 addition & 0 deletions crates/examples/testfiles/elf/base-mips64el.o.readobj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FileHeader {
EF_MIPS_PIC (0x2)
EF_MIPS_CPIC (0x4)
EF_MIPS_ARCH_64R2 (0x80000000)
<unknown> (0x0)
HeaderSize: 0x40
ProgramHeaderEntrySize: 0x0
ProgramHeaderCount: 0
Expand Down
1 change: 1 addition & 0 deletions crates/examples/testfiles/elf/base-mips64el.readobj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ FileHeader {
EF_MIPS_PIC (0x2)
EF_MIPS_CPIC (0x4)
EF_MIPS_ARCH_64R2 (0x80000000)
<unknown> (0x0)
HeaderSize: 0x40
ProgramHeaderEntrySize: 0x38
ProgramHeaderCount: 10
Expand Down
11 changes: 11 additions & 0 deletions src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a043291

Please sign in to comment.