diff options
author | Sven Gothel <[email protected]> | 2014-01-24 13:05:11 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-01-24 13:05:11 +0100 |
commit | 022c31eefaa0c11fbc069fd35cf5311a556c9ae5 (patch) | |
tree | 15468323ce0ad1d1e368c1aaaba1f594742aacaa /src/java/jogamp/common/os/elf/ElfHeader.java | |
parent | 2868816971bb80eb226e6edffc527d909ced755b (diff) |
Bug 856 - Android: Support dual ABI (x86 i686 *and* ARMv7arm), i.e. pick 'best' ABI
- Use 'os.arch' as a prelim CPUType for MachineDescription
- Always attempt to load a binary and parse it's elf header
- Linux: self-exe
- Android: gluegen-rt library
- Other: java lib
- Always use details (ABI) if ARM
- Android: Check CPU_TYPE and CPU_TYPE2
// FIXME / HACK:
// We use sCPUType 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.
Tested manually on
- Linux x86, x86_64, armhf (raspi)
- Android intel and arm
- Windows x86_64
- OSX x86_64
Diffstat (limited to 'src/java/jogamp/common/os/elf/ElfHeader.java')
-rw-r--r-- | src/java/jogamp/common/os/elf/ElfHeader.java | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/java/jogamp/common/os/elf/ElfHeader.java b/src/java/jogamp/common/os/elf/ElfHeader.java index e6645b6..f12ccad 100644 --- a/src/java/jogamp/common/os/elf/ElfHeader.java +++ b/src/java/jogamp/common/os/elf/ElfHeader.java @@ -461,13 +461,37 @@ public class ElfHeader { /** * Returns true if {@link #getMachine() machine} is a 32 or 64 bit Intel CPU * of type {@link #EM_386}, {@link #EM_486} or {@link #EM_X86_64}. */ - public final boolean isIntel() { + public final boolean isX86_32() { final short m = getMachine(); return EM_386 == m || EM_486 == m || EM_X86_64 == m; } + /** + * Returns true if {@link #getMachine() machine} is a 64 bit AMD/Intel x86_64 CPU + * of type {@link #EM_X86_64}. */ + public final boolean isX86_64() { + return getMachine() == EM_X86_64; + } + + /** + * Returns true if {@link #getMachine() machine} is a 64 bit Intel Itanium CPU + * of type {@link #EM_IA_64}. */ + public final boolean isIA64() { + return getMachine() == EM_IA_64; + } + + /** + * Returns true if {@link #getMachine() machine} is a 32 or 64 bit MIPS CPU + * of type {@link #EM_MIPS}, {@link #EM_MIPS_X} or {@link #EM_MIPS_RS3_LE}. */ + public final boolean isMips() { + final short m = getMachine(); + return EM_MIPS == m || + EM_MIPS_X == m || + EM_MIPS_RS3_LE == m; + } + /** Returns the processor-specific flags associated with the file. */ public final int getFlags() { return d.getE_flags(); @@ -536,8 +560,14 @@ public class ElfHeader { final String machineS; if( isArm() ) { machineS=", arm"; - } else if( isIntel() ) { - machineS=", intel"; + } else if( isX86_64() ) { + machineS=", x86_64"; + } else if( isX86_32() ) { + machineS=", x86_32"; + } else if( isIA64() ) { + machineS=", itanium"; + } else if( isMips() ) { + machineS=", mips"; } else { machineS=""; } |