Skip to content

Commit

Permalink
4.8 GCC, Strict Aliasing=3, -O3 CFLAG, Opt Flags!!
Browse files Browse the repository at this point in the history
For those of you who are building cm-11.0 with the neofy script,
none of this stuff applies to you as the script did it all for you ;)

To everyone else:
With this commit, you will be heavily modifying your build environment. What this
will do, is allow you the freedom of using any custom toolchain of your choice,
provided you follow two simple rules:

RULE SlimRoms#1: Both the androideabi and armeabi toolchain folders of your choice HAVE to
be named like the following:

for androideabi, the folder has to be prefixed with: arm-linux-androideabi-
and for arm-eabi, the folder has to be prefixed with: arm-eabi-

ex:

If you want to use GCC-4.8 as your toolchain of choice, both the androideabi and
armeabi folders have to look like this:

arm-linux-androideabi-4.8
arm-eabi-4.8

if you want them to be different, say, 4.8 for the arm-eabi and 4.9 for androideabi,
then they should look like this:

arm-eabi-4.8
arm-linux-androideabi-4.9

Take note, that if usining linaro, you will have to clone in the toolchain twice as
this method requires two different folders (the way it should be IMO). You would need
to rename one of the clones to arme-abi- and the other to arm-linux-androideabi-.

SECTION 2
RULE SlimRoms#2: The default configuration I've set is to build with GCC 4.8 for androideabi and 4.8 for
armeabi by default (in core/combo/TARGET_linux-arm.mk lines 50-51) unless you specify an alternate
target chain on those two lines! So if you want to use a different chain, you'll
need to change the build numbers on those two lines. for Example:

Say you wanted to use a 4.7 chain instead for armeabi and 4.8 for androideabi.. You would
change lines 50 and 51 to the following:

TARGET_GCC_VERSION_ARM := 4.7
TARGET_GCC_VERSION_AND := 4.8

Notice at the end of each line one is for ARM and one is for AND which hints at armeabi
and androideabi and the only thing you're changing is the number.

You also need to make sure rule number 1 is observed if you do this.. Can't build with
an alternate chain if one is not present ;) Personally, I've found the following two
toolchains to be the best without any drawback to rom (sans ART) courtesy of sparksco:

https://github.com/SaberMod/android_prebuilts_gcc_linux-x86_arm_sabermod-arm-eabi-4.8
https://github.com/SaberMod/android_prebuilts_gcc_linux-x86_arm_sabermod-arm-linux-androideabi-4.8

MAKE SURE YOU PULL BOTH FROM THE sm-kk-mr1 BRANCH IF YOU DECIDE TO USE THESE CHAINS!

This build commit also changes your global compiler ARM flags to -O3. -O3 is an option
that enables all -O1 and -O2 flag options as well as some heavy -O3 flag options that build
for optimized performance!

This commit also adds a few optimization flags that I've pre-selected for added performance.

This commit also builds the entire rom using a Strict Aliasing rule set at the highest level
of =3 and set to error on every strict aliasing issue. Make sure that you have all the
proper strict aliasing commits needed! If you can't find them, they will be
available to you on my github account at https://github.com/IAmTheOneTheyCallNeo

to make your search for all those needed easier, you can find all of them in the following script:
https://github.com/vigor/android/blob/cm-11.0/neofy.sh

Contact me if you have any issues and I will help you when and if I can.

-Neo
  • Loading branch information
David Eddlemon authored and TheBr0ken committed Feb 10, 2014
1 parent 73a2564 commit aa4920a
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 77 deletions.
101 changes: 58 additions & 43 deletions core/combo/TARGET_linux-arm.mk
Expand Up @@ -34,12 +34,23 @@ ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
TARGET_ARCH_VARIANT := armv5te
endif

ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
TARGET_GCC_VERSION := 4.7
ifeq ($(strip $(TARGET_GCC_VERSION_AND)),)
TARGET_GCC_VERSION_AND := 4.7
else
TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
TARGET_GCC_VERSION_AND := $(TARGET_GCC_VERSION_AND)
endif

ifeq ($(strip $(TARGET_GCC_VERSION_ARM)),)
TARGET_GCC_VERSION_ARM := 4.7
else
TARGET_GCC_VERSION_ARM := $(TARGET_GCC_VERSION_ARM)
endif

# Specify Target Custom GCC Chains to use:
TARGET_GCC_VERSION_AND := 4.8
TARGET_GCC_VERSION_ARM := 4.7


TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
$(error Unknown ARM architecture version: $(TARGET_ARCH_VARIANT))
Expand All @@ -49,7 +60,7 @@ include $(TARGET_ARCH_SPECIFIC_MAKEFILE)

# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)
TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION_AND)
TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/arm-linux-androideabi-
endif

Expand All @@ -68,42 +79,35 @@ endif

TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined

ifeq ($(TARGET_USE_O3),true)
TARGET_arm_CFLAGS := -O3 \
-fomit-frame-pointer \
-fstrict-aliasing \
-funswitch-loops
else
TARGET_arm_CFLAGS := -Os \
-fomit-frame-pointer \
-fstrict-aliasing \
-fno-zero-initialized-in-bss \
-fstrict-aliasing \
-funswitch-loops \
-fno-tree-vectorize \
-Wno-unused-parameter \
-Wno-unused-value \
-Wno-unused-function
endif
-fno-inline-functions \
-Wstrict-aliasing=3 \
-Werror=strict-aliasing \
-fgcse-after-reload \
-fno-ipa-cp-clone \
-fno-vect-cost-model \
-Wno-error=unused-parameter \
-Wno-error=unused-but-set-variable

# Modules can choose to compile some source as thumb.
ifeq ($(TARGET_USE_O3),true)
TARGET_thumb_CFLAGS := -mthumb \
-O3 \
-fomit-frame-pointer \
-fno-strict-aliasing \
-Wstrict-aliasing=2 \
-Werror=strict-aliasing \
-fno-tree-vectorize \
-funsafe-math-optimizations \
-Wno-unused-parameter \
-Wno-unused-value \
-Wno-unused-function
else
TARGET_thumb_CFLAGS := -mthumb \
-Os \
-fomit-frame-pointer \
-fno-strict-aliasing
endif
TARGET_thumb_CFLAGS := -mthumb \
-Os \
-fomit-frame-pointer \
-fstrict-aliasing \
-fno-tree-vectorize \
-fno-inline-functions \
-fno-unswitch-loops \
-Wstrict-aliasing=3 \
-Werror=strict-aliasing \
-fgcse-after-reload \
-fno-ipa-cp-clone \
-fno-vect-cost-model \
-Wno-error=unused-parameter \
-Wno-error=unused-but-set-variable

# Set FORCE_ARM_DEBUGGING to "true" in your buildspec.mk
# or in your environment to force a full arm build, even for
Expand All @@ -115,8 +119,8 @@ endif
# with -mlong-calls. When built at -O0, those libraries are
# too big for a thumb "BL <label>" to go from one end to the other.
ifeq ($(FORCE_ARM_DEBUGGING),true)
TARGET_arm_CFLAGS += -fno-omit-frame-pointer -fno-strict-aliasing
TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer
TARGET_arm_CFLAGS += -fno-omit-frame-pointer -fstrict-aliasing
TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer -fstrict-aliasing
endif

android_config_h := $(call select-android-config-h,linux-arm)
Expand All @@ -134,23 +138,28 @@ TARGET_GLOBAL_CFLAGS += \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
-fstrict-aliasing \
-fstack-protector \
-Wa,--noexecstack \
-Werror=format-security \
-D_FORTIFY_SOURCE=2 \
-fno-short-enums \
$(arch_variant_cflags) \
-Wno-error=unused-parameter \
-Wno-error=unused-but-set-variable \
-include $(android_config_h) \
-I $(dir $(android_config_h))

# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
# We cannot turn it off blindly since the option is not available
# in gcc-4.4.x. We also want to disable sincos optimization globally
# by turning off the builtin sin function.
ifneq ($(filter 4.6 4.6.% 4.7 4.7.%, $(TARGET_GCC_VERSION)),)
TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fno-builtin-sin \
ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8 4.8.% 4.9 4.9.%, $(TARGET_GCC_VERSION_AND)),)
ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8 4.8.% 4.9 4.9.%, $(TARGET_GCC_VERSION_ARM)),)
TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fstrict-aliasing -fno-builtin-sin \
-fno-strict-volatile-bitfields
endif
endif

# This is to avoid the dreaded warning compiler message:
# note: the mangling of 'va_list' has changed in GCC 4.4
Expand All @@ -160,7 +169,7 @@ endif
# in their exported C++ functions). Also, GCC 4.5 has already
# removed the warning from the compiler.
#
TARGET_GLOBAL_CFLAGS += -Wno-psabi
TARGET_GLOBAL_CFLAGS += -Wno-psabi -fstrict-aliasing

