Commit 1091c2f0 authored by joransiu's avatar joransiu Committed by Commit bot

S390: Makefile + Build Toolchain Updates

This is the first of several commits to contribute Linux on z Systems
(s390/s390x) port of V8.  We will be breaking up the changes into several
(hopefully) logical commits.

This commit contains the changes to V8 Makefile and build toolchains to
introduce S390 macros and compiler options.  Just for awareness for reviewers
is that s390 is 31-bit (not 32!) big-endian platform on Linux on z.  (MSB of address
is used to distinguish between 24-bit vs 31-bit addressing!)  s390x is
64-bit Linux on z.  Names follow the general linux convention on the platform.

A quick roadmap on upcoming commits:
- Add \#include of S390 header files in common files
- S390 related tests + tooling changes
- printf macro for printing size_t values.
- S390 platform-specific code generation code (bulk of changes!)

R=danno@chromium.org,svenpanne@chromium.org,michael_dawson@ca.ibm.com,jyan@ca.ibm.com,mtbrandyberry@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#33304}
parent b5d915af
......@@ -171,12 +171,22 @@ config("toolchain") {
if (v8_target_arch == "mips64el") {
defines += [ "V8_TARGET_ARCH_MIPS64" ]
}
if (v8_target_arch == "s390") {
defines += [ "V8_TARGET_ARCH_S390" ]
}
if (v8_target_arch == "s390x") {
defines += [
"V8_TARGET_ARCH_S390",
"V8_TARGET_ARCH_S390X",
]
}
if (v8_target_arch == "x86") {
defines += [ "V8_TARGET_ARCH_IA32" ]
}
if (v8_target_arch == "x64") {
defines += [ "V8_TARGET_ARCH_X64" ]
}
if (is_win) {
defines += [ "WIN32" ]
# TODO(jochen): Support v8_enable_prof.
......
......@@ -238,7 +238,8 @@ endif
# Architectures and modes to be compiled. Consider these to be internal
# variables, don't override them (use the targets instead).
ARCHES = ia32 x64 x32 arm arm64 mips mipsel mips64 mips64el x87 ppc ppc64
ARCHES = ia32 x64 x32 arm arm64 mips mipsel mips64 mips64el x87 ppc ppc64 \
s390 s390x
DEFAULT_ARCHES = ia32 x64 arm
MODES = release debug optdebug
DEFAULT_MODES = release debug
......
......@@ -117,7 +117,7 @@
}, {
'gomadir': '<!(/bin/echo -n ${HOME}/goma)',
}],
['host_arch!="ppc" and host_arch!="ppc64" and host_arch!="ppc64le" and \
['host_arch!="ppc" and host_arch!="ppc64" and host_arch!="ppc64le" and host_arch!="s390" and host_arch!="s390x" and \
coverage==0', {
'host_clang%': 1,
}, {
......
......@@ -135,6 +135,7 @@
'conditions': [
['host_arch=="ia32" or host_arch=="x64" or \
host_arch=="ppc" or host_arch=="ppc64" or \
host_arch=="s390" or host_arch=="s390x" or \
clang==1', {
'variables': {
'host_cxx_is_biarch%': 1,
......@@ -145,8 +146,8 @@
},
}],
['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \
target_arch=="ppc" or target_arch=="ppc64" or \
clang==1', {
target_arch=="ppc" or target_arch=="ppc64" or target_arch=="s390" or \
target_arch=="s390x" or clang==1', {
'variables': {
'target_cxx_is_biarch%': 1,
},
......@@ -297,6 +298,23 @@
'V8_TARGET_ARCH_ARM64',
],
}],
['v8_target_arch=="s390" or v8_target_arch=="s390x"', {
'defines': [
'V8_TARGET_ARCH_S390',
],
'conditions': [
['v8_target_arch=="s390x"', {
'defines': [
'V8_TARGET_ARCH_S390X',
],
}],
['v8_host_byteorder=="little"', {
'defines': [
'V8_TARGET_ARCH_S390_LE_SIM',
],
}],
],
}], # s390
['v8_target_arch=="ppc" or v8_target_arch=="ppc64"', {
'defines': [
'V8_TARGET_ARCH_PPC',
......@@ -979,13 +997,21 @@
or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
(v8_target_arch=="arm" or v8_target_arch=="ia32" or \
v8_target_arch=="x87" or v8_target_arch=="mips" or \
v8_target_arch=="mipsel" or v8_target_arch=="ppc")', {
v8_target_arch=="mipsel" or v8_target_arch=="ppc" or \
v8_target_arch=="s390")', {
'target_conditions': [
['_toolset=="host"', {
'conditions': [
['host_cxx_is_biarch==1', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ]
'conditions': [
['host_arch=="s390" or host_arch=="s390x"', {
'cflags': [ '-m31' ],
'ldflags': [ '-m31' ]
},{
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ]
}],
],
}],
],
'xcode_settings': {
......@@ -995,8 +1021,15 @@
['_toolset=="target"', {
'conditions': [
['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
'conditions': [
['host_arch=="s390" or host_arch=="s390x"', {
'cflags': [ '-m31' ],
'ldflags': [ '-m31' ]
},{
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
],
}],
],
'xcode_settings': {
......@@ -1007,7 +1040,7 @@
}],
['(OS=="linux" or OS=="android") and \
(v8_target_arch=="x64" or v8_target_arch=="arm64" or \
v8_target_arch=="ppc64")', {
v8_target_arch=="ppc64" or v8_target_arch=="s390x")', {
'target_conditions': [
['_toolset=="host"', {
'conditions': [
......
......@@ -55,6 +55,13 @@
#else
#define V8_HOST_ARCH_32_BIT 1
#endif
#elif defined(__s390__) || defined(__s390x__)
#define V8_HOST_ARCH_S390 1
#if defined(__s390x__)
#define V8_HOST_ARCH_64_BIT 1
#else
#define V8_HOST_ARCH_32_BIT 1
#endif
#else
#error "Host architecture was not detected as supported by v8"
#endif
......@@ -78,7 +85,7 @@
// environment as presented by the compiler.
#if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_X87 && \
!V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS && \
!V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_PPC
!V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_PPC && !V8_TARGET_ARCH_S390
#if defined(_M_X64) || defined(__x86_64__)
#define V8_TARGET_ARCH_X64 1
#elif defined(_M_IX86) || defined(__i386__)
......@@ -121,6 +128,12 @@
#else
#define V8_TARGET_ARCH_32_BIT 1
#endif
#elif V8_TARGET_ARCH_S390
#if V8_TARGET_ARCH_S390X
#define V8_TARGET_ARCH_64_BIT 1
#else
#define V8_TARGET_ARCH_32_BIT 1
#endif
#elif V8_TARGET_ARCH_X87
#define V8_TARGET_ARCH_32_BIT 1
#else
......@@ -179,6 +192,12 @@
#define V8_TARGET_LITTLE_ENDIAN 1
#elif V8_TARGET_ARCH_PPC_BE
#define V8_TARGET_BIG_ENDIAN 1
#elif V8_TARGET_ARCH_S390
#if V8_TARGET_ARCH_S390_LE_SIM
#define V8_TARGET_LITTLE_ENDIAN 1
#else
#define V8_TARGET_BIG_ENDIAN 1
#endif
#else
#error Unknown target architecture endianness
#endif
......
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