Skip to content

Commit

Permalink
Make elfVersion public
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSunyDays authored and fornwall committed Aug 13, 2019
1 parent 9ea17cb commit 7b02901
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/net/fornwall/jelf/ElfFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7b02901

Please sign in to comment.