Commit b4870d28 authored by Piotr Sikora's avatar Piotr Sikora Committed by V8 LUCI CQ

[bazel] Add support for building on s390x.

Tested with both GCC and Clang on s390x (under QEMU).
Signed-off-by: 's avatarPiotr Sikora <piotrsikora@google.com>
Change-Id: Iad6609136e25a6e94d51f365e4c54e6f042aa897
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3346395Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78531}
parent e4bf0331
......@@ -293,6 +293,10 @@ v8_config(
"CAN_USE_VFP3_INSTRUCTIONS",
],
"@v8//bazel/config:v8_target_arm64": ["V8_TARGET_ARCH_ARM64"],
"@v8//bazel/config:v8_target_s390x": [
"V8_TARGET_ARCH_S390",
"V8_TARGET_ARCH_S390X",
],
},
no_match_error = "Please specify a target cpu supported by v8",
) + select({
......@@ -2195,6 +2199,37 @@ filegroup(
"src/regexp/arm64/regexp-macro-assembler-arm64.h",
"src/wasm/baseline/arm64/liftoff-assembler-arm64.h",
],
"@v8//bazel/config:v8_target_s390x": [
"src/baseline/s390/baseline-assembler-s390-inl.h",
"src/baseline/s390/baseline-compiler-s390-inl.h",
"src/codegen/s390/assembler-s390.cc",
"src/codegen/s390/assembler-s390.h",
"src/codegen/s390/assembler-s390-inl.h",
"src/codegen/s390/constants-s390.cc",
"src/codegen/s390/constants-s390.h",
"src/codegen/s390/cpu-s390.cc",
"src/codegen/s390/interface-descriptors-s390-inl.h",
"src/codegen/s390/macro-assembler-s390.cc",
"src/codegen/s390/macro-assembler-s390.h",
"src/codegen/s390/register-s390.h",
"src/compiler/backend/s390/code-generator-s390.cc",
"src/compiler/backend/s390/instruction-codes-s390.h",
"src/compiler/backend/s390/instruction-scheduler-s390.cc",
"src/compiler/backend/s390/instruction-selector-s390.cc",
"src/compiler/backend/s390/unwinding-info-writer-s390.cc",
"src/compiler/backend/s390/unwinding-info-writer-s390.h",
"src/deoptimizer/s390/deoptimizer-s390.cc",
"src/diagnostics/s390/disasm-s390.cc",
"src/diagnostics/s390/eh-frame-s390.cc",
"src/diagnostics/s390/unwinder-s390.cc",
"src/execution/s390/frame-constants-s390.cc",
"src/execution/s390/frame-constants-s390.h",
"src/execution/s390/simulator-s390.cc",
"src/execution/s390/simulator-s390.h",
"src/regexp/s390/regexp-macro-assembler-s390.cc",
"src/regexp/s390/regexp-macro-assembler-s390.h",
"src/wasm/baseline/s390/liftoff-assembler-s390.h",
],
}) + select({
# Only for x64 builds and for arm64 with x64 host simulator.
"@v8//bazel/config:is_posix_x64": [
......@@ -2708,6 +2743,7 @@ filegroup(
"@v8//bazel/config:v8_target_x64": ["src/builtins/x64/builtins-x64.cc"],
"@v8//bazel/config:v8_target_arm": ["src/builtins/arm/builtins-arm.cc"],
"@v8//bazel/config:v8_target_arm64": ["src/builtins/arm64/builtins-arm64.cc"],
"@v8//bazel/config:v8_target_s390x": ["src/builtins/s390/builtins-s390.cc"],
}) + select({
":is_v8_enable_webassembly": [
"src/builtins/builtins-wasm-gen.cc",
......@@ -2828,6 +2864,7 @@ filegroup(
"@v8//bazel/config:is_inline_asm_x64": ["src/heap/base/asm/x64/push_registers_asm.cc"],
"@v8//bazel/config:is_inline_asm_arm": ["src/heap/base/asm/arm/push_registers_asm.cc"],
"@v8//bazel/config:is_inline_asm_arm64": ["src/heap/base/asm/arm64/push_registers_asm.cc"],
"@v8//bazel/config:is_inline_asm_s390x": ["src/heap/base/asm/s390/push_registers_asm.cc"],
"@v8//bazel/config:is_msvc_asm_ia32": ["src/heap/base/asm/ia32/push_registers_masm.S"],
"@v8//bazel/config:is_msvc_asm_x64": ["src/heap/base/asm/x64/push_registers_masm.S"],
"@v8//bazel/config:is_msvc_asm_arm64": ["src/heap/base/asm/arm64/push_registers_masm.S"],
......@@ -2992,8 +3029,7 @@ filegroup(
"google3/snapshots/ia32/noicu/embedded.S",
"google3/snapshots/ia32/noicu/snapshot.cc",
],
"@v8//bazel/config:v8_target_arm64": [":noicu/generated_snapshot_files"],
"@v8//bazel/config:v8_target_x64": [":noicu/generated_snapshot_files"],
"//conditions:default": [":noicu/generated_snapshot_files"],
}),
)
......@@ -3010,8 +3046,7 @@ filegroup(
"google3/snapshots/ia32/icu/embedded.S",
"google3/snapshots/ia32/icu/snapshot.cc",
],
"@v8//bazel/config:v8_target_arm64": [":icu/generated_snapshot_files"],
"@v8//bazel/config:v8_target_x64": [":icu/generated_snapshot_files"],
"//conditions:default": [":icu/generated_snapshot_files"],
}),
)
......
......@@ -49,6 +49,11 @@ config_setting(
constraint_values = ["@platforms//cpu:arm"],
)
config_setting(
name = "platform_cpu_s390x",
constraint_values = ["@platforms//cpu:s390x"],
)
v8_target_cpu(
name = "v8_target_cpu",
build_setting_default = "none",
......@@ -81,6 +86,11 @@ v8_configure_target_cpu(
matching_configs = [":platform_cpu_arm"],
)
v8_configure_target_cpu(
name = "s390x",
matching_configs = [":platform_cpu_s390x"],
)
selects.config_setting_group(
name = "v8_target_is_32_bits",
match_any = [
......@@ -124,6 +134,7 @@ selects.config_setting_group(
":v8_target_arm64",
":is_x64",
":is_arm64",
":is_s390x",
],
)
......@@ -172,6 +183,11 @@ selects.config_setting_group(
match_all = [":is_posix", ":is_arm"],
)
selects.config_setting_group(
name = "is_inline_asm_s390x",
match_all = [":is_posix", ":is_s390x"],
)
selects.config_setting_group(
name = "is_msvc_asm_x64",
match_all = [":is_windows", ":is_x64"],
......@@ -225,6 +241,14 @@ selects.config_setting_group(
],
)
selects.config_setting_group(
name = "is_clang_s390x",
match_all = [
":is_clang",
":is_s390x",
],
)
config_setting(
name = "is_compiler_gcc",
flag_values = {
......
......@@ -14,7 +14,7 @@ V8CpuTypeInfo = provider(
)
def _host_target_cpu_impl(ctx):
allowed_values = ["arm", "arm64", "ia32", "x64", "none"]
allowed_values = ["arm", "arm64", "ia32", "s390x", "x64", "none"]
cpu_type = ctx.build_setting_value
if cpu_type in allowed_values:
return V8CpuTypeInfo(value = cpu_type)
......
......@@ -146,6 +146,11 @@ def _default_args():
"-O1",
],
"//conditions:default": [],
}) + select({
"@v8//bazel/config:is_clang_s390x": [
"-fno-integrated-as",
],
"//conditions:default": [],
}),
includes = ["include"],
linkopts = select({
......@@ -378,6 +383,7 @@ def _v8_target_cpu_transition_impl(settings, attr):
"arm64-v8a": "arm64",
"arm": "arm64",
"armeabi-v7a": "arm32",
"s390x": "s390x",
}
v8_target_cpu = mapping[settings["//command_line_option:cpu"]]
return {"@v8//bazel/config:v8_target_cpu": v8_target_cpu}
......
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