diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2013-03-20 11:19:34 -0700 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2013-04-02 21:00:22 +0800 |
commit | 555abe49d62a14f3c741e44d9122d7e6430fdc8a (patch) | |
tree | 491a69fef7a800271c05e8f59974585d20bd4b1c | |
parent | 2eee643a081829f5b05d401cb96202740427bc4a (diff) | |
download | ndk-555abe49d62a14f3c741e44d9122d7e6430fdc8a.tar.gz |
Download/Build/Use GCC 4.8
Change-Id: I230ea06de58b9765eb684f31f28444faf93e4508
16 files changed, 394 insertions, 10 deletions
diff --git a/build/core/setup-toolchain.mk b/build/core/setup-toolchain.mk index 77f02dcfe..1bf442650 100644 --- a/build/core/setup-toolchain.mk +++ b/build/core/setup-toolchain.mk @@ -33,8 +33,8 @@ ifndef NDK_TOOLCHAIN $(foreach _ver,$(LLVM_VERSION_LIST), \ $(eval TARGET_TOOLCHAIN_LIST := \ $(filter-out %-clang$(_ver),$(TARGET_TOOLCHAIN_LIST)))) - # Filter out 4.7 which is considered experimental at this moment - TARGET_TOOLCHAIN_LIST := $(filter-out %4.7,$(TARGET_TOOLCHAIN_LIST)) + # Filter out 4.7 and 4.8 which is considered experimental at this moment + TARGET_TOOLCHAIN_LIST := $(filter-out %4.7 %4.8,$(TARGET_TOOLCHAIN_LIST)) ifndef TARGET_TOOLCHAIN_LIST $(call __ndk_info,There is no toolchain that supports the $(TARGET_ARCH_ABI) ABI.) diff --git a/build/tools/build-gcc.sh b/build/tools/build-gcc.sh index fda733668..abbde5d18 100755 --- a/build/tools/build-gcc.sh +++ b/build/tools/build-gcc.sh @@ -263,18 +263,21 @@ fi # Enable OpenMP EXTRA_CONFIG_FLAGS=$EXTRA_CONFIG_FLAGS" --enable-libgomp" +# Disable libsanitizer (which depends on libstdc++ built separately) for now +EXTRA_CONFIG_FLAGS=$EXTRA_CONFIG_FLAGS" --disable-libsanitizer" + # Enable Gold as default case "$TOOLCHAIN" in # Note that only ARM and X86 are supported - x86-4.6|arm-linux-androideabi-4.6|x86-4.7|arm-linux-androideabi-4.7) + x86-4.6|arm-linux-androideabi-4.6|x86-4.7|arm-linux-androideabi-4.7|x86-4.8|arm-linux-androideabi-4.8) EXTRA_CONFIG_FLAGS=$EXTRA_CONFIG_FLAGS" --enable-gold=default" ;; esac # Enable Graphite case "$TOOLCHAIN" in - # Only for 4.6 and 4.7 for now - *-4.6|*-4.7) + # Only for 4.6+ for now + *-4.6|*-4.7|*-4.8) EXTRA_CONFIG_FLAGS=$EXTRA_CONFIG_FLAGS" --enable-graphite=yes --with-cloog-version=$CLOOG_VERSION --with-ppl-version=$PPL_VERSION" ;; esac diff --git a/build/tools/build-host-gcc.sh b/build/tools/build-host-gcc.sh index c91fa7158..1555bfa2f 100755 --- a/build/tools/build-host-gcc.sh +++ b/build/tools/build-host-gcc.sh @@ -1412,7 +1412,7 @@ build_host_gcc_core () # In fact, enable-plugins is broken all Canadian Cross GCC. # see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50229 case "$GCC_VERSION" in - 4.4.3|4.6|4.7) + 4.4.3|4.6|4.7|4.8) ARGS=$ARGS" --disable-plugins --disable-plugin" ;; # Doesn't even work on 4.8 diff --git a/build/tools/dev-defaults.sh b/build/tools/dev-defaults.sh index d569ab40c..28434658b 100644 --- a/build/tools/dev-defaults.sh +++ b/build/tools/dev-defaults.sh @@ -29,7 +29,7 @@ LIBPORTABLE_SUBDIR=sources/android/libportable TOOLCHAIN_GIT_DATE=now # The space-separated list of all GCC versions we support in this NDK -DEFAULT_GCC_VERSION_LIST="4.6 4.7 4.4.3" +DEFAULT_GCC_VERSION_LIST="4.6 4.7 4.8 4.4.3" # The default GCC version for this NDK, i.e. the first item in # $DEFAULT_GCC_VERSION_LIST @@ -198,6 +198,7 @@ get_default_binutils_version_for_gcc () case $1 in arm-*-4.4.3|x86-4.4.3|x86-*-4.4.3) echo "2.19";; arm-*-4.7|x86-4.7|x86-*-4.7|mipsel-*-4.7) echo "2.22";; + arm-*-4.8|x86-4.8|x86-*-4.8|mipsel-*-4.8) echo "2.22";; # change to 2.23+ later *) echo "$DEFAULT_BINUTILS_VERSION";; esac } diff --git a/build/tools/download-toolchain-sources.sh b/build/tools/download-toolchain-sources.sh index 68d7e497d..f99768119 100755 --- a/build/tools/download-toolchain-sources.sh +++ b/build/tools/download-toolchain-sources.sh @@ -212,7 +212,7 @@ toolchain_checkout "" $BRANCH cloog . toolchain_checkout "" $BRANCH ppl . toolchain_checkout "" $BRANCH expat . toolchain_checkout "" $BRANCH binutils binutils-2.19 binutils-2.21 binutils-2.22 -toolchain_checkout "" $BRANCH gcc gcc-4.4.3 gcc-4.6 gcc-4.7 +toolchain_checkout "" $BRANCH gcc gcc-4.4.3 gcc-4.6 gcc-4.7 gcc-4.8 toolchain_checkout "" $BRANCH gdb gdb-6.6 gdb-7.3.x toolchain_checkout "" $BRANCH python Python-2.7.3 toolchain_checkout "" $BRANCH perl perl-5.16.2 diff --git a/build/tools/toolchain-patches/gcc/0001-gcc-4.6-and-4.7-Disable-sincos-optimization.patch b/build/tools/toolchain-patches/gcc/0001-Disable-sincos-optimization.patch index b2c70a8a6..88c3d0ec6 100644 --- a/build/tools/toolchain-patches/gcc/0001-gcc-4.6-and-4.7-Disable-sincos-optimization.patch +++ b/build/tools/toolchain-patches/gcc/0001-Disable-sincos-optimization.patch @@ -50,6 +50,19 @@ index fb459e6..bf5993f 100644 /* Whether we have Bionic libc runtime */ #undef TARGET_HAS_BIONIC +diff --git a/gcc-4.8/gcc/config/linux.h b/gcc-4.8/gcc/config/linux.h +index 2be1079..b83dc08 100644 +--- a/gcc-4.8/gcc/config/linux.h ++++ b/gcc-4.8/gcc/config/linux.h +@@ -102,7 +102,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + + /* Whether we have sincos that follows the GNU extension. */ + #undef TARGET_HAS_SINCOS +-#define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC) ++#define TARGET_HAS_SINCOS (OPTION_GLIBC) + + /* Whether we have Bionic libc runtime */ + #undef TARGET_HAS_BIONIC -- 1.7.6.rc0 diff --git a/build/tools/toolchain-patches/gcc/0001-Enable-C-exceptions-and-RTTI-by-default.patch b/build/tools/toolchain-patches/gcc/0001-Enable-C-exceptions-and-RTTI-by-default.patch index 99afc8ca0..56204dae5 100644 --- a/build/tools/toolchain-patches/gcc/0001-Enable-C-exceptions-and-RTTI-by-default.patch +++ b/build/tools/toolchain-patches/gcc/0001-Enable-C-exceptions-and-RTTI-by-default.patch @@ -55,6 +55,20 @@ index 94c5274..7256082 100644 #define ANDROID_ASM_SPEC \ "--noexecstack" +diff --git a/gcc-4.8/gcc/config/linux-android.h b/gcc-4.8/gcc/config/linux-android.h +index 2c87c84..47a3e7c 100644 +--- a/gcc-4.8/gcc/config/linux-android.h ++++ b/gcc-4.8/gcc/config/linux-android.h +@@ -45,8 +45,8 @@ + "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}" + + #define ANDROID_CC1PLUS_SPEC \ +- "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ +- "%{!frtti:%{!fno-rtti: -fno-rtti}}" ++ "%{!fexceptions:%{!fno-exceptions: -fexceptions}} " \ ++ "%{!frtti:%{!fno-rtti: -frtti}}" + + #define ANDROID_LIB_SPEC \ + "%{!static: -ldl}" -- 1.7.6.rc0 - diff --git a/build/tools/toolchain-patches/gcc/0002-gcc-prevent-crash-on-Eclair-and-older-platforms.patch b/build/tools/toolchain-patches/gcc/0002-gcc-prevent-crash-on-Eclair-and-older-platforms.patch index 49649e038..d4b4c9a0c 100644 --- a/build/tools/toolchain-patches/gcc/0002-gcc-prevent-crash-on-Eclair-and-older-platforms.patch +++ b/build/tools/toolchain-patches/gcc/0002-gcc-prevent-crash-on-Eclair-and-older-platforms.patch @@ -97,6 +97,30 @@ index a935e92..08281b7 100644 #include <pthread.h> #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ +diff --git a/gcc-4.8/libgcc/gthr-posix.h b/gcc-4.8/libgcc/gthr-posix.h +index f0d8cd7..1d03af0 100644 +--- a/gcc-4.8/libgcc/gthr-posix.h ++++ b/gcc-4.8/libgcc/gthr-posix.h +@@ -32,6 +32,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + #define __GTHREADS 1 + #define __GTHREADS_CXX0X 1 + ++/* The following should normally be in a different header file, ++ * but I couldn't find the right location. The point of the macro ++ * definition below is to prevent libsupc++ and libstdc++ to reference ++ * weak symbols in their static C++ constructors. Such code crashes ++ * when a shared object linked statically to these libraries is ++ * loaded on Android 2.1 (Eclair) and older platform releases, due ++ * to a dynamic linker bug. ++ */ ++#ifdef __ANDROID__ ++#undef GTHREAD_USE_WEAK ++#define GTHREAD_USE_WEAK 0 ++#endif ++ + #include <pthread.h> + + #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ -- 1.7.6.rc0 diff --git a/build/tools/toolchain-patches/gcc/0006-Disable-libstdc-versioning.patch b/build/tools/toolchain-patches/gcc/0006-Disable-libstdc-versioning.patch index e85ee7deb..46ca5809a 100644 --- a/build/tools/toolchain-patches/gcc/0006-Disable-libstdc-versioning.patch +++ b/build/tools/toolchain-patches/gcc/0006-Disable-libstdc-versioning.patch @@ -83,6 +83,29 @@ index b10d853..3669b06 100644 mostlyclean-compile: -rm -f *.$(OBJEXT) +diff --git a/gcc-4.8/libstdc++-v3/src/Makefile.in b/gcc-4.8/libstdc++-v3/src/Makefile.in +index 69001b4..e875539 100644 +--- a/gcc-4.8/libstdc++-v3/src/Makefile.in ++++ b/gcc-4.8/libstdc++-v3/src/Makefile.in +@@ -336,7 +336,7 @@ AM_CPPFLAGS = $(GLIBCXX_INCLUDES) + SUBDIRS = c++98 c++11 + + # Cross compiler support. +-toolexeclib_LTLIBRARIES = libstdc++.la ++toolexeclib_LTLIBRARIES = libgnustl_shared.la + @GLIBCXX_LDBL_COMPAT_FALSE@ldbl_compat_sources = + @GLIBCXX_LDBL_COMPAT_TRUE@ldbl_compat_sources = compatibility-ldbl.cc + parallel_compat_sources = \ +@@ -543,6 +543,9 @@ clean-toolexeclibLTLIBRARIES: + libstdc++.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES) + $(libstdc___la_LINK) -rpath $(toolexeclibdir) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS) + ++libgnustl_shared.la: $(libstdc___la_OBJECTS) $(libstdc___la_DEPENDENCIES) ++ $(libstdc___la_LINK) -rpath $(toolexeclibdir) $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) $(LIBS) ++ + mostlyclean-compile: + -rm -f *.$(OBJEXT) + -- 1.7.6.rc0 diff --git a/tests/build/warn-noabi/build.sh b/tests/build/warn-noabi/build.sh index d9ba32657..b6e6d581a 100755 --- a/tests/build/warn-noabi/build.sh +++ b/tests/build/warn-noabi/build.sh @@ -11,7 +11,7 @@ VERSION=4.6 if [ -n "$NDK_TOOLCHAIN_VERSION" ]; then case "$NDK_TOOLCHAIN_VERSION" in - 4.4.3|4.6|4.7*) + 4.4.3|4.6|4.7*|4.8*) VERSION=$NDK_TOOLCHAIN_VERSION ;; clang*) diff --git a/toolchains/arm-linux-androideabi-4.8/config.mk b/toolchains/arm-linux-androideabi-4.8/config.mk new file mode 100644 index 000000000..c46dace27 --- /dev/null +++ b/toolchains/arm-linux-androideabi-4.8/config.mk @@ -0,0 +1,20 @@ +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# config file for the arm gcc-4.8 toolchain for the Android NDK +# the real meat is in the setup.mk file adjacent to this one +# +TOOLCHAIN_ARCH := arm +TOOLCHAIN_ABIS := armeabi armeabi-v7a diff --git a/toolchains/arm-linux-androideabi-4.8/setup.mk b/toolchains/arm-linux-androideabi-4.8/setup.mk new file mode 100644 index 000000000..a5758c8b8 --- /dev/null +++ b/toolchains/arm-linux-androideabi-4.8/setup.mk @@ -0,0 +1,109 @@ +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# this file is used to prepare the NDK to build with the arm gcc-4.8 +# toolchain any number of source files +# +# its purpose is to define (or re-define) templates used to build +# various sources into target object files, libraries or executables. +# +# Note that this file may end up being parsed several times in future +# revisions of the NDK. +# + +TARGET_CFLAGS := \ + -fpic \ + -ffunction-sections \ + -funwind-tables \ + -fstack-protector \ + -no-canonical-prefixes + +TARGET_LDFLAGS := -no-canonical-prefixes + +TARGET_C_INCLUDES := \ + $(SYSROOT_INC)/usr/include + +ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) + TARGET_CFLAGS += -march=armv7-a \ + -mfloat-abi=softfp \ + -mfpu=vfpv3-d16 + + TARGET_LDFLAGS += -march=armv7-a \ + -Wl,--fix-cortex-a8 +else + TARGET_CFLAGS += -march=armv5te \ + -mtune=xscale \ + -msoft-float +endif + +TARGET_CFLAGS.neon := -mfpu=neon + +TARGET_arm_release_CFLAGS := -O2 \ + -g \ + -DNDEBUG \ + -fomit-frame-pointer \ + -fstrict-aliasing \ + -funswitch-loops \ + -finline-limit=300 + +TARGET_thumb_release_CFLAGS := -mthumb \ + -Os \ + -g \ + -DNDEBUG \ + -fomit-frame-pointer \ + -fno-strict-aliasing \ + -finline-limit=64 + +# When building for debug, compile everything as arm. +TARGET_arm_debug_CFLAGS := $(TARGET_arm_release_CFLAGS) \ + -O0 \ + -UNDEBUG \ + -fno-omit-frame-pointer \ + -fno-strict-aliasing + +TARGET_thumb_debug_CFLAGS := $(TARGET_thumb_release_CFLAGS) \ + -O0 \ + -UNDEBUG \ + -marm \ + -fno-omit-frame-pointer + +# This function will be called to determine the target CFLAGS used to build +# a C or Assembler source file, based on its tags. +# +TARGET-process-src-files-tags = \ +$(eval __arm_sources := $(call get-src-files-with-tag,arm)) \ +$(eval __thumb_sources := $(call get-src-files-without-tag,arm)) \ +$(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, \ + $(call set_intersection,$(__arm_sources),$(__debug_sources)), \ + $(TARGET_arm_debug_CFLAGS)) \ +$(call set-src-files-target-cflags,\ + $(call set_intersection,$(__arm_sources),$(__release_sources)),\ + $(TARGET_arm_release_CFLAGS)) \ +$(call set-src-files-target-cflags,\ + $(call set_intersection,$(__arm_sources),$(__debug_sources)),\ + $(TARGET_arm_debug_CFLAGS)) \ +$(call set-src-files-target-cflags,\ + $(call set_intersection,$(__thumb_sources),$(__release_sources)),\ + $(TARGET_thumb_release_CFLAGS)) \ +$(call set-src-files-target-cflags,\ + $(call set_intersection,$(__thumb_sources),$(__debug_sources)),\ + $(TARGET_thumb_debug_CFLAGS)) \ +$(call add-src-files-target-cflags,\ + $(call get-src-files-with-tag,neon),\ + $(TARGET_CFLAGS.neon)) \ +$(call set-src-files-text,$(__arm_sources),arm$(space)$(space)) \ +$(call set-src-files-text,$(__thumb_sources),thumb) diff --git a/toolchains/mipsel-linux-android-4.8/config.mk b/toolchains/mipsel-linux-android-4.8/config.mk new file mode 100644 index 000000000..bf6c38007 --- /dev/null +++ b/toolchains/mipsel-linux-android-4.8/config.mk @@ -0,0 +1,20 @@ +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# config file for the mipsel gcc-4.8 toolchain for the Android NDK +# the real meat is in the setup.mk file adjacent to this one +# +TOOLCHAIN_ARCH := mips +TOOLCHAIN_ABIS := mips diff --git a/toolchains/mipsel-linux-android-4.8/setup.mk b/toolchains/mipsel-linux-android-4.8/setup.mk new file mode 100644 index 000000000..6dee7ec1f --- /dev/null +++ b/toolchains/mipsel-linux-android-4.8/setup.mk @@ -0,0 +1,68 @@ +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# this file is used to prepare the NDK to build with the mipsel gcc-4.8 +# toolchain any number of source files +# +# its purpose is to define (or re-define) templates used to build +# various sources into target object files, libraries or executables. +# +# Note that this file may end up being parsed several times in future +# revisions of the NDK. +# + +TARGET_CFLAGS := \ + -fpic \ + -fno-strict-aliasing \ + -finline-functions \ + -ffunction-sections \ + -funwind-tables \ + -fmessage-length=0 \ + -fno-inline-functions-called-once \ + -fgcse-after-reload \ + -frerun-cse-after-loop \ + -frename-registers \ + -no-canonical-prefixes + +TARGET_LDFLAGS := -no-canonical-prefixes + +TARGET_C_INCLUDES := \ + $(SYSROOT_INC)/usr/include + +TARGET_mips_release_CFLAGS := -O2 \ + -g \ + -DNDEBUG \ + -fomit-frame-pointer \ + -funswitch-loops \ + -finline-limit=300 + +TARGET_mips_debug_CFLAGS := -O0 \ + -g \ + -fno-omit-frame-pointer + + +# This function will be called to determine the target CFLAGS used to build +# a C or Assembler source file, based on its tags. +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_mips_debug_CFLAGS)) \ +$(call set-src-files-target-cflags,\ + $(__release_sources),\ + $(TARGET_mips_release_CFLAGS)) \ +$(call set-src-files-text,$(__debug_sources),mips$(space)) \ +$(call set-src-files-text,$(__release_sources),mips$(space)) \ diff --git a/toolchains/x86-4.8/config.mk b/toolchains/x86-4.8/config.mk new file mode 100644 index 000000000..ff8ef0dc3 --- /dev/null +++ b/toolchains/x86-4.8/config.mk @@ -0,0 +1,20 @@ +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# config file for the x86 gcc-4.8 toolchain for the Android NDK +# the real meat is in the setup.mk file adjacent to this one +# +TOOLCHAIN_ARCH := x86 +TOOLCHAIN_ABIS := x86 diff --git a/toolchains/x86-4.8/setup.mk b/toolchains/x86-4.8/setup.mk new file mode 100644 index 000000000..3bc4aeae2 --- /dev/null +++ b/toolchains/x86-4.8/setup.mk @@ -0,0 +1,69 @@ +# Copyright (C) 2009 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# this file is used to prepare the NDK to build with the x86 gcc-4.8 +# toolchain any number of source files +# +# its purpose is to define (or re-define) templates used to build +# various sources into target object files, libraries or executables. +# +# Note that this file may end up being parsed several times in future +# revisions of the NDK. +# + +TOOLCHAIN_NAME := x86-4.8 +TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/i686-linux-android- + +TARGET_CFLAGS := \ + -ffunction-sections \ + -funwind-tables \ + -no-canonical-prefixes + +TARGET_C_INCLUDES := \ + $(SYSROOT_INC)/usr/include + +# Add and LDFLAGS for the target here +TARGET_LDFLAGS := -no-canonical-prefixes + +TARGET_CFLAGS += -fstack-protector + +TARGET_x86_release_CFLAGS := -O2 \ + -g \ + -DNDEBUG \ + -fomit-frame-pointer \ + -fstrict-aliasing \ + -funswitch-loops \ + -finline-limit=300 + +# When building for debug, compile everything as x86. +TARGET_x86_debug_CFLAGS := $(TARGET_x86_release_CFLAGS) \ + -O0 \ + -UNDEBUG \ + -fno-omit-frame-pointer \ + -fno-strict-aliasing + +# This function will be called to determine the target CFLAGS used to build +# a C or Assembler source file, based on its tags. +# +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_debug_CFLAGS)) \ +$(call set-src-files-target-cflags, $(__release_sources),$(TARGET_x86_release_CFLAGS)) \ +$(call set-src-files-text,$(LOCAL_SRC_FILES),x86$(space)$(space)) \ + +# The ABI-specific sub-directory that the SDK tools recognize for +# this toolchain's generated binaries +TARGET_ABI_SUBDIR := x86 |