diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-03-09 10:16:56 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-04-01 12:40:21 +0000 |
commit | ec4a16dc944302bdb87382e31c99e5b4be94fa0d (patch) | |
tree | a6d1d5b66eaaef3129cdd88a7c5ed5101731ee6a | |
parent | 1103459515c70bc08231ce4daf707ee0d64c0d44 (diff) | |
download | qtwebengine-chromium-ec4a16dc944302bdb87382e31c99e5b4be94fa0d.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)
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r-- | chromium/build/toolchain/mac/BUILD.gn | 20 | ||||
-rw-r--r-- | chromium/v8/gni/snapshot_toolchain.gni | 23 | ||||
-rw-r--r-- | chromium/v8/src/base/build_config.h | 8 | ||||
-rw-r--r-- | chromium/v8/src/codegen/x64/assembler-x64.cc | 12 |
4 files changed, 56 insertions, 7 deletions
diff --git a/chromium/build/toolchain/mac/BUILD.gn b/chromium/build/toolchain/mac/BUILD.gn index 49e5e3b77aa..efc6f83ccf5 100644 --- a/chromium/build/toolchain/mac/BUILD.gn +++ b/chromium/build/toolchain/mac/BUILD.gn @@ -621,6 +621,26 @@ 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" + } + } +} + if (is_ios) { mac_toolchain("ios_clang_arm64") { toolchain_args = { diff --git a/chromium/v8/gni/snapshot_toolchain.gni b/chromium/v8/gni/snapshot_toolchain.gni index 53963a048bf..e85127c2aa0 100644 --- a/chromium/v8/gni/snapshot_toolchain.gni +++ b/chromium/v8/gni/snapshot_toolchain.gni @@ -102,6 +102,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 21db0b6e66d..85e9a3cb08e 100644 --- a/chromium/v8/src/base/build_config.h +++ b/chromium/v8/src/base/build_config.h @@ -145,12 +145,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/codegen/x64/assembler-x64.cc b/chromium/v8/src/codegen/x64/assembler-x64.cc index 18330a91266..25f59036113 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,16 +71,19 @@ bool OSHasAVXSupport() { return (feature_mask & 0x6) == 0x6; } +#endif // V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64 + } // namespace 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() && FLAG_enable_sse4_2) supported_ |= 1u << SSE4_2; if (cpu.has_sse41() && FLAG_enable_sse4_1) { supported_ |= 1u << SSE4_1; @@ -114,6 +119,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() {} |