
# HG changeset patch
# User Alex Hochheiden <ahochheiden@mozilla.com>
# Date 1775067097 0
# Node ID b1b4f0d7ed12d2cd69458dcb397e7d0f831132c3
# Parent  08de9efb7b91622dc9ca07bcaa9a033e19cdd24d
Bug 2023597 - Use `wasm32-wasip1` target for clang >= 22.1 r=firefox-build-system-reviewers,sergesanspaille

https://github.com/llvm/llvm-project/pull/165345
https://releases.llvm.org/22.1.0/tools/clang/docs/ReleaseNotes.html

Differential Revision: https://phabricator.services.mozilla.com/D291023


diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -690,16 +690,19 @@ def check_compiler(configure_cache, comp
 
     # Check compiler target
     # --------------------------------------------------------------------
     has_target = False
     if target.os == "Android" and android_version:
         # This makes clang define __ANDROID_API__ and use versioned library
         # directories from the NDK.
         toolchain = "%s%d" % (target.toolchain, android_version)
+    elif target.kernel == "WASI" and info.type == "clang" and info.version >= Version("22.1"):
+        # The wasm32-wasi target was renamed to wasm32-wasip1 in LLVM 22.1.
+        toolchain = "wasm32-wasip1"
     else:
         toolchain = target.toolchain
 
     if info.type == "clang":
         # Add the target explicitly when the target is aarch64 macosx, because
         # the Xcode clang target is named differently, and we need to work around
         # https://github.com/rust-lang/rust-bindgen/issues/1871 and
         # https://github.com/alexcrichton/cc-rs/issues/542 so we always want

