Skip to content

build: clean up arm build options #32704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'variables': {
'configuring_node%': 0,
'asan%': 0,
'arm_version%': 0, # ARM architecture version (6 or 7)
'werror': '', # Turn off -Werror in V8 build.
'visibility%': 'hidden', # V8's visibility setting
'target_arch%': 'ia32', # set v8's target architecture
Expand Down Expand Up @@ -268,6 +269,17 @@
'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin

'conditions': [
[ 'arm_version==7', {
'target_conditions': [
['_toolset=="target"', {
# Any Cortex-A that can run V8 supports at least armv7-a+neon.
'cflags': [
'-march=armv7-a',
'-mfpu=neon', # Implies VFPv3.
],
}],
],
}],
[ 'configuring_node', {
'msvs_configuration_attributes': {
'OutputDirectory': '<(DEPTH)/out/$(Configuration)/',
Expand Down
65 changes: 4 additions & 61 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
'android', 'aix', 'cloudabi')
valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc',
'ppc64', 'x32','x64', 'x86', 'x86_64', 's390x')
valid_arm_float_abi = ('soft', 'softfp', 'hard')
valid_arm_fpu = ('vfp', 'vfpv3', 'vfpv3-d16', 'neon')
valid_mips_arch = ('loongson', 'r1', 'r2', 'r6', 'rx')
valid_mips_fpu = ('fp32', 'fp64', 'fpxx')
valid_mips_float_abi = ('soft', 'hard')
Expand Down Expand Up @@ -382,20 +380,6 @@
dest='v8_options',
help='v8 options to pass, see `node --v8-options` for examples.')

parser.add_option('--with-arm-float-abi',
action='store',
dest='arm_float_abi',
choices=valid_arm_float_abi,
help='specifies which floating-point ABI to use ({0}).'.format(
', '.join(valid_arm_float_abi)))

parser.add_option('--with-arm-fpu',
action='store',
dest='arm_fpu',
choices=valid_arm_fpu,
help='ARM FPU mode ({0}) [default: %default]'.format(
', '.join(valid_arm_fpu)))

parser.add_option('--with-mips-arch-variant',
action='store',
dest='mips_arch_variant',
Expand Down Expand Up @@ -883,28 +867,6 @@ def cc_macros(cc=None):
return k


def is_arch_armv7():
"""Check for ARMv7 instructions"""
cc_macros_cache = cc_macros()
return cc_macros_cache.get('__ARM_ARCH') == '7'


def is_arch_armv6():
"""Check for ARMv6 instructions"""
cc_macros_cache = cc_macros()
return cc_macros_cache.get('__ARM_ARCH') == '6'


def is_arm_hard_float_abi():
"""Check for hardfloat or softfloat eabi on ARM"""
# GCC versions 4.6 and above define __ARM_PCS or __ARM_PCS_VFP to specify
# the Floating Point ABI used (PCS stands for Procedure Call Standard).
# We use these as well as a couple of other defines to statically determine
# what FP ABI used.

return '__ARM_PCS_VFP' in cc_macros()


def host_arch_cc():
"""Host architecture check using the CC command."""

Expand Down Expand Up @@ -957,29 +919,10 @@ def host_arch_win():


def configure_arm(o):
if options.arm_float_abi:
arm_float_abi = options.arm_float_abi
elif is_arm_hard_float_abi():
arm_float_abi = 'hard'
else:
arm_float_abi = 'default'

arm_fpu = 'vfp'

if is_arch_armv7():
arm_fpu = 'vfpv3'
o['variables']['arm_version'] = '7'
else:
o['variables']['arm_version'] = '6' if is_arch_armv6() else 'default'

o['variables']['arm_thumb'] = 0 # -marm
o['variables']['arm_float_abi'] = arm_float_abi

if options.dest_os == 'android':
arm_fpu = 'vfpv3'
o['variables']['arm_version'] = '7'

o['variables']['arm_fpu'] = options.arm_fpu or arm_fpu
armv7 = options.dest_os == 'android' or cc_macros().get('__ARM_ARCH') == '7'
# ARMv6 is primarily the ARM1176 CPU used in the Broadcom BCM2835 SoC of
# first-gen Raspberry Pis and the Pi Zero. It supports VFP2 but not NEON.
o['variables']['arm_version'] = '7' if armv7 else '6'


def configure_mips(o):
Expand Down
19 changes: 15 additions & 4 deletions deps/zlib/zlib.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{
'variables': {
'use_system_zlib%': 0,
'arm_fpu%': '',
'llvm_version%': '0.0',
},
'conditions': [
Expand Down Expand Up @@ -64,7 +63,8 @@
'USE_FILE32API'
],
}],
['(target_arch in "ia32 x64 x32" and OS!="ios") or arm_fpu=="neon"', {
['(target_arch in "arm64 ia32 x64 x32" and OS!="ios") or '
'arm_version==7', {
'sources': [
'adler32_simd.c',
'adler32_simd.h',
Expand Down Expand Up @@ -112,7 +112,18 @@
}, {
'sources': [ 'simd_stub.c', ],
}],
['arm_fpu=="neon"', {
['arm_version==7', {
'defines': [
'ADLER32_SIMD_NEON',
'INFLATE_CHUNK_SIMD_NEON',
],
'sources': [
'contrib/optimizations/slide_hash_neon.h',
'crc32_simd.c',
'crc32_simd.h',
],
}],
['target_arch=="arm64"', {
'defines': [
'ADLER32_SIMD_NEON',
'INFLATE_CHUNK_SIMD_NEON',
Expand All @@ -136,7 +147,7 @@
['OS=="linux"', {
'defines': [ 'ARMV8_OS_LINUX' ],
}],
['OS="win"', {
['OS=="win"', {
'defines': [ 'ARMV8_OS_WINDOWS' ],
}],
['OS!="android" and OS!="win" and llvm_version=="0.0"', {
Expand Down
108 changes: 3 additions & 105 deletions tools/v8_gypfiles/toolchain.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -176,27 +176,13 @@
'V8_TARGET_ARCH_ARM',
],
'conditions': [
[ 'arm_version==7 or arm_version=="default"', {
# ARMv7 supports NEON+VFP3, ARMv6 only supports VFP2.
[ 'arm_version==7', {
'defines': [
'CAN_USE_ARMV7_INSTRUCTIONS',
],
}],
[ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
],
}],
[ 'arm_fpu=="vfpv3"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_NEON',
'CAN_USE_VFP32DREGS',
],
}],
[ 'arm_fpu=="neon"', {
'defines': [
'CAN_USE_VFP3_INSTRUCTIONS',
'CAN_USE_VFP32DREGS',
'CAN_USE_NEON',
],
}],
[ 'arm_test_noprobe=="on"', {
Expand All @@ -205,94 +191,6 @@
],
}],
],
'target_conditions': [
['_toolset=="host"', {
'conditions': [
['v8_target_arch==host_arch', {
# Host built with an Arm CXX compiler.
'conditions': [
[ 'arm_version==7', {
'cflags': ['-march=armv7-a',],
}],
[ 'arm_version==7 or arm_version=="default"', {
'conditions': [
[ 'arm_fpu!="default"', {
'cflags': ['-mfpu=<(arm_fpu)',],
}],
],
}],
[ 'arm_float_abi!="default"', {
'cflags': ['-mfloat-abi=<(arm_float_abi)',],
}],
[ 'arm_thumb==1', {
'cflags': ['-mthumb',],
}],
[ 'arm_thumb==0', {
'cflags': ['-marm',],
}],
],
}, {
# 'v8_target_arch!=host_arch'
# Host not built with an Arm CXX compiler (simulator build).
'conditions': [
[ 'arm_float_abi=="hard"', {
'defines': [
'USE_EABI_HARDFLOAT=1',
],
}],
[ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
'defines': [
'USE_EABI_HARDFLOAT=0',
],
}],
],
}],
],
}], # _toolset=="host"
['_toolset=="target"', {
'conditions': [
['v8_target_arch==target_arch', {
# Target built with an Arm CXX compiler.
'conditions': [
[ 'arm_version==7', {
'cflags': ['-march=armv7-a',],
}],
[ 'arm_version==7 or arm_version=="default"', {
'conditions': [
[ 'arm_fpu!="default"', {
'cflags': ['-mfpu=<(arm_fpu)',],
}],
],
}],
[ 'arm_float_abi!="default"', {
'cflags': ['-mfloat-abi=<(arm_float_abi)',],
}],
[ 'arm_thumb==1', {
'cflags': ['-mthumb',],
}],
[ 'arm_thumb==0', {
'cflags': ['-marm',],
}],
],
}, {
# 'v8_target_arch!=target_arch'
# Target not built with an Arm CXX compiler (simulator build).
'conditions': [
[ 'arm_float_abi=="hard"', {
'defines': [
'USE_EABI_HARDFLOAT=1',
],
}],
[ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
'defines': [
'USE_EABI_HARDFLOAT=0',
],
}],
],
}],
],
}], # _toolset=="target"
],
}], # v8_target_arch=="arm"
['v8_target_arch=="arm64"', {
'defines': [
Expand Down