For building v8 using gn on aix_ppc64, linux_s390x and linux_ppc64(both LE and BE).

Also add support for host_byteorder logic which is introduced in - https://codereview.chromium.org/2815453004/

Chromium_BUG=706728
R=machenbach@chromium.org, dpranke@chromium.org, adamk@chromium.org

Review-Url: https://codereview.chromium.org/2809963004
Cr-Commit-Position: refs/heads/master@{#45268}
This commit is contained in:
rayb 2017-05-11 18:35:09 -07:00 committed by Commit bot
parent 74543fedd8
commit 468f1958e0
4 changed files with 22 additions and 38 deletions

6
.gn
View File

@ -21,7 +21,5 @@ 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",
"//BUILD.gn",
]
exec_script_whitelist =
build_dotfile_settings.exec_script_whitelist + [ "//test/test262/BUILD.gn" ]

View File

@ -5,6 +5,7 @@
import("//build/config/android/config.gni")
import("//build/config/arm.gni")
import("//build/config/dcheck_always_on.gni")
import("//build/config/host_byteorder.gni")
import("//build/config/mips.gni")
import("//build/config/sanitizers/sanitizers.gni")
@ -107,19 +108,6 @@ 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.
@ -379,7 +367,7 @@ config("toolchain") {
if (v8_current_cpu == "s390x") {
defines += [ "V8_TARGET_ARCH_S390X" ]
}
if (v8_host_byteorder == "little") {
if (host_byteorder == "little") {
defines += [ "V8_TARGET_ARCH_S390_LE_SIM" ]
} else {
cflags += [ "-march=z196" ]
@ -390,9 +378,9 @@ config("toolchain") {
if (v8_current_cpu == "ppc64") {
defines += [ "V8_TARGET_ARCH_PPC64" ]
}
if (v8_host_byteorder == "little") {
if (host_byteorder == "little") {
defines += [ "V8_TARGET_ARCH_PPC_LE" ]
} else if (v8_host_byteorder == "big") {
} else if (host_byteorder == "big") {
defines += [ "V8_TARGET_ARCH_PPC_BE" ]
if (current_os == "aix") {
cflags += [
@ -406,6 +394,7 @@ config("toolchain") {
}
}
}
if (v8_current_cpu == "x86") {
defines += [ "V8_TARGET_ARCH_IA32" ]
if (is_win) {
@ -2508,6 +2497,16 @@ v8_component("v8_libbase") {
"src/base/platform/platform-linux.cc",
]
libs = [
"dl",
"rt",
]
} else if (current_os == "aix") {
sources += [
"src/base/debug/stack_trace_posix.cc",
"src/base/platform/platform-aix.cc",
]
libs = [
"dl",
"rt",

View File

@ -35,7 +35,7 @@
#define V8_HOST_ARCH_32_BIT 1
#elif defined(__PPC__) || defined(_ARCH_PPC)
#define V8_HOST_ARCH_PPC 1
#if defined(__PPC64__) || defined(_ARCH_PPC64)
#if defined(__PPC64__) || defined(_ARCH_PPC64) || defined(_ARCH_PPCGR)
#define V8_HOST_ARCH_64_BIT 1
#else
#define V8_HOST_ARCH_32_BIT 1
@ -91,6 +91,8 @@
#define V8_TARGET_ARCH_MIPS64 1
#elif defined(__MIPSEB__) || defined(__MIPSEL__)
#define V8_TARGET_ARCH_MIPS 1
#elif defined(_ARCH_PPC)
#define V8_TARGET_ARCH_PPC 1
#else
#error Target architecture was not detected as supported by v8
#endif
@ -181,6 +183,8 @@
#endif
#elif V8_TARGET_ARCH_X87
#define V8_TARGET_LITTLE_ENDIAN 1
#elif __BIG_ENDIAN__ // FOR PPCGR on AIX
#define V8_TARGET_BIG_ENDIAN 1
#elif V8_TARGET_ARCH_PPC_LE
#define V8_TARGET_LITTLE_ENDIAN 1
#elif V8_TARGET_ARCH_PPC_BE

View File

@ -1,17 +0,0 @@
#!/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())