From b210bec6c566968b09e0d371e3bd15918786d4c5 Mon Sep 17 00:00:00 2001 From: Roman Lakeev Date: Sat, 13 Jul 2019 11:15:36 +0300 Subject: [PATCH] Add abi and abiVersion fields --- src/main/java/net/fornwall/jelf/ElfFile.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/fornwall/jelf/ElfFile.java b/src/main/java/net/fornwall/jelf/ElfFile.java index 632b1d7..05f256e 100644 --- a/src/main/java/net/fornwall/jelf/ElfFile.java +++ b/src/main/java/net/fornwall/jelf/ElfFile.java @@ -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. */ @@ -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(); @@ -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();