[build] Add v8gen support for PPC/s390 architecture

Add PPC/s390 configs to mb_config and BUILD.gn. Also
use a script to get host byte ordering.

R=machenbach@chromium.org, dpranke@chromium.org
BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2736993004
Cr-Commit-Position: refs/heads/master@{#43751}
This commit is contained in:
bjaideep 2017-03-13 08:05:51 -07:00 committed by Commit bot
parent c418902be4
commit a7d07a3d29
4 changed files with 98 additions and 3 deletions

6
.gn
View File

@ -21,5 +21,7 @@ check_targets = []
# These are the list of GN files that run exec_script. This whitelist exists
# to force additional review for new uses of exec_script, which is strongly
# discouraged except for gypi_to_gn calls.
exec_script_whitelist =
build_dotfile_settings.exec_script_whitelist + [ "//test/test262/BUILD.gn" ]
exec_script_whitelist = build_dotfile_settings.exec_script_whitelist + [
"//test/test262/BUILD.gn",
"//BUILD.gn",
]

View File

@ -104,6 +104,19 @@ declare_args() {
v8_enable_gdbjit = ((v8_current_cpu == "x86" || v8_current_cpu == "x64" ||
v8_current_cpu == "x87") && (is_linux || is_mac)) ||
(v8_current_cpu == "ppc64" && is_linux)
# Set v8_host_byteorder
v8_host_byteorder = "little"
# ppc64 can be either BE or LE
if (host_cpu == "ppc64") {
v8_host_byteorder =
exec_script("//tools/get_byteorder.py", [], "trim string")
}
if (host_cpu == "ppc" || host_cpu == "s390" || host_cpu == "s390x" ||
host_cpu == "mips" || host_cpu == "mips64") {
v8_host_byteorder = "big"
}
}
# Derived defaults.
@ -361,8 +374,31 @@ config("toolchain") {
if (v8_current_cpu == "s390x") {
defines += [ "V8_TARGET_ARCH_S390X" ]
}
if (host_cpu == "x64" || host_cpu == "x86") {
if (v8_host_byteorder == "little") {
defines += [ "V8_TARGET_ARCH_S390_LE_SIM" ]
} else {
cflags += [ "-march=z196" ]
}
}
if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
defines += [ "V8_TARGET_ARCH_PPC" ]
if (v8_current_cpu == "ppc64") {
defines += [ "V8_TARGET_ARCH_PPC64" ]
}
if (v8_host_byteorder == "little") {
defines += [ "V8_TARGET_ARCH_PPC_LE" ]
} else if (v8_host_byteorder == "big") {
defines += [ "V8_TARGET_ARCH_PPC_BE" ]
if (current_os == "aix") {
cflags += [
# Work around AIX ceil, trunc and round oddities.
"-mcpu=power5+",
"-mfprnd",
# Work around AIX assembler popcntb bug.
"-mno-popcntb",
]
}
}
}
if (v8_current_cpu == "x86") {

View File

@ -24,6 +24,18 @@
'mips64el.debug': 'default_debug_mips64el',
'mips64el.optdebug': 'default_optdebug_mips64el',
'mips64el.release': 'default_release_mips64el',
'ppc.debug': 'default_debug_ppc',
'ppc.optdebug': 'default_optdebug_ppc',
'ppc.release': 'default_release_ppc',
'ppc64.debug': 'default_debug_ppc64',
'ppc64.optdebug': 'default_optdebug_ppc64',
'ppc64.release': 'default_release_ppc64',
's390.debug': 'default_debug_s390',
's390.optdebug': 'default_optdebug_s390',
's390.release': 'default_release_s390',
's390x.debug': 'default_debug_s390x',
's390x.optdebug': 'default_optdebug_s390x',
's390x.release': 'default_release_s390x',
'x64.debug': 'default_debug_x64',
'x64.optdebug': 'default_optdebug_x64',
'x64.release': 'default_release_x64',
@ -234,6 +246,34 @@
'gn', 'debug', 'simulate_mips64el', 'v8_enable_slow_dchecks'],
'default_release_mips64el': [
'gn', 'release', 'simulate_mips64el'],
'default_debug_ppc': [
'gn', 'debug', 'simulate_ppc', 'v8_enable_slow_dchecks',
'v8_full_debug'],
'default_optdebug_ppc': [
'gn', 'debug', 'simulate_ppc', 'v8_enable_slow_dchecks'],
'default_release_ppc': [
'gn', 'release', 'simulate_ppc'],
'default_debug_ppc64': [
'gn', 'debug', 'simulate_ppc64', 'v8_enable_slow_dchecks',
'v8_full_debug'],
'default_optdebug_ppc64': [
'gn', 'debug', 'simulate_ppc64', 'v8_enable_slow_dchecks'],
'default_release_ppc64': [
'gn', 'release', 'simulate_ppc64'],
'default_debug_s390': [
'gn', 'debug', 'simulate_s390', 'v8_enable_slow_dchecks',
'v8_full_debug'],
'default_optdebug_s390': [
'gn', 'debug', 'simulate_s390', 'v8_enable_slow_dchecks'],
'default_release_s390': [
'gn', 'release', 'simulate_s390'],
'default_debug_s390x': [
'gn', 'debug', 'simulate_s390x', 'v8_enable_slow_dchecks',
'v8_full_debug'],
'default_optdebug_s390x': [
'gn', 'debug', 'simulate_s390x', 'v8_enable_slow_dchecks'],
'default_release_s390x': [
'gn', 'release', 'simulate_s390x'],
'default_debug_x64': [
'gn', 'debug', 'x64', 'v8_enable_slow_dchecks', 'v8_full_debug'],
'default_optdebug_x64': [

17
tools/get_byteorder.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python
#
# Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Get Byteorder of host architecture"""
import sys
def main():
print sys.byteorder
return 0
if __name__ == '__main__':
sys.exit(main())