diff --git a/libc/Android.mk b/libc/Android.mk index 0f09e9169..c495e43b2 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -514,7 +514,10 @@ ifneq ($(TARGET_USES_LOGD),false) libc_common_cflags += -DTARGET_USES_LOGD endif -use_clang := false +use_clang := $(USE_CLANG_PLATFORM_BUILD) +ifeq ($(use_clang),) + use_clang := false +endif # Try to catch typical 32-bit assumptions that break with 64-bit pointers. libc_common_cflags += \ @@ -750,6 +753,13 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) 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 := \ $(libc_common_cflags) \ -Wno-sign-compare -Wno-uninitialized -Wno-unused-parameter \ @@ -763,7 +773,6 @@ LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) LOCAL_MODULE := libc_openbsd -LOCAL_CLANG := $(use_clang) LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) LOCAL_SYSTEM_SHARED_LIBRARIES := @@ -782,6 +791,13 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32) 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 := \ $(libc_common_cflags) \ -Wno-sign-compare -Wno-uninitialized \ @@ -795,7 +811,6 @@ LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) LOCAL_MODULE := libc_gdtoa -LOCAL_CLANG := $(use_clang) LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) LOCAL_SYSTEM_SHARED_LIBRARIES := @@ -813,6 +828,11 @@ LOCAL_SRC_FILES := $(libc_bionic_src_files) LOCAL_CFLAGS := $(libc_common_cflags) \ -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_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) diff --git a/linker/linker_executable.mk b/linker/linker_executable.mk index 4902a0cc5..a596a4805 100644 --- a/linker/linker_executable.mk +++ b/linker/linker_executable.mk @@ -9,6 +9,8 @@ LOCAL_MODULE_CLASS := EXECUTABLES 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 # See build/core/executable_internal.mk