1 2include $(BUILD_SYSTEM)/clang/x86.mk 3 4CLANG_CONFIG_x86_TARGET_TRIPLE := i686-linux-android 5# NOTE: There is no i686-linux-android prebuilt, so we must hardcode the 6# x86_64 target instead. 7CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX := \ 8 $($(clang_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/x86_64-linux-android/bin 9 10CLANG_CONFIG_x86_TARGET_EXTRA_ASFLAGS := \ 11 $(CLANG_CONFIG_EXTRA_ASFLAGS) \ 12 $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \ 13 $(CLANG_CONFIG_x86_EXTRA_ASFLAGS) \ 14 -target $(CLANG_CONFIG_x86_TARGET_TRIPLE) \ 15 -B$(CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX) 16 17CLANG_CONFIG_x86_TARGET_EXTRA_CFLAGS := \ 18 $(CLANG_CONFIG_EXTRA_CFLAGS) \ 19 $(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \ 20 $(CLANG_CONFIG_x86_EXTRA_CFLAGS) \ 21 $(CLANG_CONFIG_x86_TARGET_EXTRA_ASFLAGS) \ 22 -fno-optimize-sibling-calls \ 23 -mstackrealign 24 25# http://llvm.org/bugs/show_bug.cgi?id=15086, 26# llvm tail call optimization is wrong for x86. 27# -mstackrealign is needed to realign stack in native code 28# that could be called from JNI, so that movaps instruction 29# will work on assumed stack aligned local variables. 30 31CLANG_CONFIG_x86_TARGET_EXTRA_CONLYFLAGS := \ 32 $(CLANG_CONFIG_EXTRA_CONLYFLAGS) \ 33 $(CLANG_CONFIG_TARGET_EXTRA_CONLYFLAGS) \ 34 $(CLANG_CONFIG_x86_EXTRA_CONLYFLAGS) 35 36CLANG_CONFIG_x86_TARGET_EXTRA_CPPFLAGS := \ 37 $(CLANG_CONFIG_EXTRA_CPPFLAGS) \ 38 $(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \ 39 $(CLANG_CONFIG_x86_EXTRA_CPPFLAGS) \ 40 41CLANG_CONFIG_x86_TARGET_EXTRA_LDFLAGS := \ 42 $(CLANG_CONFIG_EXTRA_LDFLAGS) \ 43 $(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \ 44 $(CLANG_CONFIG_x86_EXTRA_LDFLAGS) \ 45 -target $(CLANG_CONFIG_x86_TARGET_TRIPLE) \ 46 -B$(CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX) 47 48 49define $(clang_2nd_arch_prefix)convert-to-clang-flags 50 $(strip \ 51 $(call subst-clang-incompatible-x86-flags,\ 52 $(filter-out $(CLANG_CONFIG_x86_UNKNOWN_CFLAGS),\ 53 $(1)))) 54endef 55 56$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CFLAGS := \ 57 $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS)) \ 58 $(CLANG_CONFIG_x86_TARGET_EXTRA_CFLAGS) 59 60$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CONLYFLAGS := \ 61 $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CONLYFLAGS)) \ 62 $(CLANG_CONFIG_x86_TARGET_EXTRA_CONLYFLAGS) 63 64$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CPPFLAGS := \ 65 $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS)) \ 66 $(CLANG_CONFIG_x86_TARGET_EXTRA_CPPFLAGS) 67 68$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \ 69 $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS)) \ 70 $(CLANG_CONFIG_x86_TARGET_EXTRA_LDFLAGS) 71 72$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-none-linux-gnueabi 73$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS := -D__i386__ 74$(clang_2nd_arch_prefix)RS_COMPAT_TRIPLE := i686-linux-android 75 76$(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686-android.a 77