TARGET_GLOBAL_LDFLAGS += \
-Wl,-z,noexecstack \
Expand All @@ -171,18 +180,24 @@ TARGET_GLOBAL_LDFLAGS += \
-Wl,--icf=safe \
$(arch_variant_ldflags)

TARGET_GLOBAL_CFLAGS += -mthumb-interwork
TARGET_GLOBAL_CFLAGS += -mthumb-interwork -fstrict-aliasing

TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden -fstrict-aliasing

# More flags/options can be added here
TARGET_RELEASE_CFLAGS := \
-DNDEBUG \
-g \
-Wstrict-aliasing=2 \
-Wstrict-aliasing=3 \
-Werror=strict-aliasing \
-fstrict-aliasing \
-fgcse-after-reload \
-frerun-cse-after-loop \
-frename-registers
-frename-registers \
-fno-ipa-cp-clone \
-fno-vect-cost-model \
-Wno-error=unused-parameter \
-Wno-error=unused-but-set-variable

libc_root := bionic/libc
libm_root := bionic/libm
Expand Down
6 changes: 4 additions & 2 deletions core/combo/TARGET_linux-mips.mk
Expand Up @@ -49,7 +49,7 @@ include $(TARGET_ARCH_SPECIFIC_MAKEFILE)

# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$(TARGET_GCC_VERSION)
TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$(TARGET_GCC_VERSION_AND)
TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/mipsel-linux-android-
endif

Expand Down Expand Up @@ -99,10 +99,12 @@ TARGET_GLOBAL_CFLAGS += \
# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
# We cannot turn it off blindly since the option is not available
# in gcc-4.4.x.
ifneq ($(filter 4.6 4.6.% 4.7 4.7.%, $(TARGET_GCC_VERSION)),)
ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8 4.8.% 4.9 4.9.%, $(TARGET_GCC_VERSION_AND)),)
ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8 4.8.% 4.9 4.9.%, $(TARGET_GCC_VERSION_ARM)),)
TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable \
-fno-strict-volatile-bitfields
endif
endif

# This is to avoid the dreaded warning compiler message:
# note: the mangling of 'va_list' has changed in GCC 4.4
Expand Down
2 changes: 1 addition & 1 deletion core/combo/TARGET_linux-x86.mk
Expand Up @@ -42,7 +42,7 @@ include $(TARGET_ARCH_SPECIFIC_MAKEFILE)

# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-linux-android-$(TARGET_GCC_VERSION)
TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-linux-android-$(TARGET_GCC_VERSION_AND)
TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/i686-linux-android-
endif

Expand Down
15 changes: 8 additions & 7 deletions core/combo/select.mk
Expand Up @@ -46,16 +46,17 @@ $(combo_target)HAVE_STRLCPY := 0
$(combo_target)HAVE_STRLCAT := 0
$(combo_target)HAVE_KERNEL_MODULES := 0

$(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
ifeq ($(TARGET_USE_03),true)
$(combo_target)RELEASE_CFLAGS := -O3 -g -fno-strict-aliasing
$(combo_target)GLOBAL_LDFLAGS := -Wl,-O3
else
$(combo_target)RELEASE_CFLAGS := -Os -g -fno-strict-aliasing
$(combo_target)GLOBAL_CFLAGS := -fstrict-aliasing -Wstrict-aliasing=3 -Werror=strict-aliasing -fno-exceptions -Wno-multichar -Wno-error=unused-parameter -Wno-error=unused-but-set-variable
$(combo_target)RELEASE_CFLAGS := -O3 -g -fstrict-aliasing -Wstrict-aliasing=3 -Werror=strict-aliasing -fno-tree-vectorize -fno-inline-functions -fno-unswitch-loops -fgcse-after-reload -fno-ipa-cp-clone -fno-vect-cost-model -Wno-error=unused-parameter -Wno-error=unused-but-set-variable
$(combo_target)GLOBAL_LDFLAGS :=
endif
$(combo_target)GLOBAL_ARFLAGS := crsP

# Turn off strict-aliasing if we're building an AOSP variant without the
# patchset...
ifeq ($(DEBUG_NO_STRICT_ALIASING),yes)
$(combo_target)RELEASE_CFLAGS += -fno-strict-aliasing -Wno-error=strict-aliasing
endif

$(combo_target)EXECUTABLE_SUFFIX :=
$(combo_target)SHLIB_SUFFIX := .so
$(combo_target)JNILIB_SUFFIX := $($(combo_target)SHLIB_SUFFIX)
Expand Down
20 changes: 9 additions & 11 deletions core/dumpvar.mk
Expand Up @@ -11,27 +11,27 @@ endif

# Add the ARM toolchain bin dir if it actually exists
ifeq ($(TARGET_ARCH),arm)
ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin),)
ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION_AND)/bin),)
# this should be copied to HOST_OUT_EXECUTABLES instead
ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin
ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION_AND)/bin
endif
ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-eabi-$(TARGET_GCC_VERSION)/bin),)
ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-eabi-$(TARGET_GCC_VERSION_ARM)/bin),)
# this should be copied to HOST_OUT_EXECUTABLES instead
ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-eabi-$(TARGET_GCC_VERSION)/bin
ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-eabi-$(TARGET_GCC_VERSION_ARM)/bin
endif
else ifeq ($(TARGET_ARCH),x86)

