aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-06-06 21:24:51 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2014-06-13 09:33:59 -0700
commit34b3f0c1a953da194ca398dd3a4e2ed51febac67 (patch)
treeba9a86a709cecfeae5c356c8329cb0020a62787c
parent6e509fcbfa0e31c9bceb93f2a45c56c63d2d72ef (diff)
downloadndk-34b3f0c1a953da194ca398dd3a4e2ed51febac67.tar.gz
misc fixes
Change-Id: I2d8d27609f1113d31590b1fb8bea68056b086769
-rw-r--r--build/core/setup-toolchain.mk2
-rwxr-xr-xbuild/tools/build-compiler-rt.sh1
-rwxr-xr-xbuild/tools/build-cxx-stl.sh1
-rwxr-xr-xbuild/tools/build-gcc.sh28
-rwxr-xr-xbuild/tools/build-gnu-libstdc++.sh29
-rwxr-xr-xbuild/tools/build-mingw64-toolchain.sh6
-rw-r--r--build/tools/builder-funcs.sh10
-rw-r--r--build/tools/dev-defaults.sh14
-rwxr-xr-xbuild/tools/make-standalone-toolchain.sh36
-rw-r--r--tests/build/b14825026-aarch64-FP_LO_REGS/BROKEN_BUILD2
-rw-r--r--toolchains/aarch64-linux-android-4.9/setup.mk4
-rw-r--r--toolchains/mips64el-linux-android-clang3.4/setup.mk2
12 files changed, 81 insertions, 54 deletions
diff --git a/build/core/setup-toolchain.mk b/build/core/setup-toolchain.mk
index b5f2cc232..530ca85b6 100644
--- a/build/core/setup-toolchain.mk
+++ b/build/core/setup-toolchain.mk
@@ -39,7 +39,7 @@ ifndef NDK_TOOLCHAIN
TARGET_TOOLCHAIN_LIST := $(filter-out %4.7 %4.8 %4.8l %4.9 %4.9l,$(TARGET_TOOLCHAIN_LIST))
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,$(TARGET_TOOLCHAIN_LIST))
+ TARGET_TOOLCHAIN_LIST := $(filter-out %4.6 %4.7 %4.8 %4.8l,$(TARGET_TOOLCHAIN_LIST))
endif
ifndef TARGET_TOOLCHAIN_LIST
diff --git a/build/tools/build-compiler-rt.sh b/build/tools/build-compiler-rt.sh
index 6d60a11d6..031ef8824 100755
--- a/build/tools/build-compiler-rt.sh
+++ b/build/tools/build-compiler-rt.sh
@@ -84,6 +84,7 @@ if [ -z "$OPTION_BUILD_DIR" ]; then
else
BUILD_DIR=$OPTION_BUILD_DIR
fi
+rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
fail_panic "Could not create build directory: $BUILD_DIR"
diff --git a/build/tools/build-cxx-stl.sh b/build/tools/build-cxx-stl.sh
index 8486410bf..006354e43 100755
--- a/build/tools/build-cxx-stl.sh
+++ b/build/tools/build-cxx-stl.sh
@@ -145,6 +145,7 @@ if [ -z "$OPTION_BUILD_DIR" ]; then
else
BUILD_DIR=$OPTION_BUILD_DIR
fi
+rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
fail_panic "Could not create build directory: $BUILD_DIR"
diff --git a/build/tools/build-gcc.sh b/build/tools/build-gcc.sh
index d74af095a..9fbd37c87 100755
--- a/build/tools/build-gcc.sh
+++ b/build/tools/build-gcc.sh
@@ -349,6 +349,12 @@ esac
# Enable linker option -eh-frame-hdr also for static executable
EXTRA_CONFIG_FLAGS=$EXTRA_CONFIG_FLAGS" --enable-eh-frame-hdr-for-static"
+MAY_FAIL_DUE_TO_RACE_CONDITION=
+if [ "$MINGW" = "yes" -o "$DARWIN" = "yes" ]; then
+ MAY_FAIL_DUE_TO_RACE_CONDITION=yes
+fi
+
+# hack to use different set of sources
CONFIGURE_GCC_VERSION=$GCC_VERSION
case "$TOOLCHAIN" in
*4.9l)
@@ -358,6 +364,11 @@ case "$TOOLCHAIN" in
CONFIGURE_GCC_VERSION=4.8l
;;
esac
+MAY_FAIL_DUE_TO_RACE_CONDITION=
+if [ "$MINGW" = "yes" -o "$DARWIN" = "yes" ]; then
+ MAY_FAIL_DUE_TO_RACE_CONDITION=yes
+fi
+
cd $BUILD_OUT && run \
$BUILD_SRCDIR/configure --target=$ABI_CONFIGURE_TARGET \
--enable-initfini-array \
@@ -395,12 +406,13 @@ while [ -n "1" ]; do
if [ $? = 0 ] ; then
break
else
- if [ "$MINGW" = "yes" -o "$DARWIN" = "yes" ] ; then
+ if [ "$MAY_FAIL_DUE_TO_RACE_CONDITION" = "yes" ] ; then
# Unfortunately, there is a bug in the GCC build scripts that prevent
# parallel mingw/darwin canadian cross builds to work properly on some
# multi-core machines (but not all, sounds like a race condition). Detect
# this and restart in less parallelism, until -j1 also fail
NUM_JOBS=$((NUM_JOBS/2))
+ export NUM_JOBS
if [ $NUM_JOBS -lt 1 ] ; then
echo "Error while building mingw/darwin toolchain. See $TMPLOG"
exit 1
@@ -420,7 +432,9 @@ dump "Install : $TOOLCHAIN toolchain binaries."
cd $BUILD_OUT && run make install
if [ $? != 0 ] ; then
# try "-j1", eg. for aarch64-linux-android-4.8 with libatomic may fail to install due to race condition (missing prefix/lib/../lib64/./libiberty.an)
- run make install -j1
+ NUM_JOBS=1
+ export NUM_JOBS
+ run make install -j$NUM_JOBS
if [ $? != 0 ] ; then
echo "Error while installing toolchain. See $TMPLOG"
exit 1
@@ -434,28 +448,28 @@ unwind_library_for_abi ()
case $ABI in
armeabi)
- BASE_DIR="$BUILD_OUT/gcc-$GCC_VERSION/$ABI_CONFIGURE_TARGET/libgcc/"
+ BASE_DIR="$BUILD_OUT/gcc-$CONFIGURE_GCC_VERSION/$ABI_CONFIGURE_TARGET/libgcc/"
OBJS="unwind-arm.o \
libunwind.o \
pr-support.o \
unwind-c.o"
;;
armeabi-v7a)
- BASE_DIR="$BUILD_OUT/gcc-$GCC_VERSION/$ABI_CONFIGURE_TARGET/armv7-a/libgcc/"
+ BASE_DIR="$BUILD_OUT/gcc-$CONFIGURE_GCC_VERSION/$ABI_CONFIGURE_TARGET/armv7-a/libgcc/"
OBJS="unwind-arm.o \
libunwind.o \
pr-support.o \
unwind-c.o"
;;
armeabi-v7a-hard)
- BASE_DIR="$BUILD_OUT/gcc-$GCC_VERSION/$ABI_CONFIGURE_TARGET/armv7-a/hard/libgcc/"
+ BASE_DIR="$BUILD_OUT/gcc-$CONFIGURE_GCC_VERSION/$ABI_CONFIGURE_TARGET/armv7-a/hard/libgcc/"
OBJS="unwind-arm.o \
libunwind.o \
pr-support.o \
unwind-c.o"
;;
x86|mips)
- BASE_DIR="$BUILD_OUT/gcc-$GCC_VERSION/$ABI_CONFIGURE_TARGET/libgcc/"
+ BASE_DIR="$BUILD_OUT/gcc-$CONFIGURE_GCC_VERSION/$ABI_CONFIGURE_TARGET/libgcc/"
if [ "$GCC_VERSION" = "4.6" -o "$GCC_VERSION" = "4.4.3" ]; then
OBJS="unwind-c.o \
unwind-dw2-fde-glibc.o \
@@ -467,7 +481,7 @@ unwind_library_for_abi ()
fi
;;
arm64-v8a|x86_64|mips64)
- BASE_DIR="$BUILD_OUT/gcc-$GCC_VERSION/$ABI_CONFIGURE_TARGET/libgcc/"
+ BASE_DIR="$BUILD_OUT/gcc-$CONFIGURE_GCC_VERSION/$ABI_CONFIGURE_TARGET/libgcc/"
OBJS="unwind-c.o \
unwind-dw2-fde-dip.o \
unwind-dw2.o"
diff --git a/build/tools/build-gnu-libstdc++.sh b/build/tools/build-gnu-libstdc++.sh
index ba4ba2ec1..09c6cb203 100755
--- a/build/tools/build-gnu-libstdc++.sh
+++ b/build/tools/build-gnu-libstdc++.sh
@@ -95,6 +95,9 @@ if [ -z "$OPTION_BUILD_DIR" ]; then
else
BUILD_DIR=$OPTION_BUILD_DIR
fi
+
+HOST_TAG_LIST="$HOST_TAG $HOST_TAG32"
+
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
fail_panic "Could not create build directory: $BUILD_DIR"
@@ -124,9 +127,9 @@ build_gnustl_for_abi ()
mkdir -p $DSTDIR
ARCH=$(convert_abi_to_arch $ABI)
- for TAG in $HOST_TAG $HOST_TAG32; do
+ for TAG in $HOST_TAG_LIST; do
BINPREFIX=$NDK_DIR/$(get_toolchain_binprefix_for_arch $ARCH $GCC_VERSION $TAG)
- if [ -f ${BINPREFIX}-gcc ]; then
+ if [ -f ${BINPREFIX}gcc ]; then
break;
fi
done
@@ -316,16 +319,20 @@ copy_gnustl_libs ()
copy_file_list "$SDIR/$LDIR" "$DDIR/libs/$ABI" libsupc++.a libgnustl_shared.so
# Note: we need to rename libgnustl_shared.a to libgnustl_static.a
cp "$SDIR/$LDIR/libgnustl_shared.a" "$DDIR/libs/$ABI/libgnustl_static.a"
- if [ $ARCH = "x86_64" ]; then
+ if [ "$ARCH" = "x86_64" -o "$ARCH" = "mips64" ]; then
# for multilib we copy full set. Keep native libs in $ABI dir for compatibility.
# TODO: remove it in $ABI top directory
copy_file_list "$SDIR/lib" "$DDIR/libs/$ABI/lib" libsupc++.a libgnustl_shared.so
- copy_file_list "$SDIR/libx32" "$DDIR/libs/$ABI/libx32" libsupc++.a libgnustl_shared.so
copy_file_list "$SDIR/lib64" "$DDIR/libs/$ABI/lib64" libsupc++.a libgnustl_shared.so
- # Note: we need to rename libgnustl_shared.a to libgnustl_static.a
cp "$SDIR/lib/libgnustl_shared.a" "$DDIR/libs/$ABI/lib/libgnustl_static.a"
- cp "$SDIR/libx32/libgnustl_shared.a" "$DDIR/libs/$ABI/libx32/libgnustl_static.a"
cp "$SDIR/lib64/libgnustl_shared.a" "$DDIR/libs/$ABI/lib64/libgnustl_static.a"
+ if [ "$ARCH" = "x86_64" ]; then
+ copy_file_list "$SDIR/libx32" "$DDIR/libs/$ABI/libx32" libsupc++.a libgnustl_shared.so
+ cp "$SDIR/libx32/libgnustl_shared.a" "$DDIR/libs/$ABI/libx32/libgnustl_static.a"
+ else
+ copy_file_list "$SDIR/lib32" "$DDIR/libs/$ABI/lib32" libsupc++.a libgnustl_shared.so
+ cp "$SDIR/lib32/libgnustl_shared.a" "$DDIR/libs/$ABI/lib32/libgnustl_static.a"
+ fi
fi
if [ -d "$SDIR/thumb" ] ; then
copy_file_list "$SDIR/thumb/$LDIR" "$DDIR/libs/$ABI/thumb" libsupc++.a libgnustl_shared.so
@@ -337,15 +344,11 @@ 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)
- BUILD_IT=
for VERSION in $GCC_VERSION_LIST; do
# Only build for this GCC version if it on or after DEFAULT_GCC_VERSION
- if [ -z "$BUILD_IT" -a "$VERSION" = "$DEFAULT_GCC_VERSION" ]; then
- BUILD_IT=yes
- fi
- if [ -z "$BUILD_IT" ]; then
+ if [ "${VERSION%%l}" \< "$DEFAULT_GCC_VERSION" ]; then
continue
- fi
+ fi
build_gnustl_for_abi $ABI "$BUILD_DIR" static $VERSION
build_gnustl_for_abi $ABI "$BUILD_DIR" shared $VERSION
@@ -403,7 +406,7 @@ if [ -n "$PACKAGE_DIR" ] ; then
PACKAGE="${PACKAGE}.tar.bz2"
dump "Packaging: $PACKAGE"
pack_archive "$PACKAGE" "$NDK_DIR" "$FILES"
- fail_panic "Could not package $ABI STLport binaries!"
+ fail_panic "Could not package $ABI GNU libstdc++ binaries!"
done
done
fi
diff --git a/build/tools/build-mingw64-toolchain.sh b/build/tools/build-mingw64-toolchain.sh
index 13ebf378a..12c0eeb4c 100755
--- a/build/tools/build-mingw64-toolchain.sh
+++ b/build/tools/build-mingw64-toolchain.sh
@@ -590,11 +590,11 @@ build_mingw_headers ()
run make
log "$PKGNAME: Installing" &&
run make install -j$JOBS &&
- run cd $INSTALL_DIR &&
+ run cd $INSTALL_DIR &&
run ln -s $TARGET_TAG mingw &&
- run cd $INSTALL_DIR/mingw &&
+ run cd $INSTALL_DIR/mingw &&
run ln -s lib lib$TARGET_BITS
- fail_panic "Can't configure mingw-64-headers"
+ fail_panic "Can't install mingw-64-headers"
) || exit 1
touch $STAMP_DIR/$PKGNAME
fi
diff --git a/build/tools/builder-funcs.sh b/build/tools/builder-funcs.sh
index 81aebeae2..b774b87b8 100644
--- a/build/tools/builder-funcs.sh
+++ b/build/tools/builder-funcs.sh
@@ -506,12 +506,16 @@ builder_begin_android ()
LLVM_VERSION=$DEFAULT_LLVM_VERSION
fi
if [ -n "$LLVM_VERSION" ]; then
- # override GCC_VERSION to pick $DEFAULT_LLVM_GCC_VERSION instead
- GCC_VERSION=$DEFAULT_LLVM_GCC_VERSION
+ # override GCC_VERSION to pick $DEFAULT_LLVM_GCC??_VERSION instead
+ if [ "$ABI" != "${ABI%%64*}" ]; then
+ GCC_VERSION=$DEFAULT_LLVM_GCC64_VERSION
+ else
+ GCC_VERSION=$DEFAULT_LLVM_GCC32_VERSION
+ fi
fi
for TAG in $HOST_TAG $HOST_TAG32; do
BINPREFIX=$NDK_DIR/$(get_toolchain_binprefix_for_arch $ARCH $GCC_VERSION $TAG)
- if [ -f ${BINPREFIX}-gcc ]; then
+ if [ -f ${BINPREFIX}gcc ]; then
break;
fi
done
diff --git a/build/tools/dev-defaults.sh b/build/tools/dev-defaults.sh
index e3eb62747..ad175d27e 100644
--- a/build/tools/dev-defaults.sh
+++ b/build/tools/dev-defaults.sh
@@ -46,14 +46,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"
-# The default GCC version for 32-bit NDK is the first item in $DEFAULT_GCC_VERSION_LIST
-DEFAULT_GCC32_VERSION=$(echo "$DEFAULT_GCC_VERSION_LIST" | tr ' ' '\n' | head -n 1)
-
-# The default GCC version for 64-bit is the last item in $DEFAULT_GCC_VERSION_LIST
-DEFAULT_GCC64_VERSION=$(echo "$DEFAULT_GCC_VERSION_LIST" | tr ' ' '\n' | tail -n 1)
-
-# The default GCC version for "clang -gcc-toolchain", is the second item in $DEFAULT_GCC_VERSION_LIST
-DEFAULT_LLVM_GCC_VERSION=$(echo "$DEFAULT_GCC_VERSION_LIST" | tr ' ' '\n' | head -n 2 | tail -n 1)
+DEFAULT_GCC32_VERSION=4.6
+DEFAULT_GCC64_VERSION=4.9
+DEFAULT_LLVM_GCC32_VERSION=4.8
+DEFAULT_LLVM_GCC64_VERSION=4.9
DEFAULT_BINUTILS_VERSION=2.21
DEFAULT_GDB_VERSION=7.3.x
@@ -66,7 +62,7 @@ DEFAULT_PPL_VERSION=1.0
DEFAULT_PYTHON_VERSION=2.7.5
DEFAULT_PERL_VERSION=5.16.2
-RECENT_BINUTILS_VERSION=2.23
+RECENT_BINUTILS_VERSION=2.24
# Default platform to build target binaries against.
DEFAULT_PLATFORM=android-9
diff --git a/build/tools/make-standalone-toolchain.sh b/build/tools/make-standalone-toolchain.sh
index af203a51b..de7ec9fd8 100755
--- a/build/tools/make-standalone-toolchain.sh
+++ b/build/tools/make-standalone-toolchain.sh
@@ -242,7 +242,7 @@ if [ ! -d "$SRC_SYSROOT_INC" -o ! -d "$SRC_SYSROOT_LIB" ] ; then
fi
# Check that we have any prebuilts GCC toolchain here
-if [ ! -d "$TOOLCHAIN_PATH/prebuilt" ] ; then
+if [ ! -d "$TOOLCHAIN_PATH/prebuilt" ]; then
echo "Toolchain is missing prebuilt files: $TOOLCHAIN_NAME"
echo "You must point to a valid NDK release package!"
exit 1
@@ -626,29 +626,37 @@ copy_stl_libs_for_abi () {
case $ABI in
armeabi)
- copy_stl_libs armeabi "bits" "bits"
- copy_stl_libs armeabi "" "" "/thumb"
+ copy_stl_libs armeabi "bits" "bits"
+ copy_stl_libs armeabi "thumb/bits" "bits" "/thumb"
;;
armeabi-v7a)
- copy_stl_libs armeabi-v7a "armv7-a/bits" "bits" "armv7-a"
- copy_stl_libs armeabi-v7a "" "" "armv7-a/thumb"
+ copy_stl_libs armeabi-v7a "armv7-a/bits" "bits" "armv7-a"
+ copy_stl_libs armeabi-v7a "armv7-a/thumb/bits" "bits" "armv7-a/thumb"
;;
armeabi-v7a-hard)
- copy_stl_libs armeabi-v7a-hard "" "" "armv7-a/hard" "."
- copy_stl_libs armeabi-v7a-hard "" "" "armv7-a/thumb/hard" "thumb"
+ copy_stl_libs armeabi-v7a-hard "" "" "armv7-a/hard" "."
+ copy_stl_libs armeabi-v7a-hard "" "" "armv7-a/thumb/hard" "thumb"
;;
x86_64)
- copy_stl_libs x86_64 "32/bits" "32/bits" "" "lib"
- copy_stl_libs x86_64 "bits" "bits" "../lib64" "lib64"
- copy_stl_libs x86_64 "x32/bits" "x32/bits" "../libx32" "libx32"
+ if [ "$STL" = "gnustl" ]; then
+ copy_stl_libs x86_64 "32/bits" "32/bits" "" "lib"
+ copy_stl_libs x86_64 "bits" "bits" "../lib64" "lib64"
+ copy_stl_libs x86_64 "x32/bits" "x32/bits" "../libx32" "libx32"
+ else
+ copy_stl_libs "$ABI"
+ fi
;;
mips64)
- copy_stl_libs x86_64 "32/bits" "32/bits" "" "lib"
- copy_stl_libs x86_64 "bits" "bits" "../lib64" "lib64"
- copy_stl_libs x86_64 "n32/bits" "n32/bits" "../lib32" "lib32"
+ if [ "$STL" = "gnustl" ]; then
+ copy_stl_libs mips64 "32/bits" "32/bits" "" "lib"
+ copy_stl_libs mips64 "bits" "bits" "../lib64" "lib64"
+ copy_stl_libs mips64 "n32/bits" "n32/bits" "../lib32" "lib32"
+ else
+ copy_stl_libs "$ABI"
+ fi
;;
*)
- copy_stl_libs "$ABI" "bits" "bits"
+ copy_stl_libs "$ABI" "bits" "bits"
;;
esac
}
diff --git a/tests/build/b14825026-aarch64-FP_LO_REGS/BROKEN_BUILD b/tests/build/b14825026-aarch64-FP_LO_REGS/BROKEN_BUILD
index d139378b8..602913169 100644
--- a/tests/build/b14825026-aarch64-FP_LO_REGS/BROKEN_BUILD
+++ b/tests/build/b14825026-aarch64-FP_LO_REGS/BROKEN_BUILD
@@ -1 +1 @@
-4.6 clang3.3 clang3.4 \ No newline at end of file
+4.6 4.8 clang3.3 clang3.4 \ No newline at end of file
diff --git a/toolchains/aarch64-linux-android-4.9/setup.mk b/toolchains/aarch64-linux-android-4.9/setup.mk
index 90089c3cb..0c5f29a99 100644
--- a/toolchains/aarch64-linux-android-4.9/setup.mk
+++ b/toolchains/aarch64-linux-android-4.9/setup.mk
@@ -58,5 +58,5 @@ TARGET_arm64_debug_CFLAGS := $(TARGET_arm64_release_CFLAGS) \
TARGET-process-src-files-tags = \
$(eval __debug_sources := $(call get-src-files-with-tag,debug)) \
$(eval __release_sources := $(call get-src-files-without-tag,debug)) \
-$(call set-src-files-target-cflags, $(__debug_sources), $(TARGET_x86_64_debug_CFLAGS)) \
-$(call set-src-files-target-cflags, $(__release_sources),$(TARGET_x86_64_release_CFLAGS)) \
+$(call set-src-files-target-cflags, $(__debug_sources), $(TARGET_arm64_debug_CFLAGS)) \
+$(call set-src-files-target-cflags, $(__release_sources),$(TARGET_arm64_release_CFLAGS)) \
diff --git a/toolchains/mips64el-linux-android-clang3.4/setup.mk b/toolchains/mips64el-linux-android-clang3.4/setup.mk
index f0d3e6cf1..4e4b07be0 100644
--- a/toolchains/mips64el-linux-android-clang3.4/setup.mk
+++ b/toolchains/mips64el-linux-android-clang3.4/setup.mk
@@ -34,7 +34,7 @@ LLVM_TOOLCHAIN_PREBUILT_ROOT := $(call host-prebuilt-tag,$(LLVM_TOOLCHAIN_ROOT))
LLVM_TOOLCHAIN_PREFIX := $(LLVM_TOOLCHAIN_PREBUILT_ROOT)/bin/
TOOLCHAIN_VERSION := 4.9
-TOOLCHAIN_NAME := mip64sel-linux-android-$(TOOLCHAIN_VERSION)
+TOOLCHAIN_NAME := mips64el-linux-android-$(TOOLCHAIN_VERSION)
TOOLCHAIN_ROOT := $(NDK_ROOT)/toolchains/$(TOOLCHAIN_NAME)
TOOLCHAIN_PREBUILT_ROOT := $(call host-prebuilt-tag,$(TOOLCHAIN_ROOT))
TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/mips64el-linux-android-