diff --git a/gni/snapshot_toolchain.gni b/gni/snapshot_toolchain.gni index cce97f7f17..99de816372 100644 --- a/gni/snapshot_toolchain.gni +++ b/gni/snapshot_toolchain.gni @@ -65,15 +65,21 @@ if (v8_snapshot_toolchain == "") { # therefore snapshots will need to be built using native mksnapshot # in combination with qemu v8_snapshot_toolchain = current_toolchain + } else if (host_cpu == current_cpu) { + # Cross-build from same ISA on one OS to another. For example: + # * targeting win/x64 on a linux/x64 host + # * targeting win/arm64 on a mac/arm64 host + v8_snapshot_toolchain = host_toolchain } else if (host_cpu == "arm64" && current_cpu == "x64") { # Cross-build from arm64 to intel (likely on an Apple Silicon mac). v8_snapshot_toolchain = "//build/toolchain/${host_os}:clang_arm64_v8_$v8_current_cpu" } else if (host_cpu == "x64") { # This is a cross-compile from an x64 host to either a non-Intel target - # cpu or a different target OS. + # cpu or to 32-bit x86 on a different target OS. - if (v8_current_cpu == "x64" || v8_current_cpu == "x86") { + assert(v8_current_cpu != "x64", "handled by host_cpu == current_cpu branch") + if (v8_current_cpu == "x86") { _cpus = v8_current_cpu } else if (v8_current_cpu == "arm64" || v8_current_cpu == "mips64el" || v8_current_cpu == "riscv64" || v8_current_cpu == "loong64") {