Commit 709bd4f74a3 for nodejs

commit 709bd4f74a36b4902c70110c0e13ec78311053a5
Author: Chengzhong Wu <legendecas@gmail.com>
Date:   Wed Nov 18 09:50:43 2026 -0500

    tools: link Rust backtrace crates in make-v8.sh

    Chromium's build no longer lists the Rust std backtrace crates in
    `stdlib_files`, because its own std is built without backtrace support.
    The system Rust toolchain used by `make-v8.sh` ships a std built with
    it, so linking mksnapshot fails with undefined `gimli` and `addr2line`
    symbols. Pass the crates through `added_rust_stdlib_libs`, which
    replaces the libadler patch of `build/rust/std/BUILD.gn`.

    Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
    PR-URL: https://github.com/nodejs/node/pull/67070
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
    Reviewed-By: Richard Lau <richard.lau@ibm.com>
    Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

diff --git a/tools/make-v8.sh b/tools/make-v8.sh
index 3ec4a0754c2..3cc5586ab8c 100755
--- a/tools/make-v8.sh
+++ b/tools/make-v8.sh
@@ -57,16 +57,17 @@ if [ "$ARCH" = "s390x" ] || [ "$ARCH" = "ppc64le" ]; then
           -e '/-fsanitize-ignore-for-ubsan-feature/d' \
           -e '/-fdiagnostics-show-inlining-chain/d' {} \;
       fi
-      # Patch to match libadler/libadler2 based on what is present.
+      # Chromium's std is built without backtrace support, so its stdlib list
+      # leaves out the backtrace crates. The system std is built with it and
+      # needs them linked. Match libadler/libadler2 based on what is present.
       LIBADLER=$(basename "$(find "$(rustc --print sysroot)/lib/rustlib/" -type f -name "libadler*")" | cut -d '-' -f 1) || true
       case "$LIBADLER" in
-        libadler2) sed -i -e 's/"adler"/"adler2"/g' build/rust/std/BUILD.gn
-          ;;
-        libadler) sed -i -e 's/"adler2"/"adler"/g' build/rust/std/BUILD.gn
-          ;;
+        libadler2|libadler) ;;
         *) echo "Warning: unable to detect libadler/libadler2 (found ${LIBADLER})"
+          LIBADLER=libadler2
           ;;
       esac
+      GN_RUST_ARGS="${GN_RUST_ARGS} added_rust_stdlib_libs=[\"addr2line\",\"gimli\",\"miniz_oxide\",\"${LIBADLER#lib}\"]"
       ;;
     *) GN_COMPILER_OPTS="treat_warnings_as_errors=false use_custom_libcxx=false" ;;
   esac