summaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/common/os/elf/Ehdr.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-02-08 05:12:39 +0100
committerSven Gothel <[email protected]>2013-02-08 05:12:39 +0100
commit2432dbef17c1dc4164f055cf434073bdabf8a6a9 (patch)
tree348a46b246ead8bb508152a96847a62089b72d0c /src/java/jogamp/common/os/elf/Ehdr.java
parent1118cb7182611d0a77764a3c781a1148849b3022 (diff)
Bug 681: Add Basic ELF Header + ARM EABI Section Parsing, allowing to distinguish ARM soft-float/hard-float (part-1)
https://jogamp.org/bugzilla/show_bug.cgi?id=681 + * References: + * <ul> + * <li>http://linux.die.net/man/5/elf</li> + * <li>http://www.sco.com/developers/gabi/latest/contents.html</li> + * <li>http://infocenter.arm.com/ + * <ul> + * <li>ARM IHI 0044E, current through ABI release 2.09</li> + * <li>ARM IHI 0045D, current through ABI release 2.09</li> + * </ul></li> Added self contained jogamp.common.os.elf package w/ entry point class ElfHeader to read a RandomAccessFile and parse it as an ELF file. ELF Parsing completness: - Header: OK - SectionHeader: OK - Section Type SHT_ARM_ATTRIBUTES: OK - Will be read into SectionArmAttributes - Used to distinguisgh soft/hard VFP float Tested manually on: - Linux intel 32bit / 64bit, arm soft-float and hard-float
Diffstat (limited to 'src/java/jogamp/common/os/elf/Ehdr.java')
-rw-r--r--src/java/jogamp/common/os/elf/Ehdr.java179
1 files changed, 179 insertions, 0 deletions
diff --git a/src/java/jogamp/common/os/elf/Ehdr.java b/src/java/jogamp/common/os/elf/Ehdr.java
new file mode 100644
index 0000000..d787f67
--- /dev/null
+++ b/src/java/jogamp/common/os/elf/Ehdr.java
@@ -0,0 +1,179 @@
+/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Thu Feb 07 17:54:18 CET 2013 ----! */
+
+
+package jogamp.common.os.elf;
+
+import java.nio.*;
+
+import com.jogamp.gluegen.runtime.*;
+import com.jogamp.common.os.*;
+import com.jogamp.common.nio.*;
+import jogamp.common.os.MachineDescriptionRuntime;
+
+
+public class Ehdr {
+
+ StructAccessor accessor;
+
+ private static final int mdIdx = MachineDescriptionRuntime.getStatic().ordinal();
+
+ private static final int[] Ehdr_size = new int[] { 52 /* ARMle_EABI */, 52 /* X86_32_UNIX */, 64 /* X86_64_UNIX */, 52 /* X86_32_MACOS */, 52 /* X86_32_WINDOWS */, 64 /* X86_64_WINDOWS */ };
+ private static final int[] e_ident_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* X86_64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */ };
+ private static final int[] e_type_offset = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 16 /* X86_64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */ };
+ private static final int[] e_machine_offset = new int[] { 18 /* ARMle_EABI */, 18 /* X86_32_UNIX */, 18 /* X86_64_UNIX */, 18 /* X86_32_MACOS */, 18 /* X86_32_WINDOWS */, 18 /* X86_64_WINDOWS */ };
+ private static final int[] e_version_offset = new int[] { 20 /* ARMle_EABI */, 20 /* X86_32_UNIX */, 20 /* X86_64_UNIX */, 20 /* X86_32_MACOS */, 20 /* X86_32_WINDOWS */, 20 /* X86_64_WINDOWS */ };
+ private static final int[] e_entry_offset = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 24 /* X86_64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */ };
+ private static final int[] e_phoff_offset = new int[] { 28 /* ARMle_EABI */, 28 /* X86_32_UNIX */, 32 /* X86_64_UNIX */, 28 /* X86_32_MACOS */, 28 /* X86_32_WINDOWS */, 32 /* X86_64_WINDOWS */ };
+ private static final int[] e_shoff_offset = new int[] { 32 /* ARMle_EABI */, 32 /* X86_32_UNIX */, 40 /* X86_64_UNIX */, 32 /* X86_32_MACOS */, 32 /* X86_32_WINDOWS */, 40 /* X86_64_WINDOWS */ };
+ private static final int[] e_flags_offset = new int[] { 36 /* ARMle_EABI */, 36 /* X86_32_UNIX */, 48 /* X86_64_UNIX */, 36 /* X86_32_MACOS */, 36 /* X86_32_WINDOWS */, 48 /* X86_64_WINDOWS */ };
+ private static final int[] e_ehsize_offset = new int[] { 40 /* ARMle_EABI */, 40 /* X86_32_UNIX */, 52 /* X86_64_UNIX */, 40 /* X86_32_MACOS */, 40 /* X86_32_WINDOWS */, 52 /* X86_64_WINDOWS */ };
+ private static final int[] e_phentsize_offset = new int[] { 42 /* ARMle_EABI */, 42 /* X86_32_UNIX */, 54 /* X86_64_UNIX */, 42 /* X86_32_MACOS */, 42 /* X86_32_WINDOWS */, 54 /* X86_64_WINDOWS */ };
+ private static final int[] e_phnum_offset = new int[] { 44 /* ARMle_EABI */, 44 /* X86_32_UNIX */, 56 /* X86_64_UNIX */, 44 /* X86_32_MACOS */, 44 /* X86_32_WINDOWS */, 56 /* X86_64_WINDOWS */ };
+ private static final int[] e_shentsize_offset = new int[] { 46 /* ARMle_EABI */, 46 /* X86_32_UNIX */, 58 /* X86_64_UNIX */, 46 /* X86_32_MACOS */, 46 /* X86_32_WINDOWS */, 58 /* X86_64_WINDOWS */ };
+ private static final int[] e_shnum_offset = new int[] { 48 /* ARMle_EABI */, 48 /* X86_32_UNIX */, 60 /* X86_64_UNIX */, 48 /* X86_32_MACOS */, 48 /* X86_32_WINDOWS */, 60 /* X86_64_WINDOWS */ };
+ private static final int[] e_shstrndx_offset = new int[] { 50 /* ARMle_EABI */, 50 /* X86_32_UNIX */, 62 /* X86_64_UNIX */, 50 /* X86_32_MACOS */, 50 /* X86_32_WINDOWS */, 62 /* X86_64_WINDOWS */ };
+
+ public static int size() {
+ return Ehdr_size[mdIdx];
+ }
+
+ public static Ehdr create() {
+ return create(Buffers.newDirectByteBuffer(size()));
+ }
+
+ public static Ehdr create(java.nio.ByteBuffer buf) {
+ return new Ehdr(buf);
+ }
+
+ Ehdr(java.nio.ByteBuffer buf) {
+ accessor = new StructAccessor(buf);
+ }
+
+ public java.nio.ByteBuffer getBuffer() {
+ return accessor.getBuffer();
+ }
+
+ public Ehdr setE_ident(byte[] val) {
+ accessor.setBytesAt(e_ident_offset[mdIdx], val); return this;
+ }
+
+ public byte[] getE_ident() {
+ return accessor.getBytesAt(e_ident_offset[mdIdx], new byte[16]); }
+
+ public Ehdr setE_type(short val) {
+ accessor.setShortAt(e_type_offset[mdIdx], val);
+ return this;
+ }
+
+ public short getE_type() {
+ return accessor.getShortAt(e_type_offset[mdIdx]);
+ }
+
+ public Ehdr setE_machine(short val) {
+ accessor.setShortAt(e_machine_offset[mdIdx], val);
+ return this;
+ }
+
+ public short getE_machine() {
+ return accessor.getShortAt(e_machine_offset[mdIdx]);
+ }
+
+ public Ehdr setE_version(int val) {
+ accessor.setIntAt(e_version_offset[mdIdx], val);
+ return this;
+ }
+
+ public int getE_version() {
+ return accessor.getIntAt(e_version_offset[mdIdx]);
+ }
+
+ public Ehdr setE_entry(long val) {
+ accessor.setLongAt(e_entry_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes());
+ return this;
+ }
+
+ public long getE_entry() {
+ return accessor.getLongAt(e_entry_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes());
+ }
+
+ public Ehdr setE_phoff(long val) {
+ accessor.setLongAt(e_phoff_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes());
+ return this;
+ }
+
+ public long getE_phoff() {
+ return accessor.getLongAt(e_phoff_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes());
+ }
+
+ public Ehdr setE_shoff(long val) {
+ accessor.setLongAt(e_shoff_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes());
+ return this;
+ }
+
+ public long getE_shoff() {
+ return accessor.getLongAt(e_shoff_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes());
+ }
+
+ public Ehdr setE_flags(int val) {
+ accessor.setIntAt(e_flags_offset[mdIdx], val);
+ return this;
+ }
+
+ public int getE_flags() {
+ return accessor.getIntAt(e_flags_offset[mdIdx]);
+ }
+
+ public Ehdr setE_ehsize(short val) {
+ accessor.setShortAt(e_ehsize_offset[mdIdx], val);
+ return this;
+ }
+
+ public short getE_ehsize() {
+ return accessor.getShortAt(e_ehsize_offset[mdIdx]);
+ }
+
+ public Ehdr setE_phentsize(short val) {
+ accessor.setShortAt(e_phentsize_offset[mdIdx], val);
+ return this;
+ }
+
+ public short getE_phentsize() {
+ return accessor.getShortAt(e_phentsize_offset[mdIdx]);
+ }
+
+ public Ehdr setE_phnum(short val) {
+ accessor.setShortAt(e_phnum_offset[mdIdx], val);
+ return this;
+ }
+
+ public short getE_phnum() {
+ return accessor.getShortAt(e_phnum_offset[mdIdx]);
+ }
+
+ public Ehdr setE_shentsize(short val) {
+ accessor.setShortAt(e_shentsize_offset[mdIdx], val);
+ return this;
+ }
+
+ public short getE_shentsize() {
+ return accessor.getShortAt(e_shentsize_offset[mdIdx]);
+ }
+
+ public Ehdr setE_shnum(short val) {
+ accessor.setShortAt(e_shnum_offset[mdIdx], val);
+ return this;
+ }
+
+ public short getE_shnum() {
+ return accessor.getShortAt(e_shnum_offset[mdIdx]);
+ }
+
+ public Ehdr setE_shstrndx(short val) {
+ accessor.setShortAt(e_shstrndx_offset[mdIdx], val);
+ return this;
+ }
+
+ public short getE_shstrndx() {
+ return accessor.getShortAt(e_shstrndx_offset[mdIdx]);
+ }
+}