From 7b0290148e5bfac50d42f460ad3dfcd1c4cd5563 Mon Sep 17 00:00:00 2001 From: Roman Lakeev Date: Sat, 13 Jul 2019 11:15:22 +0300 Subject: [PATCH] Make elfVersion public --- src/main/java/net/fornwall/jelf/ElfFile.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/fornwall/jelf/ElfFile.java b/src/main/java/net/fornwall/jelf/ElfFile.java index 85eb663..632b1d7 100644 --- a/src/main/java/net/fornwall/jelf/ElfFile.java +++ b/src/main/java/net/fornwall/jelf/ElfFile.java @@ -72,6 +72,7 @@ public final class ElfFile { */ public final byte encoding; + public final byte elfVersion; /** 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. */ @@ -306,7 +307,7 @@ public ElfFile(MappedByteBuffer buffer, long startPosition) throws ElfException, if (!(objectSize == CLASS_32 || objectSize == CLASS_64)) throw new ElfException("Invalid object size class: " + objectSize); encoding = ident[5]; if (!(encoding == DATA_LSB || encoding == DATA_MSB)) throw new ElfException("Invalid encoding: " + encoding); - int elfVersion = ident[6]; + 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. @@ -373,7 +374,7 @@ public ElfFile(ByteArrayInputStream baos) throws ElfException, IOException { if (!(objectSize == CLASS_32 || objectSize == CLASS_64)) throw new ElfException("Invalid object size class: " + objectSize); encoding = ident[5]; if (!(encoding == DATA_LSB || encoding == DATA_MSB)) throw new ElfException("Invalid encoding: " + encoding); - int elfVersion = ident[6]; + 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.