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}
This commit is contained in:
joransiu 2016-01-14 09:16:10 -08:00 committed by Commit bot
parent b5d915afd8
commit 1091c2f07e
5 changed files with 74 additions and 11 deletions

View File

@ -171,12 +171,22 @@ config("toolchain") {
if (v8_target_arch == "mips64el") { if (v8_target_arch == "mips64el") {
defines += [ "V8_TARGET_ARCH_MIPS64" ] 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") { if (v8_target_arch == "x86") {
defines += [ "V8_TARGET_ARCH_IA32" ] defines += [ "V8_TARGET_ARCH_IA32" ]
} }
if (v8_target_arch == "x64") { if (v8_target_arch == "x64") {
defines += [ "V8_TARGET_ARCH_X64" ] defines += [ "V8_TARGET_ARCH_X64" ]
} }
if (is_win) { if (is_win) {
defines += [ "WIN32" ] defines += [ "WIN32" ]
# TODO(jochen): Support v8_enable_prof. # TODO(jochen): Support v8_enable_prof.

View File

@ -238,7 +238,8 @@ endif
# Architectures and modes to be compiled. Consider these to be internal # Architectures and modes to be compiled. Consider these to be internal
# variables, don't override them (use the targets instead). # 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 DEFAULT_ARCHES = ia32 x64 arm
MODES = release debug optdebug MODES = release debug optdebug
DEFAULT_MODES = release debug DEFAULT_MODES = release debug

View File

@ -117,7 +117,7 @@
}, { }, {
'gomadir': '<!(/bin/echo -n ${HOME}/goma)', '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', { coverage==0', {
'host_clang%': 1, 'host_clang%': 1,
}, { }, {

View File

@ -135,6 +135,7 @@
'conditions': [ 'conditions': [
['host_arch=="ia32" or host_arch=="x64" or \ ['host_arch=="ia32" or host_arch=="x64" or \
host_arch=="ppc" or host_arch=="ppc64" or \ host_arch=="ppc" or host_arch=="ppc64" or \
host_arch=="s390" or host_arch=="s390x" or \
clang==1', { clang==1', {
'variables': { 'variables': {
'host_cxx_is_biarch%': 1, 'host_cxx_is_biarch%': 1,
@ -145,8 +146,8 @@
}, },
}], }],
['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \ ['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \
target_arch=="ppc" or target_arch=="ppc64" or \ target_arch=="ppc" or target_arch=="ppc64" or target_arch=="s390" or \
clang==1', { target_arch=="s390x" or clang==1', {
'variables': { 'variables': {
'target_cxx_is_biarch%': 1, 'target_cxx_is_biarch%': 1,
}, },
@ -297,6 +298,23 @@
'V8_TARGET_ARCH_ARM64', '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"', { ['v8_target_arch=="ppc" or v8_target_arch=="ppc64"', {
'defines': [ 'defines': [
'V8_TARGET_ARCH_PPC', 'V8_TARGET_ARCH_PPC',
@ -979,13 +997,21 @@
or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \ 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=="arm" or v8_target_arch=="ia32" or \
v8_target_arch=="x87" or v8_target_arch=="mips" 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': [ 'target_conditions': [
['_toolset=="host"', { ['_toolset=="host"', {
'conditions': [ 'conditions': [
['host_cxx_is_biarch==1', { ['host_cxx_is_biarch==1', {
'cflags': [ '-m32' ], 'conditions': [
'ldflags': [ '-m32' ] ['host_arch=="s390" or host_arch=="s390x"', {
'cflags': [ '-m31' ],
'ldflags': [ '-m31' ]
},{
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ]
}],
],
}], }],
], ],
'xcode_settings': { 'xcode_settings': {
@ -995,8 +1021,15 @@
['_toolset=="target"', { ['_toolset=="target"', {
'conditions': [ 'conditions': [
['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', { ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', {
'cflags': [ '-m32' ], 'conditions': [
'ldflags': [ '-m32' ], ['host_arch=="s390" or host_arch=="s390x"', {
'cflags': [ '-m31' ],
'ldflags': [ '-m31' ]
},{
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
],
}], }],
], ],
'xcode_settings': { 'xcode_settings': {
@ -1007,7 +1040,7 @@
}], }],
['(OS=="linux" or OS=="android") and \ ['(OS=="linux" or OS=="android") and \
(v8_target_arch=="x64" or v8_target_arch=="arm64" or \ (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': [ 'target_conditions': [
['_toolset=="host"', { ['_toolset=="host"', {
'conditions': [ 'conditions': [

View File

@ -55,6 +55,13 @@
#else #else
#define V8_HOST_ARCH_32_BIT 1 #define V8_HOST_ARCH_32_BIT 1
#endif #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 #else
#error "Host architecture was not detected as supported by v8" #error "Host architecture was not detected as supported by v8"
#endif #endif
@ -78,7 +85,7 @@
// environment as presented by the compiler. // environment as presented by the compiler.
#if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_X87 && \ #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_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__) #if defined(_M_X64) || defined(__x86_64__)
#define V8_TARGET_ARCH_X64 1 #define V8_TARGET_ARCH_X64 1
#elif defined(_M_IX86) || defined(__i386__) #elif defined(_M_IX86) || defined(__i386__)
@ -121,6 +128,12 @@
#else #else
#define V8_TARGET_ARCH_32_BIT 1 #define V8_TARGET_ARCH_32_BIT 1
#endif #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 #elif V8_TARGET_ARCH_X87
#define V8_TARGET_ARCH_32_BIT 1 #define V8_TARGET_ARCH_32_BIT 1
#else #else
@ -179,6 +192,12 @@
#define V8_TARGET_LITTLE_ENDIAN 1 #define V8_TARGET_LITTLE_ENDIAN 1
#elif V8_TARGET_ARCH_PPC_BE #elif V8_TARGET_ARCH_PPC_BE
#define V8_TARGET_BIG_ENDIAN 1 #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 #else
#error Unknown target architecture endianness #error Unknown target architecture endianness
#endif #endif