26package org.jau.sys.elf;
28import static org.jau.sys.elf.IOUtils.readBytes;
30import java.io.IOException;
31import java.io.RandomAccessFile;
32import java.nio.ByteBuffer;
34import org.jau.sys.Debug;
35import org.jau.sys.MachineDataInfo;
36import org.jau.sys.PlatformTypes.ABIType;
37import org.jau.sys.PlatformTypes.CPUType;
38import org.jau.sys.PlatformTypes.OSType;
59public class ElfHeaderPart1 {
60 static final boolean DEBUG =
Debug.
debug(
"Platform");
186 public static final short EM_SH = 42;
235 public static final short EM_PJ = 91;
247 public static final short EM_CR = 103;
263 public static final short EM_CE = 119;
292 public static final short EM_RX = 173;
320 private final byte[] E_ident;
338 public static ElfHeaderPart1
read(
final OSType osType,
final RandomAccessFile in)
throws IOException, IllegalArgumentException {
339 return new ElfHeaderPart1(osType, in);
348 ElfHeaderPart1(
final OSType osType,
final RandomAccessFile in)
throws IllegalArgumentException, IOException {
351 readBytes (in, buf, 0, buf.length);
352 final ByteBuffer eh1Bytes = ByteBuffer.wrap(buf, 0, buf.length);
355 E_ident =
raw.
getE_ident(0,
new byte[Ehdr_p1.getE_identArrayLength()]);
357 throw new IllegalArgumentException(
"Buffer is not an ELF Header");
430 throw new IllegalArgumentException(
"CPUType and ABIType could not be determined");
432 machDesc = MachineDataInfo.guessStaticMachineDataInfo(osType,
cpuType);
489 return raw.getE_type();
494 return raw.getE_machine();
504 default: encS =
"NON";
break;
509 case ET_REL: typeS =
"reloc";
break;
510 case ET_EXEC: typeS =
"exec";
break;
511 case ET_DYN: typeS =
"shared";
break;
512 case ET_CORE: typeS =
"core";
break;
513 default: typeS =
"none";
break;
Helper routines for logging and debugging.
static final boolean debug(final String subcomponent)
ByteBuffer getE_ident()
Getter for native field: CType['char *', size [fixed false, lnx64 16], [array*1]],...
Static enumeration of MachineDataInfo instances used for high performance data size and alignment loo...