Skip to content

Commit

Permalink
Introduce arm_version to allow building for armv5, v6 or v7.
Browse files Browse the repository at this point in the history
This patch deprecates armv7 and adds arm_version that takes an integer
value representing the ARM architecture level.

In addition arm_arch, arm_tune, arm_fpu, arm_float_abi and arm_thumb can
be set to fine tune CPU related compiler flags, defaults are provided for
ARM versions 5 to 7.

BUG=234135

Review URL: https://chromiumcodereview.appspot.com/14065005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196702 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
ohrn@opera.com committed Apr 26, 2013
1 parent 3b8aa28 commit 7d67634
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 63 deletions.
2 changes: 0 additions & 2 deletions build/android/envsetup_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ common_vars_defines() {
# and V8 mksnapshot.
case "${TARGET_ARCH}" in
"arm")
DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16"
DEFINES+=" arm_neon_optional=1" # Enable dynamic NEON support.
DEFINES+=" ${ORDER_DEFINES}"
DEFINES+=" target_arch=arm"
;;
Expand Down
122 changes: 79 additions & 43 deletions build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
# build (0).
'inside_chromium_build%': 1,

# Set ARM architecture version.
'arm_version%': 7,

'conditions': [
# Set default value of toolkit_views based on OS.
['OS=="win" or chromeos==1 or use_aura==1', {
Expand Down Expand Up @@ -190,6 +193,7 @@
'enable_message_center%': '<(enable_message_center)',
'use_default_render_theme%': '<(use_default_render_theme)',
'buildtype%': '<(buildtype)',
'arm_version%': '<(arm_version)',

# Override branding to select the desired branding flavor.
'branding%': 'Chromium',
Expand All @@ -211,12 +215,13 @@
# Python version.
'python_ver%': '2.6',

# Set ARM-v7 compilation flags
'armv7%': 0,

# Set Neon compilation flags (only meaningful if armv7==1).
# Set NEON compilation flags.
'arm_neon%': 1,

# Detect NEON support at run-time.
'arm_neon_optional%': 0,

# The system root for cross-compiles. Default: none.
'sysroot%': '',

Expand Down Expand Up @@ -424,6 +429,13 @@
'os_bsd%': 0,
}],

# Set armv7 for backward compatibility.
['arm_version==7', {
'armv7': 1,
}, {
'armv7': 0,
}],

# NSS usage.
['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==0', {
'use_nss%': 1,
Expand Down Expand Up @@ -489,6 +501,8 @@
'enable_themes%': 0,
'proprietary_codecs%': 1,
'remoting%': 0,
'arm_neon%': 0,
'arm_neon_optional%': 1,
}],

# Enable autofill dialog for Android and Views-enabled platforms for now.
Expand Down Expand Up @@ -610,7 +624,6 @@

['OS=="linux" and target_arch=="arm" and chromeos==0', {
# Set some defaults for arm/linux chrome builds
'armv7%': 1,
'linux_breakpad%': 0,
'linux_use_tcmalloc%': 0,
# sysroot needs to be an absolute path otherwise it generates
Expand Down Expand Up @@ -721,8 +734,10 @@
'fastbuild%': '<(fastbuild)',
'dcheck_always_on%': '<(dcheck_always_on)',
'python_ver%': '<(python_ver)',
'arm_version%': '<(arm_version)',
'armv7%': '<(armv7)',
'arm_neon%': '<(arm_neon)',
'arm_neon_optional%': '<(arm_neon_optional)',
'sysroot%': '<(sysroot)',
'system_libdir%': '<(system_libdir)',
'component%': '<(component)',
Expand Down Expand Up @@ -941,16 +956,6 @@
# Set to 1 to link against gsettings APIs instead of using dlopen().
'linux_link_gsettings%': 0,

# Set Thumb compilation flags.
'arm_thumb%': 0,

# Set ARM fpu compilation flags (only meaningful if armv7==1 and
# arm_neon==0).
'arm_fpu%': 'vfpv3',

# Set ARM float abi compilation flag.
'arm_float_abi%': 'softfp',

# Enable use of OpenMAX DL FFT routines.
'use_openmax_dl_fft%': '<(use_openmax_dl_fft)',

Expand Down Expand Up @@ -1188,7 +1193,7 @@
}],
['target_arch=="arm"', {
'conditions': [
['armv7==0', {
['arm_version<7', {
'android_app_abi%': 'armeabi',
}, {
'android_app_abi%': 'armeabi-v7a',
Expand Down Expand Up @@ -1607,6 +1612,45 @@
['branding=="Chrome" and (OS=="win" or OS=="mac" or chromeos==1)', {
'enable_rlz%': 1,
}],

# Set default compiler flags depending on ARM version.
['arm_version==5 and android_webview_build==0', {
# Flags suitable for Android emulator
'arm_arch%': 'armv5te',
'arm_tune%': 'xscale',
'arm_fpu%': '',
'arm_float_abi%': 'soft',
'arm_thumb%': 0,
}],
['arm_version==6 and android_webview_build==0', {
'arm_arch%': 'armv6',
'arm_tune%': '',
'arm_fpu%': '',
'arm_float_abi%': 'soft',
'arm_thumb%': 0,
}],
['arm_version==7 and android_webview_build==0', {
'arm_arch%': 'armv7-a',
'arm_tune%': 'cortex-a8',
'conditions': [
['arm_neon==1', {
'arm_fpu%': 'neon',
}, {
'arm_fpu%': 'vfpv3-d16',
}],
],
'arm_float_abi%': 'softfp',
'arm_thumb%': 1,
}],

['android_webview_build==1', {
# The WebView build gets its cpu-specific flags from the Android build system.
'arm_arch%': '',
'arm_tune%': '',
'arm_fpu%': '',
'arm_float_abi%': '',
'arm_thumb%': 0,
}],
],

# List of default apps to install in new profiles. The first list contains
Expand Down Expand Up @@ -2822,25 +2866,31 @@
'-Wno-abi',
],
'conditions': [
['arm_thumb==1 and android_webview_build==0', {
['arm_arch!=""', {
'cflags': [
'-mthumb',
]
'-march=<(arm_arch)',
],
}],
['armv7==1 and android_webview_build==0', {
['arm_tune!=""', {
'cflags': [
'-march=armv7-a',
'-mtune=cortex-a8',
'-mfloat-abi=<(arm_float_abi)',
'-mtune=<(arm_tune)',
],
'conditions': [
['arm_neon==1', {
'cflags': [ '-mfpu=neon', ],
}, {
'cflags': [ '-mfpu=<(arm_fpu)', ],
}],
}],
['arm_fpu!=""', {
'cflags': [
'-mfpu=<(arm_fpu)',
],
}],
['arm_float_abi!=""', {
'cflags': [
'-mfloat-abi=<(arm_float_abi)',
],
}],
['arm_thumb==1', {
'cflags': [
'-mthumb',
]
}],
['OS=="android"', {
# Most of the following flags are derived from what Android
# uses by default when building for arm, reference for which
Expand All @@ -2866,23 +2916,9 @@
'-fuse-ld=gold',
],
'conditions': [
['arm_thumb==1 and android_webview_build==0', {
['arm_thumb==1', {
'cflags': [ '-mthumb-interwork' ],
}],
['armv7==0 and android_webview_build==0', {
# Flags suitable for Android emulator
'cflags': [
'-march=armv5te',
'-mtune=xscale',
'-msoft-float',
],
'defines': [
'__ARM_ARCH_5__',
'__ARM_ARCH_5T__',
'__ARM_ARCH_5E__',
'__ARM_ARCH_5TE__',
],
}],
['profiling==1', {
'cflags': [
'-marm', # Probably reduntant, but recommend by "perf" docs.
Expand Down
22 changes: 6 additions & 16 deletions skia/skia.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,7 @@
[ 'OS != "win"', {
'sources/': [ ['exclude', '_win\\.(cc|cpp)$'] ],
}],
[ 'armv7 == 1', {
'defines': [
'__ARM_ARCH__=7',
],
}],
[ 'armv7 == 1 and arm_neon == 1', {
[ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 1', {
'defines': [
'__ARM_HAVE_NEON',
],
Expand Down Expand Up @@ -674,12 +669,7 @@
}],
[ 'target_arch == "arm"', {
'conditions': [
[ 'armv7 == 1', {
'defines': [
'__ARM_ARCH__=7',
],
}],
[ 'armv7 == 1 and arm_neon == 1', {
[ 'arm_version >= 7 and arm_neon == 1', {
'defines': [
'__ARM_HAVE_NEON',
],
Expand Down Expand Up @@ -708,12 +698,12 @@
'../third_party/skia/src/opts/SkBitmapProcState_opts_arm.cpp',
],
}],
[ 'armv7 == 1 and arm_neon == 0', {
[ 'target_arch == "arm" and (arm_version < 7 or arm_neon == 0)', {
'sources': [
'../third_party/skia/src/opts/memset.arm.S',
],
}],
[ 'armv7 == 1 and arm_neon == 1', {
[ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 1', {
'sources': [
'../third_party/skia/src/opts/memset16_neon.S',
'../third_party/skia/src/opts/memset32_neon.S',
Expand All @@ -724,13 +714,13 @@
'../third_party/skia/src/opts/SkBlitRow_opts_arm_neon.cpp',
],
}],
[ 'target_arch == "arm" and armv7 == 0', {
[ 'target_arch == "arm" and arm_version < 6', {
'sources': [
'../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
'../third_party/skia/src/opts/SkUtils_opts_none.cpp',
],
}],
[ 'target_arch == "arm" and armv7 == 1', {
[ 'target_arch == "arm" and arm_version >= 6', {
'sources': [
'../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
'../third_party/skia/src/opts/SkBlitRow_opts_arm.h',
Expand Down
4 changes: 2 additions & 2 deletions third_party/libwebp/libwebp.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
{
'target_name': 'libwebp_dsp_neon',
'conditions': [
['armv7 == 1', {
['target_arch == "arm" and arm_version >= 7', {
'type': 'static_library',
'include_dirs': ['.'],
'sources': [
Expand All @@ -72,7 +72,7 @@
# behavior similar to *.c.neon in an Android.mk
'cflags!': [ '-mfpu=vfpv3-d16' ],
'cflags': [ '-mfpu=neon' ],
},{ # "armv7 != 1"
},{ # "target_arch != "arm" or arm_version < 7"
'type': 'none',
}],
['order_profiling != 0', {
Expand Down

0 comments on commit 7d67634

Please sign in to comment.