2012-01-12 16:09:06 +01:00
|
|
|
CLANG := $(HOST_OUT_EXECUTABLES)/clang$(HOST_EXECUTABLE_SUFFIX)
|
2012-03-20 15:00:16 +01:00
|
|
|
CLANG_CXX := $(HOST_OUT_EXECUTABLES)/clang++$(HOST_EXECUTABLE_SUFFIX)
|
2012-05-09 03:43:48 +02:00
|
|
|
LLVM_AS := $(HOST_OUT_EXECUTABLES)/llvm-as$(HOST_EXECUTABLE_SUFFIX)
|
2012-01-12 16:09:06 +01:00
|
|
|
LLVM_LINK := $(HOST_OUT_EXECUTABLES)/llvm-link$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
|
|
|
|
define do-clang-flags-subst
|
|
|
|
TARGET_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(TARGET_GLOBAL_CLANG_FLAGS))
|
|
|
|
HOST_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(HOST_GLOBAL_CLANG_FLAGS))
|
|
|
|
endef
|
|
|
|
|
|
|
|
define clang-flags-subst
|
|
|
|
$(eval $(call do-clang-flags-subst,$(1),$(2)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
2012-03-20 15:00:16 +01:00
|
|
|
CLANG_CONFIG_EXTRA_CFLAGS := \
|
|
|
|
-D__compiler_offsetof=__builtin_offsetof \
|
|
|
|
|
2012-01-12 16:09:06 +01:00
|
|
|
CLANG_CONFIG_UNKNOWN_CFLAGS := \
|
2012-03-20 15:00:16 +01:00
|
|
|
-funswitch-loops
|
|
|
|
|
|
|
|
ifeq ($(TARGET_ARCH),arm)
|
2012-08-21 13:45:56 +02:00
|
|
|
CLANG_CONFIG_EXTRA_ASFLAGS += \
|
2012-03-20 15:00:16 +01:00
|
|
|
-target arm-linux-androideabi \
|
2012-03-26 12:15:47 +02:00
|
|
|
-nostdlibinc \
|
2012-08-21 13:45:56 +02:00
|
|
|
-B$(TARGET_TOOLCHAIN_ROOT)/arm-linux-androideabi/bin
|
|
|
|
CLANG_CONFIG_EXTRA_CFLAGS += \
|
|
|
|
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
|
2012-03-20 15:00:16 +01:00
|
|
|
-mllvm -arm-enable-ehabi
|
|
|
|
CLANG_CONFIG_EXTRA_LDFLAGS += \
|
|
|
|
-target arm-linux-androideabi \
|
|
|
|
-B$(TARGET_TOOLCHAIN_ROOT)/arm-linux-androideabi/bin
|
|
|
|
CLANG_CONFIG_UNKNOWN_CFLAGS += \
|
|
|
|
-mthumb-interwork \
|
|
|
|
-fgcse-after-reload \
|
|
|
|
-frerun-cse-after-loop \
|
|
|
|
-frename-registers \
|
2012-04-05 09:44:37 +02:00
|
|
|
-fno-builtin-sin \
|
|
|
|
-fno-strict-volatile-bitfields \
|
|
|
|
-fno-align-jumps \
|
2012-03-20 15:00:16 +01:00
|
|
|
-Wa,--noexecstack
|
|
|
|
endif
|
2012-08-16 02:53:29 +02:00
|
|
|
ifeq ($(TARGET_ARCH),mips)
|
2012-08-21 13:45:56 +02:00
|
|
|
CLANG_CONFIG_EXTRA_ASFLAGS += \
|
2012-08-21 19:20:18 +02:00
|
|
|
-target mipsel-linux-androideabi \
|
2012-08-16 02:53:29 +02:00
|
|
|
-nostdlibinc \
|
|
|
|
-B$(TARGET_TOOLCHAIN_ROOT)/mipsel-linux-android/bin
|
2012-08-21 13:45:56 +02:00
|
|
|
CLANG_CONFIG_EXTRA_CFLAGS += $(CLANG_CONFIG_EXTRA_ASFLAGS)
|
2012-08-16 02:53:29 +02:00
|
|
|
CLANG_CONFIG_EXTRA_LDFLAGS += \
|
2012-08-21 19:20:18 +02:00
|
|
|
-target mipsel-linux-androideabi \
|
2012-08-16 02:53:29 +02:00
|
|
|
-B$(TARGET_TOOLCHAIN_ROOT)/mipsel-linux-android/bin
|
|
|
|
CLANG_CONFIG_UNKNOWN_CFLAGS += \
|
|
|
|
-EL \
|
2012-10-05 22:26:19 +02:00
|
|
|
-mips32 \
|
2012-08-16 02:53:29 +02:00
|
|
|
-mips32r2 \
|
|
|
|
-mhard-float \
|
|
|
|
-fno-strict-volatile-bitfields \
|
|
|
|
-fgcse-after-reload \
|
|
|
|
-frerun-cse-after-loop \
|
|
|
|
-frename-registers \
|
|
|
|
-march=mips32r2 \
|
2012-10-05 22:26:19 +02:00
|
|
|
-mtune=mips32r2 \
|
|
|
|
-march=mips32 \
|
|
|
|
-mtune=mips32
|
2012-08-16 02:53:29 +02:00
|
|
|
endif
|
2012-03-20 15:00:16 +01:00
|
|
|
ifeq ($(TARGET_ARCH),x86)
|
2012-08-21 13:45:56 +02:00
|
|
|
CLANG_CONFIG_EXTRA_ASFLAGS += \
|
2012-05-16 22:18:39 +02:00
|
|
|
-target i686-linux-android \
|
2012-03-26 12:15:47 +02:00
|
|
|
-nostdlibinc \
|
2012-05-16 22:18:39 +02:00
|
|
|
-B$(TARGET_TOOLCHAIN_ROOT)/i686-linux-android/bin
|
2012-08-21 13:45:56 +02:00
|
|
|
CLANG_CONFIG_EXTRA_CFLAGS += $(CLANG_CONFIG_EXTRA_ASFLAGS)
|
2012-03-20 15:00:16 +01:00
|
|
|
CLANG_CONFIG_EXTRA_LDFLAGS += \
|
2012-05-16 22:18:39 +02:00
|
|
|
-target i686-linux-android \
|
|
|
|
-B$(TARGET_TOOLCHAIN_ROOT)/i686-linux-android/bin
|
2012-03-20 15:00:16 +01:00
|
|
|
CLANG_CONFIG_UNKNOWN_CFLAGS += \
|
|
|
|
-finline-limit=300 \
|
|
|
|
-fno-inline-functions-called-once \
|
|
|
|
-mfpmath=sse \
|
|
|
|
-mbionic
|
|
|
|
endif
|
|
|
|
|
2012-04-05 09:44:37 +02:00
|
|
|
CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES := external/clang/lib/include $(TARGET_OUT_HEADERS)/clang
|
2012-01-12 16:09:06 +01:00
|
|
|
|
|
|
|
# remove unknown flags to define CLANG_FLAGS
|
|
|
|
TARGET_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(TARGET_GLOBAL_CFLAGS))
|
|
|
|
HOST_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(HOST_GLOBAL_CFLAGS))
|
|
|
|
|
2012-04-05 09:44:37 +02:00
|
|
|
TARGET_arm_CLANG_CFLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(TARGET_arm_CFLAGS))
|
|
|
|
TARGET_thumb_CLANG_CFLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(TARGET_thumb_CFLAGS))
|
|
|
|
|
2012-01-12 16:09:06 +01:00
|
|
|
# llvm does not yet support -march=armv5e nor -march=armv5te, fall back to armv5 or armv5t
|
|
|
|
$(call clang-flags-subst,-march=armv5te,-march=armv5t)
|
|
|
|
$(call clang-flags-subst,-march=armv5e,-march=armv5)
|
2012-03-30 10:15:12 +02:00
|
|
|
|
2012-08-03 14:17:23 +02:00
|
|
|
# clang does not support -Wno-psabi and -Wno-unused-but-set-variable
|
|
|
|
$(call clang-flags-subst,-Wno-psabi,)
|
|
|
|
$(call clang-flags-subst,-Wno-unused-but-set-variable,)
|
|
|
|
|
2013-01-14 22:45:45 +01:00
|
|
|
# clang does not support -mcpu=cortex-a15 yet - fall back to armv7-a for now
|
|
|
|
$(call clang-flags-subst,-mcpu=cortex-a15,-march=armv7-a)
|
|
|
|
|
2012-03-30 10:15:12 +02:00
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -faddress-sanitizer
|
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
|
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl libasan_preload
|
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
|
2012-06-11 23:53:34 +02:00
|
|
|
|
|
|
|
# This allows us to use the superset of functionality that compiler-rt
|
|
|
|
# provides to Clang (for supporting features like -ftrapv).
|
|
|
|
COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler-rt-extras
|