From cc395fc683b304fb131b1c4ec9ef7b51c10b0ec7 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Thu, 7 Apr 2016 14:52:50 -0700 Subject: [PATCH] Remove 3.6 from all the clang toolchains. 3.6 is a lie. Bug: https://github.com/android-ndk/ndk/issues/38 Change-Id: Ifb173cd2c8eee4dcdbe1cac503a1c905ec0227ed --- build/core/default-build-commands.mk | 2 +- build/core/setup-toolchain.mk | 92 ++++++------------- .../config.mk | 0 .../setup.mk | 0 .../config.mk | 0 .../setup.mk | 0 .../config.mk | 0 .../setup.mk | 0 .../config.mk | 0 .../setup.mk | 0 .../{x86-clang3.6 => x86-clang}/config.mk | 0 .../{x86-clang3.6 => x86-clang}/setup.mk | 0 .../config.mk | 0 .../setup.mk | 0 14 files changed, 28 insertions(+), 66 deletions(-) rename build/core/toolchains/{aarch64-linux-android-clang3.6 => aarch64-linux-android-clang}/config.mk (100%) rename build/core/toolchains/{aarch64-linux-android-clang3.6 => aarch64-linux-android-clang}/setup.mk (100%) rename build/core/toolchains/{arm-linux-androideabi-clang3.6 => arm-linux-androideabi-clang}/config.mk (100%) rename build/core/toolchains/{arm-linux-androideabi-clang3.6 => arm-linux-androideabi-clang}/setup.mk (100%) rename build/core/toolchains/{mips64el-linux-android-clang3.6 => mips64el-linux-android-clang}/config.mk (100%) rename build/core/toolchains/{mips64el-linux-android-clang3.6 => mips64el-linux-android-clang}/setup.mk (100%) rename build/core/toolchains/{mipsel-linux-android-clang3.6 => mipsel-linux-android-clang}/config.mk (100%) rename build/core/toolchains/{mipsel-linux-android-clang3.6 => mipsel-linux-android-clang}/setup.mk (100%) rename build/core/toolchains/{x86-clang3.6 => x86-clang}/config.mk (100%) rename build/core/toolchains/{x86-clang3.6 => x86-clang}/setup.mk (100%) rename build/core/toolchains/{x86_64-clang3.6 => x86_64-clang}/config.mk (100%) rename build/core/toolchains/{x86_64-clang3.6 => x86_64-clang}/setup.mk (100%) diff --git a/build/core/default-build-commands.mk b/build/core/default-build-commands.mk index 2a8eced51..49f1bb294 100644 --- a/build/core/default-build-commands.mk +++ b/build/core/default-build-commands.mk @@ -150,7 +150,7 @@ TARGET_LDFLAGS := # Use *-gcc-ar instead of *-ar for better LTO support, except for # gcc4.6 which doesn't have gcc-ar -ifneq (clang3.6,$(NDK_TOOLCHAIN_VERSION)) +ifneq (clang,$(NDK_TOOLCHAIN_VERSION)) TARGET_AR = $(TOOLCHAIN_PREFIX)gcc-ar else TARGET_AR = $(TOOLCHAIN_PREFIX)ar diff --git a/build/core/setup-toolchain.mk b/build/core/setup-toolchain.mk index ce5407250..b4c7bbc8a 100644 --- a/build/core/setup-toolchain.mk +++ b/build/core/setup-toolchain.mk @@ -20,31 +20,15 @@ $(call assert-defined,TARGET_PLATFORM TARGET_ARCH TARGET_ARCH_ABI) $(call assert-defined,NDK_APPS NDK_APP_STL) -LLVM_VERSION_LIST := 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 -NDK_64BIT_TOOLCHAIN_LIST := clang3.6 clang3.5 clang3.4 4.9 - # Check that we have a toolchain that supports the current ABI. # NOTE: If NDK_TOOLCHAIN is defined, we're going to use it. -# ifndef NDK_TOOLCHAIN - TARGET_TOOLCHAIN_LIST := $(strip $(sort $(NDK_ABI.$(TARGET_ARCH_ABI).toolchains))) - - # Filter out the Clang toolchain, so that we can keep GCC as the default - # toolchain. - $(foreach _ver,$(LLVM_VERSION_LIST), \ - $(eval TARGET_TOOLCHAIN_LIST := \ - $(filter-out %-clang$(_ver),$(TARGET_TOOLCHAIN_LIST)))) - - ifeq (,$(findstring 64,$(TARGET_ARCH_ABI))) - # Filter out 4.6 and 4.7 which are deprecated - __filtered_toolchain_list := $(filter-out %4.6 %4.7,$(TARGET_TOOLCHAIN_LIST)) - ifdef __filtered_toolchain_list - TARGET_TOOLCHAIN_LIST := $(__filtered_toolchain_list) - endif - else - # Filter out 4.6, 4.7 and 4.8 which don't have good 64-bit support in all supported arch - TARGET_TOOLCHAIN_LIST := $(filter-out %4.6 %4.7 %4.8 %4.8l,$(TARGET_TOOLCHAIN_LIST)) - endif + # This is a sorted list of toolchains that support the given ABI. For older + # NDKs this was a bit more complicated, but now we just have the GCC and the + # Clang toolchains with GCC being first (named "*-4.9", whereas clang is + # "*-clang"). + TARGET_TOOLCHAIN_LIST := \ + $(strip $(sort $(NDK_ABI.$(TARGET_ARCH_ABI).toolchains))) ifndef TARGET_TOOLCHAIN_LIST $(call __ndk_info,There is no toolchain that supports the $(TARGET_ARCH_ABI) ABI.) @@ -52,52 +36,30 @@ ifndef NDK_TOOLCHAIN $(call __ndk_info,a set of the following values: $(NDK_ALL_ABIS)) $(call __ndk_error,Aborting) endif - # Select the last toolchain from the sorted list. - # For now, this is enough to select by default gcc4.8 for 32-bit, and 4.9 for 64-bit, the the - # latest llvm if no gcc - ifneq (,$(filter-out llvm-%,$(TARGET_TOOLCHAIN_LIST))) - TARGET_TOOLCHAIN := $(firstword $(TARGET_TOOLCHAIN_LIST)) - else - TARGET_TOOLCHAIN := $(lastword $(TARGET_TOOLCHAIN_LIST)) - endif + + # We default to using GCC, which is the first item in the list. + TARGET_TOOLCHAIN := $(firstword $(TARGET_TOOLCHAIN_LIST)) + # If NDK_TOOLCHAIN_VERSION is defined, we replace the toolchain version # suffix with it. - # ifdef NDK_TOOLCHAIN_VERSION - # Replace "clang" with the most recent verion - ifeq ($(NDK_TOOLCHAIN_VERSION),clang) - override NDK_TOOLCHAIN_VERSION := clang$(lastword $(LLVM_VERSION_LIST)) - endif - __use_ndk_toolchain_version := true - ifneq (,$(findstring 64,$(TARGET_ARCH_ABI))) - # don't allow NDK_TOOLCHAIN_VERSION to change if it doesn't support 64-bit - ifeq (,$(filter $(NDK_64BIT_TOOLCHAIN_LIST),$(NDK_TOOLCHAIN_VERSION))) - $(call ndk_log,Specified NDK_TOOLCHAIN_VERSION $(NDK_TOOLCHAIN_VERSION) does not support 64-bit) - $(call ndk_log,Using default target toolchain '$(TARGET_TOOLCHAIN)' for '$(TARGET_ARCH_ABI)' ABI) - __use_ndk_toolchain_version := false; - endif - endif - ifeq ($(__use_ndk_toolchain_version),true) - # We assume the toolchain name uses dashes (-) as separators and doesn't - # contain any space. The following is a bit subtle, but essentially - # does the following: - # - # 1/ Use 'subst' to convert dashes into spaces, this generates a list - # 2/ Use 'chop' to remove the last element of the list - # 3/ Use 'subst' again to convert the spaces back into dashes - # - # So it TARGET_TOOLCHAIN is 'foo-bar-zoo-xxx', then - # TARGET_TOOLCHAIN_BASE will be 'foo-bar-zoo' - # - TARGET_TOOLCHAIN_BASE := $(subst $(space),-,$(call chop,$(subst -,$(space),$(TARGET_TOOLCHAIN)))) - # if TARGET_TOOLCHAIN_BASE is llvm, remove clang from NDK_TOOLCHAIN_VERSION - VERSION := $(NDK_TOOLCHAIN_VERSION) - ifeq ($(TARGET_TOOLCHAIN_BASE),llvm) - VERSION := $(subst clang,,$(NDK_TOOLCHAIN_VERSION)) - endif - TARGET_TOOLCHAIN := $(TARGET_TOOLCHAIN_BASE)-$(VERSION) - $(call ndk_log,Using target toolchain '$(TARGET_TOOLCHAIN)' for '$(TARGET_ARCH_ABI)' ABI (through NDK_TOOLCHAIN_VERSION)) - endif + # We assume the toolchain name uses dashes (-) as separators and doesn't + # contain any space. The following is a bit subtle, but essentially + # does the following: + # + # 1/ Use 'subst' to convert dashes into spaces, this generates a list + # 2/ Use 'chop' to remove the last element of the list + # 3/ Use 'subst' again to convert the spaces back into dashes + # + # So it TARGET_TOOLCHAIN is 'foo-bar-zoo-xxx', then + # TARGET_TOOLCHAIN_BASE will be 'foo-bar-zoo' + # + TARGET_TOOLCHAIN_BASE := \ + $(subst $(space),-,$(call chop,$(subst -,$(space),$(TARGET_TOOLCHAIN)))) + # if TARGET_TOOLCHAIN_BASE is llvm, remove clang from NDK_TOOLCHAIN_VERSION + VERSION := $(NDK_TOOLCHAIN_VERSION) + TARGET_TOOLCHAIN := $(TARGET_TOOLCHAIN_BASE)-$(VERSION) + $(call ndk_log,Using target toolchain '$(TARGET_TOOLCHAIN)' for '$(TARGET_ARCH_ABI)' ABI (through NDK_TOOLCHAIN_VERSION)) else $(call ndk_log,Using target toolchain '$(TARGET_TOOLCHAIN)' for '$(TARGET_ARCH_ABI)' ABI) endif diff --git a/build/core/toolchains/aarch64-linux-android-clang3.6/config.mk b/build/core/toolchains/aarch64-linux-android-clang/config.mk similarity index 100% rename from build/core/toolchains/aarch64-linux-android-clang3.6/config.mk rename to build/core/toolchains/aarch64-linux-android-clang/config.mk diff --git a/build/core/toolchains/aarch64-linux-android-clang3.6/setup.mk b/build/core/toolchains/aarch64-linux-android-clang/setup.mk similarity index 100% rename from build/core/toolchains/aarch64-linux-android-clang3.6/setup.mk rename to build/core/toolchains/aarch64-linux-android-clang/setup.mk diff --git a/build/core/toolchains/arm-linux-androideabi-clang3.6/config.mk b/build/core/toolchains/arm-linux-androideabi-clang/config.mk similarity index 100% rename from build/core/toolchains/arm-linux-androideabi-clang3.6/config.mk rename to build/core/toolchains/arm-linux-androideabi-clang/config.mk diff --git a/build/core/toolchains/arm-linux-androideabi-clang3.6/setup.mk b/build/core/toolchains/arm-linux-androideabi-clang/setup.mk similarity index 100% rename from build/core/toolchains/arm-linux-androideabi-clang3.6/setup.mk rename to build/core/toolchains/arm-linux-androideabi-clang/setup.mk diff --git a/build/core/toolchains/mips64el-linux-android-clang3.6/config.mk b/build/core/toolchains/mips64el-linux-android-clang/config.mk similarity index 100% rename from build/core/toolchains/mips64el-linux-android-clang3.6/config.mk rename to build/core/toolchains/mips64el-linux-android-clang/config.mk diff --git a/build/core/toolchains/mips64el-linux-android-clang3.6/setup.mk b/build/core/toolchains/mips64el-linux-android-clang/setup.mk similarity index 100% rename from build/core/toolchains/mips64el-linux-android-clang3.6/setup.mk rename to build/core/toolchains/mips64el-linux-android-clang/setup.mk diff --git a/build/core/toolchains/mipsel-linux-android-clang3.6/config.mk b/build/core/toolchains/mipsel-linux-android-clang/config.mk similarity index 100% rename from build/core/toolchains/mipsel-linux-android-clang3.6/config.mk rename to build/core/toolchains/mipsel-linux-android-clang/config.mk diff --git a/build/core/toolchains/mipsel-linux-android-clang3.6/setup.mk b/build/core/toolchains/mipsel-linux-android-clang/setup.mk similarity index 100% rename from build/core/toolchains/mipsel-linux-android-clang3.6/setup.mk rename to build/core/toolchains/mipsel-linux-android-clang/setup.mk diff --git a/build/core/toolchains/x86-clang3.6/config.mk b/build/core/toolchains/x86-clang/config.mk similarity index 100% rename from build/core/toolchains/x86-clang3.6/config.mk rename to build/core/toolchains/x86-clang/config.mk diff --git a/build/core/toolchains/x86-clang3.6/setup.mk b/build/core/toolchains/x86-clang/setup.mk similarity index 100% rename from build/core/toolchains/x86-clang3.6/setup.mk rename to build/core/toolchains/x86-clang/setup.mk diff --git a/build/core/toolchains/x86_64-clang3.6/config.mk b/build/core/toolchains/x86_64-clang/config.mk similarity index 100% rename from build/core/toolchains/x86_64-clang3.6/config.mk rename to build/core/toolchains/x86_64-clang/config.mk diff --git a/build/core/toolchains/x86_64-clang3.6/setup.mk b/build/core/toolchains/x86_64-clang/setup.mk similarity index 100% rename from build/core/toolchains/x86_64-clang3.6/setup.mk rename to build/core/toolchains/x86_64-clang/setup.mk