Skip to content

Commit

Permalink
Add abi and abiVersion fields
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSunyDays authored and fornwall committed Aug 13, 2019
1 parent 7b02901 commit b210bec
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/net/fornwall/jelf/ElfFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public final class ElfFile {
public final byte encoding;

public final byte elfVersion;
public final byte abi;
public final byte abiVersion;

/** Identifies the object file type. One of the FT_* constants in the class. */
public final short file_type; // Elf32_Half
/** The required architecture. One of the ARCH_* constants in the class. */
Expand Down Expand Up @@ -309,8 +312,8 @@ public ElfFile(MappedByteBuffer buffer, long startPosition) throws ElfException,
if (!(encoding == DATA_LSB || encoding == DATA_MSB)) throw new ElfException("Invalid encoding: " + encoding);
elfVersion = ident[6];
if (elfVersion != 1) throw new ElfException("Invalid elf version: " + elfVersion);
// ident[7]; // EI_OSABI, target operating system ABI
// ident[8]; // EI_ABIVERSION, ABI version. Linux kernel (after at least 2.6) has no definition of it.
abi = ident[7]; // EI_OSABI, target operating system ABI
abiVersion = ident[8]; // EI_ABIVERSION, ABI version. Linux kernel (after at least 2.6) has no definition of it.
// ident[9-15] // EI_PAD, currently unused.

file_type = parser.readShort();
Expand Down Expand Up @@ -376,8 +379,8 @@ public ElfFile(ByteArrayInputStream baos) throws ElfException, IOException {
if (!(encoding == DATA_LSB || encoding == DATA_MSB)) throw new ElfException("Invalid encoding: " + encoding);
elfVersion = ident[6];
if (elfVersion != 1) throw new ElfException("Invalid elf version: " + elfVersion);
// ident[7]; // EI_OSABI, target operating system ABI
// ident[8]; // EI_ABIVERSION, ABI version. Linux kernel (after at least 2.6) has no definition of it.
abi = ident[7]; // EI_OSABI, target operating system ABI
abiVersion = ident[8]; // EI_ABIVERSION, ABI version. Linux kernel (after at least 2.6) has no definition of it.
// ident[9-15] // EI_PAD, currently unused.

file_type = parser.readShort();
Expand Down

0 comments on commit b210bec

Please sign in to comment.