# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/chromium/hotfix-cross-host-toolchains.patch # Copyright (C) 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- --- chromium-151.0.7922.75/build/toolchain/linux/unbundle/BUILD.gn.vanilla +++ chromium-151.0.7922.75/build/toolchain/linux/unbundle/BUILD.gn @@ -35,7 +35,7 @@ extra_ldflags = getenv("BUILD_LDFLAGS") toolchain_args = { - current_cpu = current_cpu - current_os = current_os + current_cpu = host_cpu + current_os = host_os } } --- chromium-151.0.7922.75/build/toolchain/gcc_toolchain.gni.vanilla +++ chromium-151.0.7922.75/build/toolchain/gcc_toolchain.gni @@ -1004,7 +1004,11 @@ # actually just be doing a native compile. template("clang_toolchain") { gcc_toolchain(target_name) { - _path = "$clang_base_path/bin" + _t2_clang_base_path = clang_base_path + if (t2_build_clang_base_path != "") { + _t2_clang_base_path = t2_build_clang_base_path + } + _path = "$_t2_clang_base_path/bin" _is_path_absolute = get_path_info(_path, "abspath") == _path # Preserve absolute paths for tools like distcc. --- chromium-151.0.7922.75/build/toolchain/linux/BUILD.gn.vanilla +++ chromium-151.0.7922.75/build/toolchain/linux/BUILD.gn @@ -151,6 +151,20 @@ } } +clang_v8_toolchain("clang_arm64_v8_x64") { + toolchain_args = { + current_cpu = "arm64" + v8_current_cpu = "x64" + } +} + +clang_v8_toolchain("clang_arm64_v8_riscv64") { + toolchain_args = { + current_cpu = "arm64" + v8_current_cpu = "riscv64" + } +} + clang_v8_toolchain("clang_x64_v8_mips64el") { toolchain_args = { current_cpu = "x64" --- chromium-151.0.7922.75/build/config/linux/pkg_config.gni.vanilla +++ chromium-151.0.7922.75/build/config/linux/pkg_config.gni @@ -119,7 +119,7 @@ assert(defined(invoker.packages), "Variable |packages| must be defined to be a list in pkg_config.") config(target_name) { - if (current_toolchain == host_toolchain) { + if (current_toolchain == host_toolchain || current_cpu != target_cpu) { _cache_args = host_pkg_config_args + invoker.packages } else { _cache_args = pkg_config_args + invoker.packages --- chromium-151.0.7922.75/v8/gni/snapshot_toolchain.gni.vanilla +++ chromium-151.0.7922.75/v8/gni/snapshot_toolchain.gni @@ -70,6 +70,10 @@ # * 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" && v8_current_cpu == "riscv64") { + # Cross-build from an arm64 host to riscv64. + v8_snapshot_toolchain = + "//build/toolchain/${host_os}:clang_arm64_v8_$v8_current_cpu" } else if (host_cpu == "arm64" && current_cpu == "x64") { # Cross-build from arm64 to intel (likely on an Apple Silicon mac). v8_snapshot_toolchain =