Commit 6b767135 authored by fdegans's avatar fdegans Committed by Commit bot

Change Android toolchain to GCC 4.9.

Tune global Android ARM cflags for performance.
Update cflags in gn to keep up with gyp.

BUG=407545
CQ_TRYBOTS=tryserver.chromium.linux:android_aosp,android_clang_dbg,android_dbg

Review URL: https://codereview.chromium.org/375483003

Cr-Commit-Position: refs/heads/master@{#293913}
parent 45ed3fdf
......@@ -473,14 +473,11 @@ get_ndk_toolchain_prebuilt () {
local SUBPATH="$3"
local NAME="$(get_arch_toolchain_prefix $ARCH)"
local FILE TARGET
FILE=$NDK_DIR/toolchains/$NAME-4.8/prebuilt/$SUBPATH
FILE=$NDK_DIR/toolchains/$NAME-4.9/prebuilt/$SUBPATH
if [ ! -f "$FILE" ]; then
FILE=$NDK_DIR/toolchains/$NAME-4.9/prebuilt/$SUBPATH
FILE=$NDK_DIR/toolchains/$NAME-4.8/prebuilt/$SUBPATH
if [ ! -f "$FILE" ]; then
FILE=$NDK_DIR/toolchains/$NAME-4.6/prebuilt/$SUBPATH
if [ ! -f "$FILE" ]; then
FILE=
fi
FILE=
fi
fi
echo "$FILE"
......
......@@ -1536,17 +1536,20 @@
# it takes effect here.
['os_posix==1 and OS!="mac" and OS!="ios" and clang==0 and asan==0 and lsan==0 and tsan==0 and msan==0 and ubsan_vptr==0', {
'conditions': [
['OS=="android"', {
# We directly set the gcc versions since we know what we use.
'gcc_version%': 48,
}, {
'gcc_version%': '<!pymod_do_main(compiler_version target compiler)',
['OS=="android" and android_webview_build==0', {
'host_gcc_version%': '<!pymod_do_main(compiler_version host compiler)',
# We directly set the gcc version since we know what we use.
'gcc_version%': 49,
}],
['android_webview_build==1', {
['OS=="android" and android_webview_build==1', {
# Android WebView uses a hermetic clang toolchain for host builds.
'host_gcc_version%': 0,
}, { # android_webview_build!=1
# Android WebView uses the GCC toolchain from the Android build.
'gcc_version%': 48,
}],
['OS!="android"', {
'host_gcc_version%': '<!pymod_do_main(compiler_version host compiler)',
'gcc_version%': '<!pymod_do_main(compiler_version target compiler)',
}],
],
}, {
......@@ -1677,7 +1680,7 @@
'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-x86/gdbserver/gdbserver',
'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-x86',
'android_ndk_lib_dir%': 'usr/lib',
'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.8/prebuilt/<(host_os)-<(android_host_arch)/bin',
'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
}],
['target_arch == "x64"', {
'android_app_abi%': 'x86_64',
......@@ -1697,7 +1700,7 @@
'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-arm/gdbserver/gdbserver',
'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-arm',
'android_ndk_lib_dir%': 'usr/lib',
'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-androideabi-4.8/prebuilt/<(host_os)-<(android_host_arch)/bin',
'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-androideabi-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
}],
['target_arch == "arm64"', {
'android_app_abi%': 'arm64-v8a',
......@@ -1711,7 +1714,7 @@
'android_gdbserver%': '<(android_ndk_root)/prebuilt/android-mips/gdbserver/gdbserver',
'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-14/arch-mips',
'android_ndk_lib_dir%': 'usr/lib',
'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux-android-4.8/prebuilt/<(host_os)-<(android_host_arch)/bin',
'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
}],
['target_arch == "mips64el"', {
'android_app_abi%': 'mips64',
......@@ -3802,14 +3805,14 @@
}],
['arm_thumb==1', {
'cflags': [
'-mthumb',
]
'-mthumb',
],
}],
['OS=="android"', {
# Most of the following flags are derived from what Android
# uses by default when building for arm, reference for which
# can be found in the following file in the Android NDK:
# toolchains/arm-linux-androideabi-4.8/setup.mk
# toolchains/arm-linux-androideabi-4.9/setup.mk
'cflags': [
# The tree-sra optimization (scalar replacement for
# aggregates enabling subsequent optimizations) leads to
......@@ -3817,14 +3820,8 @@
# compiler (r5-r7). This can be verified using
# webkit_unit_tests' WTF.Checked_int8_t test.
'-fno-tree-sra',
# The following 6 options are disabled to save on
# binary size in gcc 4.8.
# TODO(fdegans) Reevaluate when we upgrade GCC.
'-fno-partial-inlining',
'-fno-early-inlining',
'-fno-tree-copy-prop',
'-fno-tree-loop-optimize',
'-fno-move-loop-invariants',
# The following option is disabled to improve binary
# size and performance in gcc 4.9.
'-fno-caller-saves',
'-Wno-psabi',
],
......@@ -3861,11 +3858,6 @@
'-mthumb-interwork',
'-finline-limit=64',
'-fno-tree-sra',
'-fno-partial-inlining',
'-fno-early-inlining',
'-fno-tree-copy-prop',
'-fno-tree-loop-optimize',
'-fno-move-loop-invariants',
'-fno-caller-saves',
'-Wno-psabi',
],
......@@ -5614,7 +5606,7 @@
},
}],
# Don't warn about the "typedef 'foo' locally defined but not used"
# for gcc 4.8.
# for gcc 4.8 and higher.
# TODO: remove this flag once all builds work. See crbug.com/227506
['gcc_version>=48 and clang==0', {
'target_defaults': {
......
......@@ -78,7 +78,7 @@ if (is_android) {
# Toolchain root directory for each build. The actual binaries are inside
# a "bin" directory inside of these.
_android_toolchain_version = "4.8"
_android_toolchain_version = "4.9"
x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
mips_android_toolchain_root = "$android_ndk_root/toolchains/mipsel-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
......
......@@ -160,6 +160,20 @@ config("compiler") {
cflags += [ "-mthumb-interwork" ]
}
}
if (!is_clang) {
# Clang doesn't support these flags.
cflags += [
# The tree-sra optimization (scalar replacement for
# aggregates enabling subsequent optimizations) leads to
# invalid code generation when using the Android NDK's
# compiler (r5-r7). This can be verified using
# webkit_unit_tests' WTF.Checked_int8_t test.
"-fno-tree-sra",
# The following option is disabled to improve binary
# size and performance in gcc 4.9.
"-fno-caller-saves",
]
}
}
}
......@@ -256,15 +270,6 @@ config("compiler") {
# Clang doesn't support these flags.
cflags += [
"-finline-limit=64",
# The following 6 options are disabled to save on
# binary size in gcc 4.8.
# TODO(fdegans) Reevaluate when we upgrade GCC.
"-fno-partial-inlining",
"-fno-early-inlining",
"-fno-tree-copy-prop",
"-fno-tree-loop-optimize",
"-fno-move-loop-invariants",
"-fno-caller-saves",
]
}
if (is_android_webview_build) {
......
......@@ -5,7 +5,12 @@
if (is_clang) {
gcc_version = 0
} else if (is_android) {
gcc_version = 48
import("//build/config/android/config.gni")
if (is_android_webview_build) {
gcc_version = 48
} else {
gcc_version = 49
}
} else {
gcc_version = exec_script("../../compiler_version.py", [ "host", "compiler" ], "value")
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment