Skip to content

Commit

Permalink
Remove 3.6 from all the clang toolchains.
Browse files Browse the repository at this point in the history
3.6 is a lie.

Bug: #38
Change-Id: Ifb173cd2c8eee4dcdbe1cac503a1c905ec0227ed
  • Loading branch information
DanAlbert committed Apr 7, 2016
1 parent 0bdfce8 commit cc395fc
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 66 deletions.
2 changes: 1 addition & 1 deletion build/core/default-build-commands.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
92 changes: 27 additions & 65 deletions build/core/setup-toolchain.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,84 +20,46 @@
$(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.)
$(call __ndk_info,Please modify the APP_ABI definition in $(NDK_APP_APPLICATION_MK) to use)
$(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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit cc395fc

Please sign in to comment.