Enable clang compilation with libc but not linker.

Clang is still disabled for x86 and x86_64 long double code,
for x86_64 special assembly instruction, and the linker module.

BUG: 17163651
BUG: 17302991
BUG: 17403674

(cherry picked from commit b58db8b083)

Change-Id: I916c05056d37a9c287b0a5ae3b1a209d98c8f70e
This commit is contained in:
Chih-Hung Hsieh 2014-09-04 15:19:52 -07:00 committed by Dmitriy Ivanov
parent 7210c41fdc
commit 81fe2b16dc
2 changed files with 25 additions and 3 deletions

View File

@ -503,7 +503,10 @@ ifneq ($(TARGET_USES_LOGD),false)
libc_common_cflags += -DTARGET_USES_LOGD libc_common_cflags += -DTARGET_USES_LOGD
endif endif
use_clang := $(USE_CLANG_PLATFORM_BUILD)
ifeq ($(use_clang),)
use_clang := false use_clang := false
endif
# Try to catch typical 32-bit assumptions that break with 64-bit pointers. # Try to catch typical 32-bit assumptions that break with 64-bit pointers.
libc_common_cflags += \ libc_common_cflags += \
@ -733,6 +736,13 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files) LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
# Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
LOCAL_CLANG := false
else
LOCAL_CLANG := $(use_clang)
endif
LOCAL_CFLAGS := \ LOCAL_CFLAGS := \
$(libc_common_cflags) \ $(libc_common_cflags) \
-Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \ -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \
@ -746,7 +756,6 @@ LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_CPPFLAGS := $(libc_common_cppflags)
LOCAL_C_INCLUDES := $(libc_common_c_includes) LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_openbsd LOCAL_MODULE := libc_openbsd
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_SYSTEM_SHARED_LIBRARIES := LOCAL_SYSTEM_SHARED_LIBRARIES :=
@ -765,6 +774,13 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32) LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64) LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
# Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
LOCAL_CLANG := false
else
LOCAL_CLANG := $(use_clang)
endif
LOCAL_CFLAGS := \ LOCAL_CFLAGS := \
$(libc_common_cflags) \ $(libc_common_cflags) \
-Wno-sign-compare -Wno-uninitialized \ -Wno-sign-compare -Wno-uninitialized \
@ -778,7 +794,6 @@ LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_CPPFLAGS := $(libc_common_cppflags)
LOCAL_C_INCLUDES := $(libc_common_c_includes) LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_gdtoa LOCAL_MODULE := libc_gdtoa
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_SYSTEM_SHARED_LIBRARIES := LOCAL_SYSTEM_SHARED_LIBRARIES :=
@ -796,6 +811,11 @@ LOCAL_SRC_FILES := $(libc_bionic_src_files)
LOCAL_CFLAGS := $(libc_common_cflags) \ LOCAL_CFLAGS := $(libc_common_cflags) \
-Wframe-larger-than=2048 \ -Wframe-larger-than=2048 \
ifeq ($(TARGET_ARCH),x86_64)
# Clang assembler has problem with ssse3-strcmp-slm.S, http://b/17302991
LOCAL_CLANG_ASFLAGS += -no-integrated-as
endif
LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_CPPFLAGS := $(libc_common_cppflags)
LOCAL_C_INCLUDES := $(libc_common_c_includes) LOCAL_C_INCLUDES := $(libc_common_c_includes)

View File

@ -9,6 +9,8 @@
LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX) LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
# Clang calls /usr/bin/ld: unrecognized option '--icf=safe', http://b/17403674.
LOCAL_CLANG := false
include $(BUILD_SYSTEM)/dynamic_binary.mk include $(BUILD_SYSTEM)/dynamic_binary.mk
# See build/core/executable_internal.mk # See build/core/executable_internal.mk