2014-03-11 02:23:08 +01:00
|
|
|
## Clang configurations.
|
|
|
|
|
2015-11-14 08:06:07 +01:00
|
|
|
LLVM_PREBUILTS_PATH := $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/bin
|
2016-02-04 20:43:41 +01:00
|
|
|
LLVM_RTLIB_PATH := $(LLVM_PREBUILTS_PATH)/../lib64/clang/$(LLVM_RELEASE_VERSION)/lib/linux/
|
2014-02-19 18:03:00 +01:00
|
|
|
|
2016-06-06 21:21:06 +02:00
|
|
|
# These will come from Soong, drop the environment versions
|
|
|
|
unexport CLANG
|
|
|
|
unexport CLANG_CXX
|
|
|
|
unexport CCC_CC
|
|
|
|
unexport CCC_CXX
|
|
|
|
|
2014-09-30 11:37:20 +02:00
|
|
|
CLANG_TBLGEN := $(BUILD_OUT_EXECUTABLES)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
|
|
|
|
LLVM_TBLGEN := $(BUILD_OUT_EXECUTABLES)/llvm-tblgen$(BUILD_EXECUTABLE_SUFFIX)
|
2014-02-07 03:08:44 +01:00
|
|
|
|
2016-01-22 08:50:53 +01:00
|
|
|
# RenderScript-specific tools
|
|
|
|
# These are tied to the version of LLVM directly in external/, so they might
|
|
|
|
# trail the host prebuilts being used for the rest of the build process.
|
2016-04-30 01:50:48 +02:00
|
|
|
RS_LLVM_PREBUILTS_VERSION := clang-2812033
|
2016-01-22 08:50:53 +01:00
|
|
|
RS_LLVM_PREBUILTS_BASE := prebuilts/clang/host
|
|
|
|
RS_LLVM_PREBUILTS_PATH := $(RS_LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(RS_LLVM_PREBUILTS_VERSION)/bin
|
2016-01-23 00:11:34 +01:00
|
|
|
RS_CLANG := $(RS_LLVM_PREBUILTS_PATH)/clang$(BUILD_EXECUTABLE_SUFFIX)
|
2016-01-22 08:50:53 +01:00
|
|
|
RS_LLVM_AS := $(RS_LLVM_PREBUILTS_PATH)/llvm-as$(BUILD_EXECUTABLE_SUFFIX)
|
|
|
|
RS_LLVM_LINK := $(RS_LLVM_PREBUILTS_PATH)/llvm-link$(BUILD_EXECUTABLE_SUFFIX)
|
|
|
|
|
2014-02-07 03:08:44 +01:00
|
|
|
CLANG_CONFIG_UNKNOWN_CFLAGS := \
|
2014-11-26 09:57:34 +01:00
|
|
|
-finline-functions \
|
2014-05-12 16:05:14 +02:00
|
|
|
-finline-limit=64 \
|
2014-08-27 01:37:00 +02:00
|
|
|
-fno-canonical-system-headers \
|
2015-05-01 23:53:59 +02:00
|
|
|
-Wno-clobbered \
|
|
|
|
-fno-devirtualize \
|
2014-08-27 01:37:00 +02:00
|
|
|
-fno-tree-sra \
|
2015-03-06 01:02:04 +01:00
|
|
|
-fprefetch-loop-arrays \
|
2014-08-27 01:37:00 +02:00
|
|
|
-funswitch-loops \
|
2015-03-19 23:17:06 +01:00
|
|
|
-Werror=unused-but-set-parameter \
|
2015-04-03 16:43:46 +02:00
|
|
|
-Werror=unused-but-set-variable \
|
2014-08-27 01:37:00 +02:00
|
|
|
-Wmaybe-uninitialized \
|
2015-05-01 23:53:59 +02:00
|
|
|
-Wno-error=clobbered \
|
2014-08-27 01:37:00 +02:00
|
|
|
-Wno-error=maybe-uninitialized \
|
2015-03-19 23:17:06 +01:00
|
|
|
-Wno-error=unused-but-set-parameter \
|
2015-04-02 23:42:20 +02:00
|
|
|
-Wno-error=unused-but-set-variable \
|
2014-10-24 01:39:09 +02:00
|
|
|
-Wno-free-nonheap-object \
|
2014-08-27 01:37:00 +02:00
|
|
|
-Wno-literal-suffix \
|
|
|
|
-Wno-maybe-uninitialized \
|
|
|
|
-Wno-old-style-declaration \
|
2014-02-07 03:08:44 +01:00
|
|
|
-Wno-psabi \
|
2014-05-09 08:13:13 +02:00
|
|
|
-Wno-unused-but-set-parameter \
|
2015-04-02 23:42:20 +02:00
|
|
|
-Wno-unused-but-set-variable \
|
|
|
|
-Wno-unused-local-typedefs \
|
|
|
|
-Wunused-but-set-parameter \
|
2015-09-25 07:14:25 +02:00
|
|
|
-Wunused-but-set-variable \
|
2015-10-15 01:44:53 +02:00
|
|
|
-fdiagnostics-color \
|
2016-05-19 23:39:25 +02:00
|
|
|
-mthumb-interwork \
|
|
|
|
-fgcse-after-reload \
|
|
|
|
-frerun-cse-after-loop \
|
|
|
|
-frename-registers \
|
|
|
|
-fno-align-jumps \
|
|
|
|
-fno-builtin-sin \
|
|
|
|
-fno-caller-saves \
|
|
|
|
-fno-early-inlining \
|
|
|
|
-fno-move-loop-invariants \
|
|
|
|
-fno-partial-inlining \
|
|
|
|
-fno-strict-volatile-bitfields \
|
|
|
|
-fno-tree-copy-prop \
|
|
|
|
-fno-tree-loop-optimize \
|
|
|
|
-msynci \
|
|
|
|
-mno-synci \
|
|
|
|
-mno-fused-madd \
|
|
|
|
-finline-limit=300 \
|
|
|
|
-fno-inline-functions-called-once \
|
|
|
|
-mfpmath=sse \
|
|
|
|
-mbionic
|
|
|
|
|
|
|
|
define convert-to-clang-flags
|
|
|
|
$(strip $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(1)))
|
|
|
|
endef
|
2014-02-07 03:08:44 +01:00
|
|
|
|
2015-04-17 03:07:07 +02:00
|
|
|
CLANG_DEFAULT_UB_CHECKS := \
|
|
|
|
bool \
|
|
|
|
integer-divide-by-zero \
|
|
|
|
return \
|
|
|
|
returns-nonnull-attribute \
|
|
|
|
shift-exponent \
|
|
|
|
unreachable \
|
|
|
|
vla-bound \
|
|
|
|
|
|
|
|
# TODO(danalbert): The following checks currently have compiler performance
|
|
|
|
# issues.
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += alignment
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += bounds
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += enum
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += float-cast-overflow
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += float-divide-by-zero
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += nonnull-attribute
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += null
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += shift-base
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += signed-integer-overflow
|
|
|
|
|
|
|
|
# TODO(danalbert): Fix UB in libc++'s __tree so we can turn this on.
|
|
|
|
# https://llvm.org/PR19302
|
|
|
|
# http://reviews.llvm.org/D6974
|
|
|
|
# CLANG_DEFAULT_UB_CHECKS += object-size
|
|
|
|
|
2014-02-07 03:08:44 +01:00
|
|
|
# HOST config
|
2014-04-17 19:03:35 +02:00
|
|
|
clang_2nd_arch_prefix :=
|
2014-02-07 03:08:44 +01:00
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_ARCH).mk
|
2014-04-17 19:03:35 +02:00
|
|
|
|
|
|
|
# HOST_2ND_ARCH config
|
|
|
|
ifdef HOST_2ND_ARCH
|
|
|
|
clang_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_2ND_ARCH).mk
|
2014-03-20 21:48:35 +01:00
|
|
|
endif
|
2014-02-07 03:08:44 +01:00
|
|
|
|
2016-02-06 01:20:19 +01:00
|
|
|
ifdef HOST_CROSS_ARCH
|
|
|
|
clang_2nd_arch_prefix :=
|
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_ARCH).mk
|
|
|
|
ifdef HOST_CROSS_2ND_ARCH
|
|
|
|
clang_2nd_arch_prefix := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_2ND_ARCH).mk
|
|
|
|
endif
|
2015-08-14 21:59:50 +02:00
|
|
|
endif
|
|
|
|
|
2014-02-07 03:08:44 +01:00
|
|
|
# TARGET config
|
|
|
|
clang_2nd_arch_prefix :=
|
|
|
|
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_ARCH).mk
|
|
|
|
|
|
|
|
# TARGET_2ND_ARCH config
|
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
clang_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_2ND_ARCH).mk
|
|
|
|
endif
|
|
|
|
|
2014-12-12 03:56:26 +01:00
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fno-omit-frame-pointer
|
2014-02-07 03:08:44 +01:00
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
|
2014-10-20 20:37:18 +02:00
|
|
|
|
2014-11-15 02:15:00 +01:00
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
|
2014-02-07 03:08:44 +01: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
|
2014-11-06 23:11:33 +01:00
|
|
|
|
|
|
|
ifeq ($(HOST_PREFER_32_BIT),true)
|
|
|
|
# We don't have 32-bit prebuilt libLLVM/libclang, so force to build them from source.
|
|
|
|
FORCE_BUILD_LLVM_COMPONENTS := true
|
|
|
|
endif
|
2016-04-22 00:37:24 +02:00
|
|
|
|
2016-08-02 23:22:06 +02:00
|
|
|
# A list of projects that are allowed to set LOCAL_CLANG to false.
|
2016-08-03 20:39:02 +02:00
|
|
|
# INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS is defined later in other config.mk.
|
|
|
|
LOCAL_CLANG_EXCEPTION_PROJECTS = \
|
2016-08-03 19:42:10 +02:00
|
|
|
bionic/tests/ \
|
2016-08-02 23:22:06 +02:00
|
|
|
device/huawei/angler/ \
|
|
|
|
device/lge/bullhead/ \
|
|
|
|
external/valgrind/ \
|
|
|
|
hardware/qcom/ \
|
|
|
|
$(INTERNAL_LOCAL_CLANG_EXCEPTION_PROJECTS)
|
|
|
|
|
|
|
|
# Find $1 in the exception project list.
|
|
|
|
define find_in_local_clang_exception_projects
|
|
|
|
$(subst $(space),, \
|
|
|
|
$(foreach project,$(LOCAL_CLANG_EXCEPTION_PROJECTS), \
|
|
|
|
$(if $(filter $(project)%,$(1)),$(project)) \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2016-04-22 00:37:24 +02:00
|
|
|
include $(BUILD_SYSTEM)/clang/tidy.mk
|