# Add the x86 toolchain bin dir if it actually exists
ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-linux-android-$(TARGET_GCC_VERSION)/bin),)
ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-linux-android-$(TARGET_GCC_VERSION_AND)/bin),)
# this should be copied to HOST_OUT_EXECUTABLES instead
ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-linux-android-$(TARGET_GCC_VERSION)/bin
ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-linux-android-$(TARGET_GCC_VERSION_AND)/bin
endif
endif

# Add the mips toolchain bin dir if it actually exists
ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$(TARGET_GCC_VERSION)/bin),)
ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$(TARGET_GCC_VERSION_AND)/bin),)
# this should be copied to HOST_OUT_EXECUTABLES instead
ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$(TARGET_GCC_VERSION)/bin
ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$(TARGET_GCC_VERSION_AND)/bin
endif

ANDROID_BUILD_PATHS := $(ABP)
Expand Down Expand Up @@ -100,9 +100,7 @@ $(info TARGET_BUILD_APPS=$(TARGET_BUILD_APPS))
$(info TARGET_ARCH=$(TARGET_ARCH))
$(info TARGET_ARCH_VARIANT=$(TARGET_ARCH_VARIANT))
$(info TARGET_CPU_VARIANT=$(TARGET_CPU_VARIANT))
$(info TARGET_GCC_VERSION=$(TARGET_GCC_VERSION))
$(info TARGET_GCC_VERSION_EXP=$(TARGET_GCC_VERSION_EXP))
$(info TARGET_USE_O3=$(TARGET_USE_O3))
$(info TARGET_GCC_VERSION=$(TARGET_GCC_VERSION_AND))
$(info HOST_ARCH=$(HOST_ARCH))
$(info HOST_OS=$(HOST_OS))
$(info HOST_OS_EXTRA=$(HOST_OS_EXTRA))
Expand Down
43 changes: 43 additions & 0 deletions core/linaro_compilerchecks.mk
@@ -0,0 +1,43 @@
# The try-run, cc-version, cc-ifversion and cc-option macros are inspired
# by the Linux kernel build system's versions of the macros with the same
# name.
#
# The implementations here are rewritten to avoid license clashes, and
# they're a lot simpler than their kernel counterparts because, at least
# for now, we don't need to support all the compilers the kernel supports,
# and we don't need to be aware of all the details the kernel checks for.
#
# Usage examples:
# echo "GCC version $(cc-version)" [e.g. 47 for 4.7]
# echo $(call cc-ifversion, -lt, 47, GCC older than 4.7)
# # Use -mcpu=cortex-a9 if supported, otherwise -mcpu=cortex-a8
# echo $(call cc-option, -mcpu=cortex-a9, -mcpu=cortex-a8)
# # Use -mcpu=cortex-a9 if supported, otherwise -mcpu=cortex-a8
# # if supported, otherwise nothing
# echo $(call cc-option, -mcpu=cortex-a9, $(call cc-option, -mcpu=cortex-a8))
#

# We have to do our own version of setting TARGET_CC because we can be
# included before TARGET_CC is set, but we may want to use cc-option and
# friends in the same file that sets TARGET_CC...

ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
LINARO_COMPILERCHECK_CC := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION_AND)/bin/arm-linux-androideabi-gcc$(HOST_EXECUTABLE_SUFFIX)
else
LINARO_COMPILERCHECK_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
endif

try-run = $(shell set -e; \
if ($(1)) >/dev/null 2>&1; then \
echo "$(2)"; \
else \
echo "$(3)"; \
fi)

cc-version = $(shell echo '__GNUC__ __GNUC_MINOR__' \
|$(LINARO_COMPILERCHECK_CC) -E -xc - |tail -n1 |sed -e 's, ,,g')

cc-ifversion = $(shell [ $(call cc-version) $(1) $(2) ] && echo $(3))

cc-option = $(call try-run, echo -e "$(1)" \
|$(LINARO_COMPILERCHECK_CC) $(1) -c -xc /dev/null -o /dev/null,$(1),$(2))
4 changes: 2 additions & 2 deletions core/tasks/kernel.mk
Expand Up @@ -153,9 +153,9 @@ ifeq ($(TARGET_ARCH),arm)
endif
ifneq ($(TARGET_KERNEL_CUSTOM_TOOLCHAIN),)
ifeq ($(HOST_OS),darwin)
ARM_CROSS_COMPILE:=CROSS_COMPILE="$(ccache) $(ANDROID_BUILD_TOP)/prebuilt/darwin-x86/toolchain/$(TARGET_KERNEL_CUSTOM_TOOLCHAIN)"
ARM_CROSS_COMPILE:=CROSS_COMPILE="$(ccache) $(ANDROID_BUILD_TOP)/prebuilts/gcc/darwin-x86/arm/$(TARGET_KERNEL_CUSTOM_TOOLCHAIN)"
else
ARM_CROSS_COMPILE:=CROSS_COMPILE="$(ccache) $(ANDROID_BUILD_TOP)/prebuilt/linux-x86/toolchain/$(TARGET_KERNEL_CUSTOM_TOOLCHAIN)"
ARM_CROSS_COMPILE:=CROSS_COMPILE="$(ccache) $(ANDROID_BUILD_TOP)/prebuilts/gcc/darwin-x86/arm/$(TARGET_KERNEL_CUSTOM_TOOLCHAIN)"
endif
else
ARM_CROSS_COMPILE:=CROSS_COMPILE="$(ccache) $(ARM_EABI_TOOLCHAIN)/arm-eabi-"
Expand Down
16 changes: 9 additions & 7 deletions envsetup.sh
Expand Up @@ -132,18 +132,20 @@ function setpaths()
gccprebuiltdir=$(get_abs_build_var ANDROID_GCC_PREBUILTS)

# defined in core/config.mk
targetgccversion=$(get_build_var TARGET_GCC_VERSION)
export TARGET_GCC_VERSION=$targetgccversion

targetgccversionarm=$(get_build_var TARGET_GCC_VERSION_ARM)
export TARGET_GCC_VERSION_ARM=$targetgccversionarm
targetgccversionand=$(get_build_var TARGET_GCC_VERSION_AND)
export TARGET_GCC_VERSION_AND=$targetgccversionand

# The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
export ANDROID_EABI_TOOLCHAIN=
local ARCH=$(get_build_var TARGET_ARCH)
case $ARCH in
x86) toolchaindir=x86/i686-linux-android-$targetgccversion/bin
x86) toolchaindir=x86/i686-linux-android-$targetgccversionand/bin
;;
arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin
arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversionand/bin
;;
mips) toolchaindir=mips/mipsel-linux-android-$targetgccversion/bin
mips) toolchaindir=mips/mipsel-linux-android-$targetgccversionand/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
Expand All @@ -157,7 +159,7 @@ function setpaths()
unset ARM_EABI_TOOLCHAIN ARM_EABI_TOOLCHAIN_PATH
case $ARCH in
arm)
toolchaindir=arm/arm-eabi-$targetgccversion/bin
toolchaindir=arm/arm-eabi-$targetgccversionarm/bin
if [ -d "$gccprebuiltdir/$toolchaindir" ]; then
export ARM_EABI_TOOLCHAIN="$gccprebuiltdir/$toolchaindir"
ARM_EABI_TOOLCHAIN_PATH=":$gccprebuiltdir/$toolchaindir"
Expand Down
6 changes: 2 additions & 4 deletions tools/adbs
Expand Up @@ -140,15 +140,13 @@ def SetupToolsPath():
uname = "darwin-x86"
elif uname == "Linux":
uname = "linux-x86"
gcc_version = os.environ["TARGET_GCC_VERSION"]
prefix = "./prebuilts/gcc/" + uname + "/arm/arm-linux-androideabi-" + \
gcc_version + "/bin/"
prefix = "./prebuilts/gcc/" + uname + "/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION_AND)/bin/"
addr2line_cmd = prefix + "arm-linux-androideabi-addr2line"

if (not os.path.exists(addr2line_cmd)):
try:
prefix = os.environ['ANDROID_BUILD_TOP'] + "/prebuilts/gcc/" + \
uname + "/arm/arm-linux-androideabi-" + gcc_version + "/bin/"
uname + "/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION_AND)/bin/"
except:
prefix = "";

Expand Down

0 comments on commit aa4920a

Please sign in to comment.