Search code examples
androidandroid-ndkcrashx86android-x86

Native Android app crashes with SIGILL on x86


I'm trying to launch a native Android app on Intel Atom Z2560, but it always crashes in the same place with SIGILL ILL_ILLOPN (illegal operand) signal.

The crash doesn't happen with -O0.

The compiler I'm using is GCC 4.8 from NDK r10. I tried to set -march to atom, but that doesn't change anything.

Anybody knows how can I configure my build scripts so there is no incompatible code generated?


Solution

  • This is a known bug in NDK r10, see http://b.android.com/73843 for details on it. To avoid the issue, either use an older NDK version, or add (something like) this to your Android.mk:

    ifeq ($(TARGET_ARCH_ABI), x86)
    LOCAL_CFLAGS += -m32 # NDK r10 x86 bug workaround - http://b.android.com/73843
    endif