In my current Android native code build setup, APP_ABI is defined to armeabi-v7a in Application.mk. For some of the libraries that I am building, I see that LOCAL_ARM_MODE is defined as arm in Android.mk.
I need to extend this setup to build for x86 as well. From another post, it appears using "APP_ABI = all" is a better solution. I am just wondering if LOCAL_ARM_MODE must be changed as well. What does this flag do anyway?
Though this is an old post, I just want to point out that the accepted answer is not correct.
LOCAL_ARM_MODE can either be set to "arm" or "thumb" and is defaulted to "thumb". "thumb" uses 16-bit instructions while "arm" uses 32-bit instructions. The 16-bit instructions is smaller but may be slow for some performance critical apps. That's why for some libraries, people specifically set this flag to "arm" to ensure build with 32-bit instructions. Of course, this flag is only meaningful when you build for the arm architectures.
On the other hand, APP_ABI is the correct flag to toggle with when you want to build for different architectures like armeabi-* or x86 and many more.
For more information, read the documentation for Android.mk
The LOCAL_ARM_MODE can be used to define the platform your application is targeting. To have your Android.mk setup also for x86 just include the required info to your Android.mk file - e.g.:
ifeq ($(TARGET_ARCH),arm)
LOCAL_CFLAGS := -mfpu=neon -march=armv6t2 -O9
LOCAL_SRC_FILES := engine-arm.s
endif
ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS := -msse2 -m32 -masm=intel
LOCAL_SRC_FILES := engine-x86.s
endif
For more info about different option on defining your application target, have a look in /docs/Android-mk.
Source: Compile assembly code for ARM and X86
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With