summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-03-09 10:16:56 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-03-16 16:43:47 +0100
commit5bbf1dc6a3285b90cbaa57062604e00829ff0e7b (patch)
tree253d779b92c00ba3ec0b087f75c458d0201b160a
parentbbd400fa483a3cefe5e17e3fba504a2e04a71f8c (diff)
downloadqtwebengine-chromium-5bbf1dc6a3285b90cbaa57062604e00829ff0e7b.tar.gz
Add crossbuild support for x64/x86 on macos-arm64
Task-number: QTBUG-100672 Change-Id: I3081d927ad4bf151486eb1de5e7491a08a41b073 Reviewed-by: Michal Klocek <michal.klocek@qt.io> (cherry picked from commit 7e3cb70a2c4408f18e53d467329cf3a9edfcfe13)
-rw-r--r--chromium/build/toolchain/mac/BUILD.gn20
-rw-r--r--chromium/v8/gni/snapshot_toolchain.gni23
-rw-r--r--chromium/v8/src/base/build_config.h8
-rw-r--r--chromium/v8/src/base/immediate-crash.h2
-rw-r--r--chromium/v8/src/codegen/x64/assembler-x64.cc11
5 files changed, 57 insertions, 7 deletions
diff --git a/chromium/build/toolchain/mac/BUILD.gn b/chromium/build/toolchain/mac/BUILD.gn
index c36ef255e04..c03a4a670ce 100644
--- a/chromium/build/toolchain/mac/BUILD.gn
+++ b/chromium/build/toolchain/mac/BUILD.gn
@@ -105,3 +105,23 @@ mac_toolchain("clang_x64_v8_mips64el") {
}
}
}
+
+mac_toolchain("clang_arm_v8_x86") {
+ toolchain_args = {
+ current_cpu = "arm"
+
+ if (defined(v8_current_cpu)) {
+ v8_current_cpu = "x86"
+ }
+ }
+}
+
+mac_toolchain("clang_arm64_v8_x64") {
+ toolchain_args = {
+ current_cpu = "arm64"
+
+ if (defined(v8_current_cpu)) {
+ v8_current_cpu = "x64"
+ }
+ }
+}
diff --git a/chromium/v8/gni/snapshot_toolchain.gni b/chromium/v8/gni/snapshot_toolchain.gni
index feabd079e00..a5fb1d15df9 100644
--- a/chromium/v8/gni/snapshot_toolchain.gni
+++ b/chromium/v8/gni/snapshot_toolchain.gni
@@ -106,6 +106,29 @@ if (v8_snapshot_toolchain == "") {
# cross compile Windows arm64 with host toolchain.
v8_snapshot_toolchain = host_toolchain
}
+ } else if (host_cpu == "arm64") {
+ if (is_chromeos && !is_clang) {
+ _clang = ""
+ } else {
+ _clang = "clang_"
+ }
+
+ if (v8_current_cpu == "arm64" || v8_current_cpu == "arm") {
+ _cpus = v8_current_cpu
+ } else if (v8_current_cpu == "x64" || v8_current_cpu == "mips64el" ||
+ v8_current_cpu == "riscv64" || v8_current_cpu == "loong64") {
+ _cpus = "arm64_v8_${v8_current_cpu}"
+ } else if (v8_current_cpu == "x86" || v8_current_cpu == "mipsel") {
+ _cpus = "arm_v8_${v8_current_cpu}"
+ } else {
+ # This branch should not be reached; leave _cpus blank so the assert
+ # below will fail.
+ _cpus = ""
+ }
+
+ if (_cpus != "") {
+ v8_snapshot_toolchain = "//build/toolchain/${host_os}:${_clang}${_cpus}"
+ }
}
}
diff --git a/chromium/v8/src/base/build_config.h b/chromium/v8/src/base/build_config.h
index 3303916776f..f741fc04db9 100644
--- a/chromium/v8/src/base/build_config.h
+++ b/chromium/v8/src/base/build_config.h
@@ -150,12 +150,12 @@
#endif
// Check for supported combinations of host and target architectures.
-#if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32
-#error Target architecture ia32 is only supported on ia32 host
+#if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_32_BIT
+#error Target architecture ia32 is only supported on 32 bit host
#endif
#if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT && \
- !(V8_HOST_ARCH_X64 && V8_HOST_ARCH_64_BIT))
-#error Target architecture x64 is only supported on x64 host
+ !(V8_HOST_ARCH_64_BIT))
+#error Target architecture x64 is only supported on 64 bit host
#endif
#if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT && \
!(V8_HOST_ARCH_X64 && V8_HOST_ARCH_32_BIT))
diff --git a/chromium/v8/src/base/immediate-crash.h b/chromium/v8/src/base/immediate-crash.h
index ef1f9223177..00ccb430127 100644
--- a/chromium/v8/src/base/immediate-crash.h
+++ b/chromium/v8/src/base/immediate-crash.h
@@ -42,7 +42,7 @@
#if V8_CC_GNU
-#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
+#if V8_HOST_ARCH_X64 || V8_HOST_ARCH_IA32
// TODO(https://crbug.com/958675): In theory, it should be possible to use just
// int3. However, there are a number of crashes with SIGILL as the exception
diff --git a/chromium/v8/src/codegen/x64/assembler-x64.cc b/chromium/v8/src/codegen/x64/assembler-x64.cc
index 0fdeee76856..4432186d665 100644
--- a/chromium/v8/src/codegen/x64/assembler-x64.cc
+++ b/chromium/v8/src/codegen/x64/assembler-x64.cc
@@ -32,6 +32,8 @@ namespace internal {
namespace {
+#if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
+
V8_INLINE uint64_t xgetbv(unsigned int xcr) {
#if V8_LIBC_MSVCRT
return _xgetbv(xcr);
@@ -69,6 +71,8 @@ bool OSHasAVXSupport() {
return (feature_mask & 0x6) == 0x6;
}
+#endif // V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
+
} // namespace
bool CpuFeatures::SupportsWasmSimd128() {
@@ -80,12 +84,14 @@ bool CpuFeatures::SupportsWasmSimd128() {
}
void CpuFeatures::ProbeImpl(bool cross_compile) {
+ // Only use statically determined features for cross compile (snapshot).
+ if (cross_compile) return;
+
+#if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
base::CPU cpu;
CHECK(cpu.has_sse2()); // SSE2 support is mandatory.
CHECK(cpu.has_cmov()); // CMOV support is mandatory.
- // Only use statically determined features for cross compile (snapshot).
- if (cross_compile) return;
if (cpu.has_sse42()) SetSupported(SSE4_2);
if (cpu.has_sse41()) SetSupported(SSE4_1);
if (cpu.has_ssse3()) SetSupported(SSSE3);
@@ -125,6 +131,7 @@ void CpuFeatures::ProbeImpl(bool cross_compile) {
// at runtime in builtins using an extern ref. Other callers should use
// CpuFeatures::SupportWasmSimd128().
CpuFeatures::supports_wasm_simd_128_ = CpuFeatures::SupportsWasmSimd128();
+#endif // V8_HOST_ARCH_X64
}
void CpuFeatures::PrintTarget() {}