From 291c110dd49fa9fe82e9f9bb66db4d18a5125ee7 Mon Sep 17 00:00:00 2001 From: Emiliano Maldonado Garza <68057133+Wilovy09@users.noreply.github.com> Date: Thu, 2 Apr 2026 18:39:10 -0600 Subject: [PATCH] fix(lld): use `-B` flag (#5443) --- packages/cli/src/build/request.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/build/request.rs b/packages/cli/src/build/request.rs index 1959818ed..99c9a65f3 100644 --- a/packages/cli/src/build/request.rs +++ b/packages/cli/src/build/request.rs @@ -2704,8 +2704,12 @@ impl BuildRequest { // Preserve the original args. We only preserve: // -L - // -arch // -lxyz + // -m (arch/emulation) + // -B (gcc program search path — Rust 1.86+ injects -B/gcc-ld + -fuse-ld=lld + // so that cc picks up the bundled lld; we must forward it for the patch + // linker invocation too, otherwise cc falls back to the system `ld`) + // -fuse-ld (linker selection) // There might be more, but some flags might break our setup. for (idx, arg) in original_args.iter().enumerate() { if *arg == "-L" { @@ -2718,6 +2722,7 @@ impl BuildRequest { || arg.starts_with("-Wl,--target=") || arg.starts_with("-Wl,-fuse-ld") || arg.starts_with("-fuse-ld") + || arg.starts_with("-B") || arg.contains("-ld-path") { out_args.push(arg.to_string());