wang123
wang123

Reputation: 11

o-llvm,unrecognized command line option '-sub' for 64bits

wang@ubuntu:~/Downloads/hello/jni$ ndk-build -B
[armeabi] Compile thumb : hello <= hello.c
[armeabi] Executable : hello
[armeabi] Install : hello => libs/armeabi/hello
[x86] Compile : hello <= hello.c
[x86] Executable : hello
[x86] Install : hello => libs/x86/hello
[arm64-v8a] Compile : hello <= hello.c
aarch64-linux-android-gcc: error: unrecognized command line option '-mllvm'
aarch64-linux-android-gcc: error: unrecognized command line option '-sub'
aarch64-linux-android-gcc: error: unrecognized command line option '-mllvm'
aarch64-linux-android-gcc: error: unrecognized command line option '-fla'
aarch64-linux-android-gcc: error: unrecognized command line option '-mllvm'
aarch64-linux-android-gcc: error: unrecognized command line option '-bcf'

the android.mk's cotent:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello
LOCAL_SRC_FILES := hello.c
LOCAL_CFLAGS := -mllvm -sub -mllvm -fla -mllvm -bcf 
include $(BUILD_EXECUTABLE)

When I build the 32bits so file,androd-ndk use my clang(android-ndk-r10e/wang-llvm-3.6/prebuilt/linux-x86/bin),but for 64bits,it uesd aarch64-linux-android-gcc ,anyone can help me?

Upvotes: 1

Views: 753

Answers (1)

cryptopathe
cryptopathe

Reputation: 111

If you would like to use Obfuscator-LLVM, you have to integrate it into your build environment, being for 32-bit or 64-bit builds. -mllvm -sub (instructions substitution), -mllvm -fla (control-flow flattening) and -mllvm -bcf (bogus control-flow injection) are compilation flags specific to Obfuscator-LLVM, and thus, they are not supported by aarch64-linux-android-gcc.

You have two alternative solutions to solve your problem: either use Obfuscator-LLVM for building for the aarch64 target, or remove the offending flags (and produce a non-obfuscated target).

Upvotes: 1

Related Questions