blob: 10bea56d41886a68a3261ddf65ab8a774dba9399 [file] [log] [blame]
Ying Wangba8b3772014-03-10 18:23:08 -07001## Clang configurations.
2
Yi Kong65e45602018-11-12 09:32:47 -08003LLVM_RTLIB_PATH := $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/lib64/clang/$(LLVM_RELEASE_VERSION)/lib/linux/
Ying Wang1f982832014-02-06 18:08:44 -08004
Dan Willemsen02268f02016-05-19 14:39:25 -07005define convert-to-clang-flags
6$(strip $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(1)))
7endef
Ying Wang1f982832014-02-06 18:08:44 -08008
Dan Albertb5b2ffe2015-04-16 18:07:07 -07009CLANG_DEFAULT_UB_CHECKS := \
10 bool \
11 integer-divide-by-zero \
12 return \
13 returns-nonnull-attribute \
14 shift-exponent \
15 unreachable \
16 vla-bound \
17
18# TODO(danalbert): The following checks currently have compiler performance
19# issues.
20# CLANG_DEFAULT_UB_CHECKS += alignment
21# CLANG_DEFAULT_UB_CHECKS += bounds
22# CLANG_DEFAULT_UB_CHECKS += enum
23# CLANG_DEFAULT_UB_CHECKS += float-cast-overflow
24# CLANG_DEFAULT_UB_CHECKS += float-divide-by-zero
25# CLANG_DEFAULT_UB_CHECKS += nonnull-attribute
26# CLANG_DEFAULT_UB_CHECKS += null
27# CLANG_DEFAULT_UB_CHECKS += shift-base
28# CLANG_DEFAULT_UB_CHECKS += signed-integer-overflow
29
30# TODO(danalbert): Fix UB in libc++'s __tree so we can turn this on.
31# https://llvm.org/PR19302
32# http://reviews.llvm.org/D6974
33# CLANG_DEFAULT_UB_CHECKS += object-size
34
Ying Wang1f982832014-02-06 18:08:44 -080035# HOST config
Ying Wang6feb6d52014-04-17 10:03:35 -070036clang_2nd_arch_prefix :=
Ying Wang1f982832014-02-06 18:08:44 -080037include $(BUILD_SYSTEM)/clang/HOST_$(HOST_ARCH).mk
Ying Wang6feb6d52014-04-17 10:03:35 -070038
39# HOST_2ND_ARCH config
40ifdef HOST_2ND_ARCH
41clang_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX)
42include $(BUILD_SYSTEM)/clang/HOST_$(HOST_2ND_ARCH).mk
Tim Murray02cefc92014-03-20 13:48:35 -070043endif
Ying Wang1f982832014-02-06 18:08:44 -080044
Dan Willemsen9ecbf832016-02-05 16:20:19 -080045ifdef HOST_CROSS_ARCH
46clang_2nd_arch_prefix :=
47include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_ARCH).mk
48ifdef HOST_CROSS_2ND_ARCH
49clang_2nd_arch_prefix := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)
50include $(BUILD_SYSTEM)/clang/HOST_CROSS_$(HOST_CROSS_2ND_ARCH).mk
51endif
Dan Willemsen057aaea2015-08-14 12:59:50 -070052endif
53
Ying Wang1f982832014-02-06 18:08:44 -080054# TARGET config
55clang_2nd_arch_prefix :=
56include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_ARCH).mk
57
58# TARGET_2ND_ARCH config
59ifdef TARGET_2ND_ARCH
60clang_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
61include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_2ND_ARCH).mk
62endif
63
Ying Wang1f982832014-02-06 18:08:44 -080064# This allows us to use the superset of functionality that compiler-rt
65# provides to Clang (for supporting features like -ftrapv).
66COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
Ying Wange5d4e742014-11-06 14:11:33 -080067
Chih-Hung Hsieh460171a2016-04-21 15:37:24 -070068include $(BUILD_SYSTEM)/clang/tidy.mk