Bug 856 - Android: Support dual ABI (x86 i686 *and* ARMv7arm), i.e. pick 'best' ABI
Summary: Android: Support dual ABI (x86 i686 *and* ARMv7arm), i.e. pick 'best' ABI
Alias: None
Product: Gluegen
Classification: JogAmp
Component: core (show other bugs)
Version: 2
Hardware: All all
: P5 enhancement
Assignee: Sven Gothel
Depends on:
Blocks: 855 853
  Show dependency treegraph
Reported: 2013-10-10 17:07 CEST by Sven Gothel
Modified: 2014-01-24 13:07 CET (History)
2 users (show)

See Also:
Type: ---
SCM Refs:
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2013-10-10 17:07:06 CEST
Android Samsung Galaxy Tab 3 10.1 uses an Intel Atom Z2560 with an x86 instruction set *and* support for ARMv7.

Gluegen detects the current architecture by parsing the dalvik system 
property "os.arch" which in our case returns "686".

It would be advisable to use the android.os.Build information to check for all defined ABI.

On this galaxy tab 3 10.1, this gives:

android.os.Build.CPU_ABI: x86
android.os.Build.CPU_ABI2: armeabi-v7a
Comment 1 Sven Gothel 2013-10-11 02:37:24 CEST
it seems that the ABI2 (armv7) is emulated on the device, 
since the Intel Atom Z2xxx does not support this ABI natively.
Comment 2 Sven Gothel 2014-01-24 13:07:35 CET
    - 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