summaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/common/os/elf
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-02-02 00:22:29 +0100
committerSven Gothel <[email protected]>2015-02-02 00:22:29 +0100
commit7db9df61142694965b50f2e0553d4c9e5668439b (patch)
tree411c69a61d0f693acd55a65f458a2d2b75b84db8 /src/java/jogamp/common/os/elf
parent234819d531cdf20842cd0b3302935b187b2012d6 (diff)
Bug 1126 - Remove static query requirement of MachineDescriptor, find matching StaticConfig at runtime; Fix PPC (Bug 1056) and MIPSLE (Bug 1014) issues.
Currently the StaticConfig is being queried via the key[OSType, CPUType ..] as pre-determined by Java properties or the ELF parser. This adds complication to maintain different platforms and the key query might not even be sufficient. The MachineDescriptor's StaticConfig only purpose shall be to speed-up native data size and offset/alignment retrieval. This is done by using the StaticConfig index within all StaticConfig[]s as a lookup-index for the precomputed struct's size and offset tables. +++ Solution: Rename: MachineDescriptor -> MachineDataInfo Rename: MachineDescriptorRuntime -> MachineDataInfoRuntime After having defined os.and.arch (OSType, CPUType and ABIType) w/ the optional help of the now self containing ELF Reader (Bug 1125), the native gluegen-rt library gets loaded enabling JNI methods. It is satisfactory to retrieve MachineDataInfo at runtime w/ JNI and find the matching/compatible StaticConfig. Only in case none is found, the program needs to abort. Otherwise the found MachineDataInfo.StaticConfig and MachineDataInfo are stored for further use (see above). This removes above complication and key to StaticConfig mapping. New platforms simply need to add a new unique entry into the StaticConfig[] table. ++ Also fixes Bug 1056 (PPC), thanks to tmancill [@] debian [.] org, and Bug 1014 (MIPSLE), thanks to Dejan Latinovic. Parts of the patch for Bug 1014 from Dejan Latinovic are included. also solved by this change set.
Diffstat (limited to 'src/java/jogamp/common/os/elf')
-rw-r--r--src/java/jogamp/common/os/elf/Ehdr_p1.java28
-rw-r--r--src/java/jogamp/common/os/elf/Ehdr_p2.java52
-rw-r--r--src/java/jogamp/common/os/elf/ElfHeaderPart1.java31
-rw-r--r--src/java/jogamp/common/os/elf/ElfHeaderPart2.java3
-rw-r--r--src/java/jogamp/common/os/elf/Shdr.java52
5 files changed, 88 insertions, 78 deletions
diff --git a/src/java/jogamp/common/os/elf/Ehdr_p1.java b/src/java/jogamp/common/os/elf/Ehdr_p1.java
index 0d23a0a..8953776 100644
--- a/src/java/jogamp/common/os/elf/Ehdr_p1.java
+++ b/src/java/jogamp/common/os/elf/Ehdr_p1.java
@@ -1,4 +1,4 @@
-/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 03:27:25 CET 2015 ----! */
+/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 23:28:47 CET 2015 ----! */
package jogamp.common.os.elf;
@@ -8,7 +8,7 @@ import java.nio.*;
import com.jogamp.gluegen.runtime.*;
import com.jogamp.common.os.*;
import com.jogamp.common.nio.*;
-import jogamp.common.os.MachineDescriptionRuntime;
+import jogamp.common.os.MachineDataInfoRuntime;
public class Ehdr_p1 {
@@ -16,17 +16,17 @@ public class Ehdr_p1 {
StructAccessor accessor;
private static final int mdIdx = 0;
- private final MachineDescription md;
-
- private static final int[] Ehdr_p1_size = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 24 /* LP64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */, 24 /* SPARC_32_SUNOS */ };
- private static final int[] e_ident_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* LP64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */, 0 /* SPARC_32_SUNOS */ };
- private static final int[] e_ident_size = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 16 /* LP64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 16 /* SPARC_32_SUNOS */ };
- private static final int[] e_type_offset = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 16 /* LP64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 16 /* SPARC_32_SUNOS */ };
-//private static final int[] e_type_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ };
- private static final int[] e_machine_offset = new int[] { 18 /* ARMle_EABI */, 18 /* X86_32_UNIX */, 18 /* LP64_UNIX */, 18 /* X86_32_MACOS */, 18 /* X86_32_WINDOWS */, 18 /* X86_64_WINDOWS */, 18 /* SPARC_32_SUNOS */ };
-//private static final int[] e_machine_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ };
- private static final int[] e_version_offset = new int[] { 20 /* ARMle_EABI */, 20 /* X86_32_UNIX */, 20 /* LP64_UNIX */, 20 /* X86_32_MACOS */, 20 /* X86_32_WINDOWS */, 20 /* X86_64_WINDOWS */, 20 /* SPARC_32_SUNOS */ };
-//private static final int[] e_version_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
+ private final MachineDataInfo md;
+
+ private static final int[] Ehdr_p1_size = new int[] { 24 /* ARM_MIPS_32 */, 24 /* X86_32_UNIX */, 24 /* X86_32_MACOS */, 24 /* PPC_32_UNIX */, 24 /* SPARC_32_SUNOS */, 24 /* X86_32_WINDOWS */, 24 /* LP64_UNIX */, 24 /* X86_64_WINDOWS */ };
+ private static final int[] e_ident_offset = new int[] { 0 /* ARM_MIPS_32 */, 0 /* X86_32_UNIX */, 0 /* X86_32_MACOS */, 0 /* PPC_32_UNIX */, 0 /* SPARC_32_SUNOS */, 0 /* X86_32_WINDOWS */, 0 /* LP64_UNIX */, 0 /* X86_64_WINDOWS */ };
+ private static final int[] e_ident_size = new int[] { 16 /* ARM_MIPS_32 */, 16 /* X86_32_UNIX */, 16 /* X86_32_MACOS */, 16 /* PPC_32_UNIX */, 16 /* SPARC_32_SUNOS */, 16 /* X86_32_WINDOWS */, 16 /* LP64_UNIX */, 16 /* X86_64_WINDOWS */ };
+ private static final int[] e_type_offset = new int[] { 16 /* ARM_MIPS_32 */, 16 /* X86_32_UNIX */, 16 /* X86_32_MACOS */, 16 /* PPC_32_UNIX */, 16 /* SPARC_32_SUNOS */, 16 /* X86_32_WINDOWS */, 16 /* LP64_UNIX */, 16 /* X86_64_WINDOWS */ };
+//private static final int[] e_type_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
+ private static final int[] e_machine_offset = new int[] { 18 /* ARM_MIPS_32 */, 18 /* X86_32_UNIX */, 18 /* X86_32_MACOS */, 18 /* PPC_32_UNIX */, 18 /* SPARC_32_SUNOS */, 18 /* X86_32_WINDOWS */, 18 /* LP64_UNIX */, 18 /* X86_64_WINDOWS */ };
+//private static final int[] e_machine_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
+ private static final int[] e_version_offset = new int[] { 20 /* ARM_MIPS_32 */, 20 /* X86_32_UNIX */, 20 /* X86_32_MACOS */, 20 /* PPC_32_UNIX */, 20 /* SPARC_32_SUNOS */, 20 /* X86_32_WINDOWS */, 20 /* LP64_UNIX */, 20 /* X86_64_WINDOWS */ };
+//private static final int[] e_version_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 4 /* LP64_UNIX */, 4 /* X86_64_WINDOWS */ };
public static int size() {
return Ehdr_p1_size[mdIdx];
@@ -41,7 +41,7 @@ public class Ehdr_p1 {
}
Ehdr_p1(java.nio.ByteBuffer buf) {
- md = MachineDescription.StaticConfig.values()[mdIdx].md;
+ md = MachineDataInfo.StaticConfig.values()[mdIdx].md;
accessor = new StructAccessor(buf);
}
diff --git a/src/java/jogamp/common/os/elf/Ehdr_p2.java b/src/java/jogamp/common/os/elf/Ehdr_p2.java
index 9dc561a..0842e15 100644
--- a/src/java/jogamp/common/os/elf/Ehdr_p2.java
+++ b/src/java/jogamp/common/os/elf/Ehdr_p2.java
@@ -1,4 +1,4 @@
-/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 03:27:25 CET 2015 ----! */
+/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 23:28:47 CET 2015 ----! */
package jogamp.common.os.elf;
@@ -8,7 +8,7 @@ import java.nio.*;
import com.jogamp.gluegen.runtime.*;
import com.jogamp.common.os.*;
import com.jogamp.common.nio.*;
-import jogamp.common.os.MachineDescriptionRuntime;
+import jogamp.common.os.MachineDataInfoRuntime;
public class Ehdr_p2 {
@@ -16,29 +16,29 @@ public class Ehdr_p2 {
StructAccessor accessor;
private final int mdIdx;
- private final MachineDescription md;
-
- private static final int[] Ehdr_p2_size = new int[] { 28 /* ARMle_EABI */, 28 /* X86_32_UNIX */, 40 /* LP64_UNIX */, 28 /* X86_32_MACOS */, 28 /* X86_32_WINDOWS */, 40 /* X86_64_WINDOWS */, 28 /* SPARC_32_SUNOS */ };
- private static final int[] e_entry_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* LP64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */, 0 /* SPARC_32_SUNOS */ };
-//private static final int[] e_entry_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] e_phoff_offset = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
-//private static final int[] e_phoff_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] e_shoff_offset = new int[] { 8 /* ARMle_EABI */, 8 /* X86_32_UNIX */, 16 /* LP64_UNIX */, 8 /* X86_32_MACOS */, 8 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 8 /* SPARC_32_SUNOS */ };
-//private static final int[] e_shoff_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] e_flags_offset = new int[] { 12 /* ARMle_EABI */, 12 /* X86_32_UNIX */, 24 /* LP64_UNIX */, 12 /* X86_32_MACOS */, 12 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */, 12 /* SPARC_32_SUNOS */ };
-//private static final int[] e_flags_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] e_ehsize_offset = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 28 /* LP64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 28 /* X86_64_WINDOWS */, 16 /* SPARC_32_SUNOS */ };
-//private static final int[] e_ehsize_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ };
- private static final int[] e_phentsize_offset = new int[] { 18 /* ARMle_EABI */, 18 /* X86_32_UNIX */, 30 /* LP64_UNIX */, 18 /* X86_32_MACOS */, 18 /* X86_32_WINDOWS */, 30 /* X86_64_WINDOWS */, 18 /* SPARC_32_SUNOS */ };
-//private static final int[] e_phentsize_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ };
- private static final int[] e_phnum_offset = new int[] { 20 /* ARMle_EABI */, 20 /* X86_32_UNIX */, 32 /* LP64_UNIX */, 20 /* X86_32_MACOS */, 20 /* X86_32_WINDOWS */, 32 /* X86_64_WINDOWS */, 20 /* SPARC_32_SUNOS */ };
-//private static final int[] e_phnum_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ };
- private static final int[] e_shentsize_offset = new int[] { 22 /* ARMle_EABI */, 22 /* X86_32_UNIX */, 34 /* LP64_UNIX */, 22 /* X86_32_MACOS */, 22 /* X86_32_WINDOWS */, 34 /* X86_64_WINDOWS */, 22 /* SPARC_32_SUNOS */ };
-//private static final int[] e_shentsize_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ };
- private static final int[] e_shnum_offset = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 36 /* LP64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 36 /* X86_64_WINDOWS */, 24 /* SPARC_32_SUNOS */ };
-//private static final int[] e_shnum_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ };
- private static final int[] e_shstrndx_offset = new int[] { 26 /* ARMle_EABI */, 26 /* X86_32_UNIX */, 38 /* LP64_UNIX */, 26 /* X86_32_MACOS */, 26 /* X86_32_WINDOWS */, 38 /* X86_64_WINDOWS */, 26 /* SPARC_32_SUNOS */ };
-//private static final int[] e_shstrndx_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ };
+ private final MachineDataInfo md;
+
+ private static final int[] Ehdr_p2_size = new int[] { 28 /* ARM_MIPS_32 */, 28 /* X86_32_UNIX */, 28 /* X86_32_MACOS */, 28 /* PPC_32_UNIX */, 28 /* SPARC_32_SUNOS */, 28 /* X86_32_WINDOWS */, 40 /* LP64_UNIX */, 40 /* X86_64_WINDOWS */ };
+ private static final int[] e_entry_offset = new int[] { 0 /* ARM_MIPS_32 */, 0 /* X86_32_UNIX */, 0 /* X86_32_MACOS */, 0 /* PPC_32_UNIX */, 0 /* SPARC_32_SUNOS */, 0 /* X86_32_WINDOWS */, 0 /* LP64_UNIX */, 0 /* X86_64_WINDOWS */ };
+//private static final int[] e_entry_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+ private static final int[] e_phoff_offset = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+//private static final int[] e_phoff_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+ private static final int[] e_shoff_offset = new int[] { 8 /* ARM_MIPS_32 */, 8 /* X86_32_UNIX */, 8 /* X86_32_MACOS */, 8 /* PPC_32_UNIX */, 8 /* SPARC_32_SUNOS */, 8 /* X86_32_WINDOWS */, 16 /* LP64_UNIX */, 16 /* X86_64_WINDOWS */ };
+//private static final int[] e_shoff_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+ private static final int[] e_flags_offset = new int[] { 12 /* ARM_MIPS_32 */, 12 /* X86_32_UNIX */, 12 /* X86_32_MACOS */, 12 /* PPC_32_UNIX */, 12 /* SPARC_32_SUNOS */, 12 /* X86_32_WINDOWS */, 24 /* LP64_UNIX */, 24 /* X86_64_WINDOWS */ };
+//private static final int[] e_flags_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 4 /* LP64_UNIX */, 4 /* X86_64_WINDOWS */ };
+ private static final int[] e_ehsize_offset = new int[] { 16 /* ARM_MIPS_32 */, 16 /* X86_32_UNIX */, 16 /* X86_32_MACOS */, 16 /* PPC_32_UNIX */, 16 /* SPARC_32_SUNOS */, 16 /* X86_32_WINDOWS */, 28 /* LP64_UNIX */, 28 /* X86_64_WINDOWS */ };
+//private static final int[] e_ehsize_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
+ private static final int[] e_phentsize_offset = new int[] { 18 /* ARM_MIPS_32 */, 18 /* X86_32_UNIX */, 18 /* X86_32_MACOS */, 18 /* PPC_32_UNIX */, 18 /* SPARC_32_SUNOS */, 18 /* X86_32_WINDOWS */, 30 /* LP64_UNIX */, 30 /* X86_64_WINDOWS */ };
+//private static final int[] e_phentsize_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
+ private static final int[] e_phnum_offset = new int[] { 20 /* ARM_MIPS_32 */, 20 /* X86_32_UNIX */, 20 /* X86_32_MACOS */, 20 /* PPC_32_UNIX */, 20 /* SPARC_32_SUNOS */, 20 /* X86_32_WINDOWS */, 32 /* LP64_UNIX */, 32 /* X86_64_WINDOWS */ };
+//private static final int[] e_phnum_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
+ private static final int[] e_shentsize_offset = new int[] { 22 /* ARM_MIPS_32 */, 22 /* X86_32_UNIX */, 22 /* X86_32_MACOS */, 22 /* PPC_32_UNIX */, 22 /* SPARC_32_SUNOS */, 22 /* X86_32_WINDOWS */, 34 /* LP64_UNIX */, 34 /* X86_64_WINDOWS */ };
+//private static final int[] e_shentsize_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
+ private static final int[] e_shnum_offset = new int[] { 24 /* ARM_MIPS_32 */, 24 /* X86_32_UNIX */, 24 /* X86_32_MACOS */, 24 /* PPC_32_UNIX */, 24 /* SPARC_32_SUNOS */, 24 /* X86_32_WINDOWS */, 36 /* LP64_UNIX */, 36 /* X86_64_WINDOWS */ };
+//private static final int[] e_shnum_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
+ private static final int[] e_shstrndx_offset = new int[] { 26 /* ARM_MIPS_32 */, 26 /* X86_32_UNIX */, 26 /* X86_32_MACOS */, 26 /* PPC_32_UNIX */, 26 /* SPARC_32_SUNOS */, 26 /* X86_32_WINDOWS */, 38 /* LP64_UNIX */, 38 /* X86_64_WINDOWS */ };
+//private static final int[] e_shstrndx_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
public java.nio.ByteBuffer getBuffer() {
return accessor.getBuffer();
@@ -169,7 +169,7 @@ public class Ehdr_p2 {
Ehdr_p2(final int mdIdx, final java.nio.ByteBuffer buf) {
this.mdIdx = mdIdx;
- this.md = MachineDescription.StaticConfig.values()[mdIdx].md;
+ this.md = MachineDataInfo.StaticConfig.values()[mdIdx].md;
this.accessor = new StructAccessor(buf);
}
// ---- End CustomJavaCode .cfg declarations
diff --git a/src/java/jogamp/common/os/elf/ElfHeaderPart1.java b/src/java/jogamp/common/os/elf/ElfHeaderPart1.java
index ec926e9..4f5b135 100644
--- a/src/java/jogamp/common/os/elf/ElfHeaderPart1.java
+++ b/src/java/jogamp/common/os/elf/ElfHeaderPart1.java
@@ -32,9 +32,9 @@ import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import jogamp.common.Debug;
-import jogamp.common.os.MachineDescriptionRuntime;
+import jogamp.common.os.MachineDataInfoRuntime;
-import com.jogamp.common.os.MachineDescription;
+import com.jogamp.common.os.MachineDataInfo;
import com.jogamp.common.os.Platform.ABIType;
import com.jogamp.common.os.Platform.CPUType;
import com.jogamp.common.os.Platform.OSType;
@@ -49,8 +49,9 @@ import static jogamp.common.os.elf.IOUtils.readBytes;
* <p>
* References:
* <ul>
- * <li>http://linux.die.net/man/5/elf</li>
* <li>http://www.sco.com/developers/gabi/latest/contents.html</li>
+ * <li>https://en.wikipedia.org/wiki/Executable_and_Linkable_Format</li>
+ * <li>http://linux.die.net/man/5/elf</li>
* <li>http://infocenter.arm.com/
* <ul>
* <li>ARM IHI 0044E, current through ABI release 2.09</li>
@@ -327,7 +328,7 @@ public class ElfHeaderPart1 {
public final CPUType cpuType;
public final ABIType abiType;
- public final MachineDescription.StaticConfig machDesc;
+ public final MachineDataInfo.StaticConfig machDesc;
/**
* Note: The input stream shall stay untouch to be able to read sections!
@@ -387,15 +388,20 @@ public class ElfHeaderPart1 {
abiType = ABIType.GENERIC_ABI;
break;
case EM_MIPS:
- cpuName = "mips";
+ // Can be little-endian or big-endian and 32 or 64 bits
+ if( 64 == getArchClassBits() ) {
+ cpuName = isLittleEndian() ? "mips64le" : "mips64";
+ } else {
+ cpuName = isLittleEndian() ? "mipsle" : "mips";
+ }
abiType = ABIType.GENERIC_ABI;
break;
- case EM_MIPS_X:
- cpuName = "mips-x";
+ case EM_MIPS_RS3_LE:
+ cpuName = "mipsle-rs3"; // FIXME: Only little-endian?
abiType = ABIType.GENERIC_ABI;
break;
- case EM_MIPS_RS3_LE:
- cpuName = "mips-rs3-le";
+ case EM_MIPS_X:
+ cpuName = isLittleEndian() ? "mipsle-x" : "mips-x"; // Can be little-endian
abiType = ABIType.GENERIC_ABI;
break;
case EM_PPC:
@@ -406,12 +412,15 @@ public class ElfHeaderPart1 {
cpuName = "ppc64";
abiType = ABIType.GENERIC_ABI;
break;
- case EM_SH: // Hitachi SuperH ?
+ case EM_SH:
+ cpuName = "superh";
+ abiType = ABIType.GENERIC_ABI;
+ break;
default:
throw new IllegalArgumentException("CPUType and ABIType could not be determined");
}
cpuType = CPUType.query(cpuName.toLowerCase());
- machDesc = MachineDescriptionRuntime.get(osType, cpuType, isLittleEndian());
+ machDesc = MachineDataInfoRuntime.guessStaticMachineDataInfo(osType, cpuType);
if(DEBUG) {
System.err.println("ELF-1: cpuName "+cpuName+" -> "+cpuType+", "+abiType+", machDesc "+machDesc.toShortString());
}
diff --git a/src/java/jogamp/common/os/elf/ElfHeaderPart2.java b/src/java/jogamp/common/os/elf/ElfHeaderPart2.java
index 320b8b4..e019b05 100644
--- a/src/java/jogamp/common/os/elf/ElfHeaderPart2.java
+++ b/src/java/jogamp/common/os/elf/ElfHeaderPart2.java
@@ -48,8 +48,9 @@ import static jogamp.common.os.elf.IOUtils.toHexString;
* <p>
* References:
* <ul>
- * <li>http://linux.die.net/man/5/elf</li>
* <li>http://www.sco.com/developers/gabi/latest/contents.html</li>
+ * <li>https://en.wikipedia.org/wiki/Executable_and_Linkable_Format</li>
+ * <li>http://linux.die.net/man/5/elf</li>
* <li>http://infocenter.arm.com/
* <ul>
* <li>ARM IHI 0044E, current through ABI release 2.09</li>
diff --git a/src/java/jogamp/common/os/elf/Shdr.java b/src/java/jogamp/common/os/elf/Shdr.java
index 0b75fd6..18f50b2 100644
--- a/src/java/jogamp/common/os/elf/Shdr.java
+++ b/src/java/jogamp/common/os/elf/Shdr.java
@@ -1,4 +1,4 @@
-/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 03:27:25 CET 2015 ----! */
+/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 23:28:47 CET 2015 ----! */
package jogamp.common.os.elf;
@@ -8,7 +8,7 @@ import java.nio.*;
import com.jogamp.gluegen.runtime.*;
import com.jogamp.common.os.*;
import com.jogamp.common.nio.*;
-import jogamp.common.os.MachineDescriptionRuntime;
+import jogamp.common.os.MachineDataInfoRuntime;
public class Shdr {
@@ -16,29 +16,29 @@ public class Shdr {
StructAccessor accessor;
private final int mdIdx;
- private final MachineDescription md;
-
- private static final int[] Shdr_size = new int[] { 40 /* ARMle_EABI */, 40 /* X86_32_UNIX */, 64 /* LP64_UNIX */, 40 /* X86_32_MACOS */, 40 /* X86_32_WINDOWS */, 64 /* X86_64_WINDOWS */, 40 /* SPARC_32_SUNOS */ };
- private static final int[] sh_name_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* LP64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */, 0 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_name_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] sh_type_offset = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_type_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] sh_flags_offset = new int[] { 8 /* ARMle_EABI */, 8 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 8 /* X86_32_MACOS */, 8 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 8 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_flags_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] sh_addr_offset = new int[] { 12 /* ARMle_EABI */, 12 /* X86_32_UNIX */, 16 /* LP64_UNIX */, 12 /* X86_32_MACOS */, 12 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 12 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_addr_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] sh_offset_offset = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 24 /* LP64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */, 16 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_offset_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] sh_size_offset = new int[] { 20 /* ARMle_EABI */, 20 /* X86_32_UNIX */, 32 /* LP64_UNIX */, 20 /* X86_32_MACOS */, 20 /* X86_32_WINDOWS */, 32 /* X86_64_WINDOWS */, 20 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_size_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] sh_link_offset = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 40 /* LP64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 40 /* X86_64_WINDOWS */, 24 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_link_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] sh_info_offset = new int[] { 28 /* ARMle_EABI */, 28 /* X86_32_UNIX */, 44 /* LP64_UNIX */, 28 /* X86_32_MACOS */, 28 /* X86_32_WINDOWS */, 44 /* X86_64_WINDOWS */, 28 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_info_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] sh_addralign_offset = new int[] { 32 /* ARMle_EABI */, 32 /* X86_32_UNIX */, 48 /* LP64_UNIX */, 32 /* X86_32_MACOS */, 32 /* X86_32_WINDOWS */, 48 /* X86_64_WINDOWS */, 32 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_addralign_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
- private static final int[] sh_entsize_offset = new int[] { 36 /* ARMle_EABI */, 36 /* X86_32_UNIX */, 56 /* LP64_UNIX */, 36 /* X86_32_MACOS */, 36 /* X86_32_WINDOWS */, 56 /* X86_64_WINDOWS */, 36 /* SPARC_32_SUNOS */ };
-//private static final int[] sh_entsize_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ };
+ private final MachineDataInfo md;
+
+ private static final int[] Shdr_size = new int[] { 40 /* ARM_MIPS_32 */, 40 /* X86_32_UNIX */, 40 /* X86_32_MACOS */, 40 /* PPC_32_UNIX */, 40 /* SPARC_32_SUNOS */, 40 /* X86_32_WINDOWS */, 64 /* LP64_UNIX */, 64 /* X86_64_WINDOWS */ };
+ private static final int[] sh_name_offset = new int[] { 0 /* ARM_MIPS_32 */, 0 /* X86_32_UNIX */, 0 /* X86_32_MACOS */, 0 /* PPC_32_UNIX */, 0 /* SPARC_32_SUNOS */, 0 /* X86_32_WINDOWS */, 0 /* LP64_UNIX */, 0 /* X86_64_WINDOWS */ };
+//private static final int[] sh_name_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 4 /* LP64_UNIX */, 4 /* X86_64_WINDOWS */ };
+ private static final int[] sh_type_offset = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 4 /* LP64_UNIX */, 4 /* X86_64_WINDOWS */ };
+//private static final int[] sh_type_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 4 /* LP64_UNIX */, 4 /* X86_64_WINDOWS */ };
+ private static final int[] sh_flags_offset = new int[] { 8 /* ARM_MIPS_32 */, 8 /* X86_32_UNIX */, 8 /* X86_32_MACOS */, 8 /* PPC_32_UNIX */, 8 /* SPARC_32_SUNOS */, 8 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+//private static final int[] sh_flags_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+ private static final int[] sh_addr_offset = new int[] { 12 /* ARM_MIPS_32 */, 12 /* X86_32_UNIX */, 12 /* X86_32_MACOS */, 12 /* PPC_32_UNIX */, 12 /* SPARC_32_SUNOS */, 12 /* X86_32_WINDOWS */, 16 /* LP64_UNIX */, 16 /* X86_64_WINDOWS */ };
+//private static final int[] sh_addr_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+ private static final int[] sh_offset_offset = new int[] { 16 /* ARM_MIPS_32 */, 16 /* X86_32_UNIX */, 16 /* X86_32_MACOS */, 16 /* PPC_32_UNIX */, 16 /* SPARC_32_SUNOS */, 16 /* X86_32_WINDOWS */, 24 /* LP64_UNIX */, 24 /* X86_64_WINDOWS */ };
+//private static final int[] sh_offset_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+ private static final int[] sh_size_offset = new int[] { 20 /* ARM_MIPS_32 */, 20 /* X86_32_UNIX */, 20 /* X86_32_MACOS */, 20 /* PPC_32_UNIX */, 20 /* SPARC_32_SUNOS */, 20 /* X86_32_WINDOWS */, 32 /* LP64_UNIX */, 32 /* X86_64_WINDOWS */ };
+//private static final int[] sh_size_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+ private static final int[] sh_link_offset = new int[] { 24 /* ARM_MIPS_32 */, 24 /* X86_32_UNIX */, 24 /* X86_32_MACOS */, 24 /* PPC_32_UNIX */, 24 /* SPARC_32_SUNOS */, 24 /* X86_32_WINDOWS */, 40 /* LP64_UNIX */, 40 /* X86_64_WINDOWS */ };
+//private static final int[] sh_link_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 4 /* LP64_UNIX */, 4 /* X86_64_WINDOWS */ };
+ private static final int[] sh_info_offset = new int[] { 28 /* ARM_MIPS_32 */, 28 /* X86_32_UNIX */, 28 /* X86_32_MACOS */, 28 /* PPC_32_UNIX */, 28 /* SPARC_32_SUNOS */, 28 /* X86_32_WINDOWS */, 44 /* LP64_UNIX */, 44 /* X86_64_WINDOWS */ };
+//private static final int[] sh_info_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 4 /* LP64_UNIX */, 4 /* X86_64_WINDOWS */ };
+ private static final int[] sh_addralign_offset = new int[] { 32 /* ARM_MIPS_32 */, 32 /* X86_32_UNIX */, 32 /* X86_32_MACOS */, 32 /* PPC_32_UNIX */, 32 /* SPARC_32_SUNOS */, 32 /* X86_32_WINDOWS */, 48 /* LP64_UNIX */, 48 /* X86_64_WINDOWS */ };
+//private static final int[] sh_addralign_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
+ private static final int[] sh_entsize_offset = new int[] { 36 /* ARM_MIPS_32 */, 36 /* X86_32_UNIX */, 36 /* X86_32_MACOS */, 36 /* PPC_32_UNIX */, 36 /* SPARC_32_SUNOS */, 36 /* X86_32_WINDOWS */, 56 /* LP64_UNIX */, 56 /* X86_64_WINDOWS */ };
+//private static final int[] sh_entsize_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
public java.nio.ByteBuffer getBuffer() {
return accessor.getBuffer();
@@ -169,7 +169,7 @@ public class Shdr {
Shdr(final int mdIdx, final java.nio.ByteBuffer buf) {
this.mdIdx = mdIdx;
- this.md = MachineDescription.StaticConfig.values()[mdIdx].md;
+ this.md = MachineDataInfo.StaticConfig.values()[mdIdx].md;
this.accessor = new StructAccessor(buf);
}
// ---- End CustomJavaCode .cfg declarations