diff options
author | Sven Gothel <[email protected]> | 2015-02-02 00:22:29 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-02-02 00:22:29 +0100 |
commit | 7db9df61142694965b50f2e0553d4c9e5668439b (patch) | |
tree | 411c69a61d0f693acd55a65f458a2d2b75b84db8 /src/java/jogamp/common/os | |
parent | 234819d531cdf20842cd0b3302935b187b2012d6 (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')
-rw-r--r-- | src/java/jogamp/common/os/MachineDataInfoRuntime.java (renamed from src/java/jogamp/common/os/MachineDescriptionRuntime.java) | 118 | ||||
-rw-r--r-- | src/java/jogamp/common/os/PlatformPropsImpl.java | 83 | ||||
-rw-r--r-- | src/java/jogamp/common/os/elf/Ehdr_p1.java | 28 | ||||
-rw-r--r-- | src/java/jogamp/common/os/elf/Ehdr_p2.java | 52 | ||||
-rw-r--r-- | src/java/jogamp/common/os/elf/ElfHeaderPart1.java | 31 | ||||
-rw-r--r-- | src/java/jogamp/common/os/elf/ElfHeaderPart2.java | 3 | ||||
-rw-r--r-- | src/java/jogamp/common/os/elf/Shdr.java | 52 |
7 files changed, 207 insertions, 160 deletions
diff --git a/src/java/jogamp/common/os/MachineDescriptionRuntime.java b/src/java/jogamp/common/os/MachineDataInfoRuntime.java index 9becd21..af90cc5 100644 --- a/src/java/jogamp/common/os/MachineDescriptionRuntime.java +++ b/src/java/jogamp/common/os/MachineDataInfoRuntime.java @@ -28,76 +28,98 @@ package jogamp.common.os; -import com.jogamp.common.os.MachineDescription; +import com.jogamp.common.os.MachineDataInfo; import com.jogamp.common.os.Platform; -import com.jogamp.common.os.MachineDescription.StaticConfig; +import com.jogamp.common.os.MachineDataInfo.StaticConfig; /** - * Runtime MachineDescription + * Runtime operations of {@link MachineDataInfo}. */ -public class MachineDescriptionRuntime { - - static volatile boolean smdHardQueried = false; - static MachineDescription.StaticConfig smdHard = null; - - static volatile boolean smdSoftQueried = false; - static MachineDescription.StaticConfig smdSoft = null; - - public static MachineDescription.StaticConfig getStatic() { - if(!smdHardQueried) { - synchronized(MachineDescription.class) { // volatile dbl-checked-locking OK - if(!smdHardQueried) { - smdHard = get(PlatformPropsImpl.OS_TYPE, PlatformPropsImpl.CPU_ARCH, PlatformPropsImpl.LITTLE_ENDIAN); - smdHardQueried=true; +public class MachineDataInfoRuntime { + + static volatile boolean initialized = false; + static volatile MachineDataInfo runtimeMD = null; + static volatile MachineDataInfo.StaticConfig staticMD = null; + + public static void initialize() { + if( !initialized ) { + synchronized(MachineDataInfo.class) { // volatile dbl-checked-locking OK + if( !initialized ) { + MachineDataInfo.StaticConfig.validateUniqueMachineDataInfo(); + + final MachineDataInfo runtimeMD = getRuntimeImpl(); + final MachineDataInfo.StaticConfig staticMD = MachineDataInfo.StaticConfig.findCompatible(runtimeMD); + if( null == staticMD ) { + throw new RuntimeException("No compatible MachineDataInfo.StaticConfig for runtime:"+PlatformPropsImpl.NEWLINE+runtimeMD); + } + if( !staticMD.md.compatible(runtimeMD) ) { + throw new RuntimeException("Incompatible MachineDataInfo:"+PlatformPropsImpl.NEWLINE+ + " Static "+staticMD+PlatformPropsImpl.NEWLINE+ + " Runtime "+runtimeMD); + } + MachineDataInfoRuntime.runtimeMD = runtimeMD; + MachineDataInfoRuntime.staticMD = staticMD; + initialized=true; if( PlatformPropsImpl.DEBUG ) { - System.err.println("MachineDescription.StaticConfig.getStatic_Hard(os "+PlatformPropsImpl.OS_TYPE+", CpuType "+PlatformPropsImpl.CPU_ARCH+", little "+PlatformPropsImpl.LITTLE_ENDIAN+"): "+smdHard.toShortString()); + System.err.println("MachineDataInfoRuntime.initialize():"+PlatformPropsImpl.NEWLINE+ + " Static "+staticMD+PlatformPropsImpl.NEWLINE+ + " Runtime "+runtimeMD); } + return; + } + } + } + throw new InternalError("Already initialized"); + } + public static MachineDataInfo.StaticConfig getStatic() { + if(!initialized) { + synchronized(MachineDataInfo.class) { // volatile dbl-checked-locking OK + if(!initialized) { + throw new InternalError("Not set"); } } } - return smdHard; + return staticMD; + } + public static MachineDataInfo getRuntime() { + if(!initialized) { + synchronized(MachineDataInfo.class) { // volatile dbl-checked-locking OK + if(!initialized) { + throw new InternalError("Not set"); + } + } + } + return runtimeMD; } - public static MachineDescription.StaticConfig get(final Platform.OSType osType, final Platform.CPUType cpuType, final boolean littleEndian) { + public static MachineDataInfo.StaticConfig guessStaticMachineDataInfo(final Platform.OSType osType, final Platform.CPUType cpuType) { if( cpuType.is32Bit ) { - if( cpuType.family == Platform.CPUFamily.ARM && littleEndian) { - return StaticConfig.ARMle_EABI; - } else if( osType == Platform.OSType.WINDOWS ) { + if( Platform.CPUFamily.ARM == cpuType.family || + Platform.CPUType.MIPS_32 == cpuType ) { + return StaticConfig.ARM_MIPS_32; + } else if( Platform.OSType.WINDOWS == osType ) { return StaticConfig.X86_32_WINDOWS; - } else if( osType == Platform.OSType.MACOS ) { + } else if( Platform.OSType.MACOS == osType ) { return StaticConfig.X86_32_MACOS; - } else if ( osType == Platform.OSType.SUNOS ) { - if ( cpuType == Platform.CPUType.SPARC_32 ) { - return StaticConfig.SPARC_32_SUNOS; - } - // TODO SPARCv9 description is missing + } else if ( Platform.OSType.SUNOS == osType && + Platform.CPUType.SPARC_32 == cpuType ) { + return StaticConfig.SPARC_32_SUNOS; + } else if ( Platform.CPUType.PPC == cpuType ) { + return StaticConfig.PPC_32_UNIX; + } else { + return StaticConfig.X86_32_UNIX; } - return StaticConfig.X86_32_UNIX; } else { if( osType == Platform.OSType.WINDOWS ) { return StaticConfig.X86_64_WINDOWS; } else { - // for all 64bit unix types (x86_64, aarch64, ..) + // for all 64bit unix types (x86_64, aarch64, sparcv9, ..) return StaticConfig.LP64_UNIX; } } } - static volatile boolean rmdQueried = false; - static MachineDescription rmd = null; - - public static MachineDescription getRuntime() { - if(!rmdQueried) { - synchronized(MachineDescription.class) { // volatile dbl-checked-locking OK - if(!rmdQueried) { - rmd = getRuntimeImpl(); - rmdQueried=true; - } - } - } - return rmd; - } - private static MachineDescription getRuntimeImpl() { + private static MachineDataInfo getRuntimeImpl() { try { Platform.initSingleton(); // loads native gluegen-rt library } catch (final UnsatisfiedLinkError err) { @@ -120,8 +142,8 @@ public class MachineDescriptionRuntime { // size: int, long, float, double, pointer, pageSize // alignment: int8, int16, int32, int64, int, long, float, double, pointer - return new MachineDescription( - true /* runtime validated */, PlatformPropsImpl.LITTLE_ENDIAN, + return new MachineDataInfo( + true /* runtime validated */, getSizeOfIntImpl(), getSizeOfLongImpl(), getSizeOfFloatImpl(), getSizeOfDoubleImpl(), getSizeOfLongDoubleImpl(), diff --git a/src/java/jogamp/common/os/PlatformPropsImpl.java b/src/java/jogamp/common/os/PlatformPropsImpl.java index b35533f..0d0063c 100644 --- a/src/java/jogamp/common/os/PlatformPropsImpl.java +++ b/src/java/jogamp/common/os/PlatformPropsImpl.java @@ -140,15 +140,6 @@ public abstract class PlatformPropsImpl { OS_TYPE = getOSTypeImpl(OS_lower, isAndroid); // Hard values, i.e. w/ probing binaries - // - // FIXME / HACK: - // We use preCpuType for MachineDescriptionRuntime.getStatic() - // until we have determined the final CPU_TYPE, etc. - // MachineDescriptionRuntime gets notified via MachineDescriptionRuntime.notifyPropsInitialized() below. - // - // We could use Elf Ehdr's machine value to determine the bit-size - // used for it's offset table! - // However, 'os.arch' should be a good guess for this task. final String elfCpuName; final CPUType elfCpuType; final ABIType elfABIType; @@ -324,7 +315,7 @@ public abstract class PlatformPropsImpl { if( DEBUG ) { System.err.println("Platform.Hard: ARCH "+ARCH+", CPU_ARCH "+CPU_ARCH+", ABI_TYPE "+ABI_TYPE+" - strategy "+strategy+"(isAndroid "+isAndroid+", elfValid "+elfValid+")"); } - os_and_arch = getOSAndArch(OS_TYPE, CPU_ARCH, ABI_TYPE); + os_and_arch = getOSAndArch(OS_TYPE, CPU_ARCH, ABI_TYPE, LITTLE_ENDIAN); } protected PlatformPropsImpl() {} @@ -504,20 +495,34 @@ public abstract class PlatformPropsImpl { public static void initSingleton() { } /** - * Returns the GlueGen common name for the given OSType and CPUType - * as implemented in the build system in 'gluegen-cpptasks-base.xml'.<br> + * Returns the GlueGen common name for the given + * {@link OSType}, {@link CPUType}, {@link ABIType} and {@code littleEndian}. + * <p> + * Consult 'gluegen/make/gluegen-cpptasks-base.xml' to complete/sync mapping! + * </p> * - * A list of currently supported <code>os.and.arch</code> strings: + * An excerpt of supported <code>os.and.arch</code> strings: * <ul> + * <li>android-armv6</li> + * <li>android-aarch64</li> + * <li>linux-armv6</li> + * <li>linux-armv6hf</li> + * <li>linux-i586</li> + * <li>linux-ppc</li> + * <li>linux-mips</li> + * <li>linux-mipsel</li> + * <li>linux-superh</li> + * <li>linux-sparc</li> + * <li>linux-aarch64</li> + * <li>linux-amd64</li> + * <li>linux-ppc64</li> + * <li>linux-mips64</li> + * <li>linux-ia64</li> + * <li>linux-sparcv9</li> + * <li>linux-risc2.0</li> * <li>freebsd-i586</li> * <li>freebsd-amd64</li> * <li>hpux-hppa</li> - * <li>linux-amd64</li> - * <li>linux-ia64</li> - * <li>linux-i586</li> - * <li>linux-armv6</li> - * <li>linux-armv6hf</li> - * <li>android-armv6</li> * <li>macosx-universal</li> * <li>solaris-sparc</li> * <li>solaris-sparcv9</li> @@ -528,40 +533,50 @@ public abstract class PlatformPropsImpl { * </ul> * @return The <i>os.and.arch</i> value. */ - public static final String getOSAndArch(final OSType osType, final CPUType cpuType, final ABIType abiType) { + public static final String getOSAndArch(final OSType osType, final CPUType cpuType, final ABIType abiType, final boolean littleEndian) { final String os_; final String _and_arch_tmp, _and_arch_final; switch( cpuType ) { - case X86_32: - _and_arch_tmp = "i586"; - break; case ARM: case ARMv5: case ARMv6: case ARMv7: if( ABIType.EABI_GNU_ARMHF == abiType ) { - _and_arch_tmp = "armv6hf" ; // TODO: sync with gluegen-cpptasks-base.xml + _and_arch_tmp = "armv6hf"; } else { - _and_arch_tmp = "armv6"; // TODO: sync with gluegen-cpptasks-base.xml + _and_arch_tmp = "armv6"; } break; - case ARM64: - case ARMv8_A: - _and_arch_tmp = "aarch64"; + case X86_32: + _and_arch_tmp = "i586"; + break; + case PPC: + _and_arch_tmp = "ppc"; + break; + case MIPS_32: + _and_arch_tmp = littleEndian ? "mipsel" : "mips"; + break; + case SuperH: + _and_arch_tmp = "superh"; break; case SPARC_32: _and_arch_tmp = "sparc"; break; - case PPC64: - _and_arch_tmp = "ppc64"; // TODO: sync with gluegen-cpptasks-base.xml - break; - case PPC: - _and_arch_tmp = "ppc"; // TODO: sync with gluegen-cpptasks-base.xml + + case ARM64: + case ARMv8_A: + _and_arch_tmp = "aarch64"; break; case X86_64: _and_arch_tmp = "amd64"; break; + case PPC64: + _and_arch_tmp = "ppc64"; + break; + case MIPS_64: + _and_arch_tmp = "mips64"; + break; case IA64: _and_arch_tmp = "ia64"; break; @@ -569,7 +584,7 @@ public abstract class PlatformPropsImpl { _and_arch_tmp = "sparcv9"; break; case PA_RISC2_0: - _and_arch_tmp = "risc2.0"; // TODO: sync with gluegen-cpptasks-base.xml + _and_arch_tmp = "risc2.0"; break; default: throw new InternalError("Unhandled CPUType: "+cpuType); 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 |