aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-11-17 10:06:59 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2014-12-02 09:18:57 +0800
commit01a3a139b7a1bd03e874cfd2107b791cb1c505fb (patch)
tree0fa0e72d7a125942dfbb4da565cdc9f9a977de37 /build
parente505b304e02af3423a69735bb86fd1288a3641b4 (diff)
downloadndk-01a3a139b7a1bd03e874cfd2107b791cb1c505fb.tar.gz
Set GCC 4.8 as the default for 32-bit ABIs
Add get_first_gcc_version_for_arch and set to GCC 4.6 for 32-bit ABIs while it's still around (deprecated but will be removed in 1-2 release) Change-Id: I035c3b46ffb6c5aacf92893b920623acbae1719c
Diffstat (limited to 'build')
-rw-r--r--build/core/default-build-commands.mk8
-rw-r--r--build/core/init.mk10
-rw-r--r--build/core/setup-toolchain.mk4
-rwxr-xr-xbuild/tools/build-gnu-libstdc++.sh4
-rw-r--r--build/tools/dev-defaults.sh21
-rwxr-xr-xbuild/tools/gen-platforms.sh4
6 files changed, 33 insertions, 18 deletions
diff --git a/build/core/default-build-commands.mk b/build/core/default-build-commands.mk
index ee88037cb..34653307c 100644
--- a/build/core/default-build-commands.mk
+++ b/build/core/default-build-commands.mk
@@ -148,12 +148,12 @@ TARGET_ASMFLAGS =
TARGET_LD = $(TOOLCHAIN_PREFIX)ld
TARGET_LDFLAGS :=
-TARGET_AR = $(TOOLCHAIN_PREFIX)ar
-# Use *-gcc-ar instead of *-ar for better LTO support
-ifneq (,$(NDK_TOOLCHAIN_VERSION))
+# Use *-gcc-ar instead of *-ar for better LTO support, except for
+# gcc4.6 which doesn't have gcc-ar
ifneq (4.6,$(NDK_TOOLCHAIN_VERSION))
TARGET_AR = $(TOOLCHAIN_PREFIX)gcc-ar
-endif
+else
+TARGET_AR = $(TOOLCHAIN_PREFIX)ar
endif
TARGET_ARFLAGS := crsD
diff --git a/build/core/init.mk b/build/core/init.mk
index 06d49da26..56e5f300e 100644
--- a/build/core/init.mk
+++ b/build/core/init.mk
@@ -513,7 +513,7 @@ $(call ndk_log,Found max platform level: $(NDK_MAX_PLATFORM_LEVEL))
# in build/toolchains/<name>/ that will be included here.
#
# Each one of these files should define the following variables:
-# TOOLCHAIN_NAME toolchain name (e.g. arm-linux-androideabi-4.6)
+# TOOLCHAIN_NAME toolchain name (e.g. arm-linux-androideabi-4.9)
# TOOLCHAIN_ABIS list of target ABIs supported by the toolchain.
#
# Then, it should include $(ADD_TOOLCHAIN) which will perform
@@ -597,13 +597,13 @@ endif
# version number. Unlike NDK_TOOLCHAIN, this only changes the suffix of
# the toolchain path we're using.
#
-# For example, if GCC 4.6 is the default, defining NDK_TOOLCHAIN_VERSION=4.8
+# For example, if GCC 4.8 is the default, defining NDK_TOOLCHAIN_VERSION=4.9
# will ensure that ndk-build uses the following toolchains, depending on
# the target architecture:
#
-# arm -> arm-linux-androideabi-4.8
-# x86 -> x86-android-linux-4.8
-# mips -> mipsel-linux-android-4.8
+# arm -> arm-linux-androideabi-4.9
+# x86 -> x86-android-linux-4.9
+# mips -> mipsel-linux-android-4.9
#
# This is used in setup-toolchain.mk
#
diff --git a/build/core/setup-toolchain.mk b/build/core/setup-toolchain.mk
index 93fa85770..243df3fbf 100644
--- a/build/core/setup-toolchain.mk
+++ b/build/core/setup-toolchain.mk
@@ -36,8 +36,8 @@ ifndef NDK_TOOLCHAIN
$(filter-out %-clang$(_ver),$(TARGET_TOOLCHAIN_LIST))))
ifeq (,$(findstring 64,$(TARGET_ARCH_ABI)))
- # Filter out 4.7, 4.8 and 4.9 which are newer than the defaultat this moment
- __filtered_toolchain_list := $(filter-out %4.7 %4.8 %4.8l %4.9 %4.9l,$(TARGET_TOOLCHAIN_LIST))
+ # 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
diff --git a/build/tools/build-gnu-libstdc++.sh b/build/tools/build-gnu-libstdc++.sh
index 48a313d64..aa23fae08 100755
--- a/build/tools/build-gnu-libstdc++.sh
+++ b/build/tools/build-gnu-libstdc++.sh
@@ -390,10 +390,10 @@ copy_gnustl_libs ()
GCC_VERSION_LIST=$(commas_to_spaces $GCC_VERSION_LIST)
for ABI in $ABIS; do
ARCH=$(convert_abi_to_arch $ABI)
- DEFAULT_GCC_VERSION=$(get_default_gcc_version_for_arch $ARCH)
+ FIRST_GCC_VERSION=$(get_first_gcc_version_for_arch $ARCH)
for VERSION in $GCC_VERSION_LIST; do
# Only build for this GCC version if it on or after DEFAULT_GCC_VERSION
- if [ -z "$EXPLICIT_COMPILER_VERSION" ] && ! version_is_greater_than "${VERSION%%l}" "$DEFAULT_GCC_VERSION"; then
+ if [ -z "$EXPLICIT_COMPILER_VERSION" ] && version_is_greater_than "${VERSION%%l}" "$FIRST_GCC_VERSION"; then
continue
fi
diff --git a/build/tools/dev-defaults.sh b/build/tools/dev-defaults.sh
index 025b4c697..8078e3f84 100644
--- a/build/tools/dev-defaults.sh
+++ b/build/tools/dev-defaults.sh
@@ -49,8 +49,10 @@ TOOLCHAIN_GIT_DATE=now
# The space-separated list of all GCC versions we support in this NDK
DEFAULT_GCC_VERSION_LIST="4.6 4.8 4.9"
-DEFAULT_GCC32_VERSION=4.6
+DEFAULT_GCC32_VERSION=4.8
DEFAULT_GCC64_VERSION=4.9
+FIRST_GCC32_VERSION=4.6
+FIRST_GCC64_VERSION=4.9
DEFAULT_LLVM_GCC32_VERSION=4.8
DEFAULT_LLVM_GCC64_VERSION=4.9
@@ -121,6 +123,17 @@ get_default_gcc_version_for_arch ()
esac
}
+# Return the first gcc version for a given architecture
+# $1: Architecture name (e.g. 'arm')
+# Out: default arch-specific gcc version
+get_first_gcc_version_for_arch ()
+{
+ case $1 in
+ *64) echo $FIRST_GCC64_VERSION ;;
+ *) echo $FIRST_GCC32_VERSION ;;
+ esac
+}
+
# Return default NDK ABI for a given architecture name
# $1: Architecture name
# Out: ABI name
@@ -210,13 +223,13 @@ get_default_toolchain_prefix_for_arch ()
# Return empty for unknown arch
get_toolchain_name_list_for_arch ()
{
- local PREFIX VERSION RET ADD DEFAULT_GCC_VERSION VERSIONS
+ local PREFIX VERSION RET ADD FIRST_GCC_VERSION VERSIONS
PREFIX=$(eval echo \"\$DEFAULT_ARCH_TOOLCHAIN_NAME_$1\")
if [ -z "$PREFIX" ]; then
return 0
fi
RET=""
- DEFAULT_GCC_VERSION=$(get_default_gcc_version_for_arch $1)
+ FIRST_GCC_VERSION=$(get_first_gcc_version_for_arch $1)
ADD=""
VERSIONS=$(commas_to_spaces $2)
if [ -z "$VERSIONS" ]; then
@@ -225,7 +238,7 @@ get_toolchain_name_list_for_arch ()
ADD="yes" # include everything we passed explicitly
fi
for VERSION in $VERSIONS; do
- if [ -z "$ADD" -a "$VERSION" = "$DEFAULT_GCC_VERSION" ]; then
+ if [ -z "$ADD" -a "$VERSION" = "$FIRST_GCC_VERSION" ]; then
ADD="yes"
fi
if [ -z "$ADD" ]; then
diff --git a/build/tools/gen-platforms.sh b/build/tools/gen-platforms.sh
index 2f7982c43..49d4fd8ba 100755
--- a/build/tools/gen-platforms.sh
+++ b/build/tools/gen-platforms.sh
@@ -388,7 +388,9 @@ get_default_compiler_for_arch()
elif [ -n "$OPTION_GCC_VERSION" -a "$OPTION_GCC_VERSION" != "default" ]; then
GCC_VERSION=$OPTION_GCC_VERSION
else
- GCC_VERSION=$(get_default_gcc_version_for_arch $ARCH)
+ # By default we want to use the first gcc (currently 4.6) instead of the default (gcc4.8)
+ # for best compatibility, at least before gcc4.6 (now deprecated) is removed from NDK package
+ GCC_VERSION=$(get_first_gcc_version_for_arch $ARCH) # $(get_default_gcc_version_for_arch $ARCH)
fi
for TAG in $HOST_TAG $HOST_TAG32; do
TOOLCHAIN_PREFIX="$NDK_DIR/$(get_toolchain_binprefix_for_arch $ARCH $GCC_VERSION $TAG)"