Ying Wang | 1f98283 | 2014-02-06 18:08:44 -0800 | [diff] [blame^] | 1 | |
| 2 | CLANG := $(HOST_OUT_EXECUTABLES)/clang$(HOST_EXECUTABLE_SUFFIX) |
| 3 | CLANG_CXX := $(HOST_OUT_EXECUTABLES)/clang++$(HOST_EXECUTABLE_SUFFIX) |
| 4 | LLVM_AS := $(HOST_OUT_EXECUTABLES)/llvm-as$(HOST_EXECUTABLE_SUFFIX) |
| 5 | LLVM_LINK := $(HOST_OUT_EXECUTABLES)/llvm-link$(HOST_EXECUTABLE_SUFFIX) |
| 6 | |
| 7 | # Clang flags for all host or target rules |
| 8 | CLANG_CONFIG_EXTRA_ASFLAGS := |
| 9 | CLANG_CONFIG_EXTRA_CFLAGS := |
| 10 | CLANG_CONFIG_EXTRA_CPPFLAGS := |
| 11 | CLANG_CONFIG_EXTRA_LDFLAGS := |
| 12 | |
| 13 | CLANG_CONFIG_EXTRA_CFLAGS := \ |
| 14 | -D__compiler_offsetof=__builtin_offsetof |
| 15 | |
| 16 | CLANG_CONFIG_UNKNOWN_CFLAGS := \ |
| 17 | -funswitch-loops \ |
| 18 | -Wno-psabi \ |
| 19 | -Wno-unused-but-set-variable \ |
| 20 | -Wno-unused-but-set-parameter |
| 21 | |
| 22 | # Clang flags for all host rules |
| 23 | CLANG_CONFIG_HOST_EXTRA_ASFLAGS := |
| 24 | CLANG_CONFIG_HOST_EXTRA_CFLAGS := |
| 25 | CLANG_CONFIG_HOST_EXTRA_CPPFLAGS := |
| 26 | CLANG_CONFIG_HOST_EXTRA_LDFLAGS := |
| 27 | |
| 28 | # Clang flags for all target rules |
| 29 | CLANG_CONFIG_TARGET_EXTRA_ASFLAGS := |
| 30 | CLANG_CONFIG_TARGET_EXTRA_CFLAGS := -nostdlibinc |
| 31 | CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS := -nostdlibinc |
| 32 | CLANG_CONFIG_TARGET_EXTRA_LDFLAGS := |
| 33 | |
| 34 | # HOST config |
| 35 | include $(BUILD_SYSTEM)/clang/HOST_$(HOST_ARCH).mk |
| 36 | |
| 37 | # TARGET config |
| 38 | clang_2nd_arch_prefix := |
| 39 | include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_ARCH).mk |
| 40 | |
| 41 | # TARGET_2ND_ARCH config |
| 42 | ifdef TARGET_2ND_ARCH |
| 43 | clang_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 44 | include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_2ND_ARCH).mk |
| 45 | endif |
| 46 | |
| 47 | |
| 48 | # Clang compiler-specific libc headers |
| 49 | CLANG_CONFIG_EXTRA_HOST_C_INCLUDES := external/clang/lib/include |
| 50 | CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES := external/clang/lib/include $(TARGET_OUT_HEADERS)/clang |
| 51 | |
| 52 | # Address sanitizer clang config |
| 53 | ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address |
| 54 | ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit |
| 55 | ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl libasan_preload |
| 56 | ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan |
| 57 | |
| 58 | # This allows us to use the superset of functionality that compiler-rt |
| 59 | # provides to Clang (for supporting features like -ftrapv). |
| 60 | COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras |