Skip to content

Commit 2895c22

Browse files
committed
fix(lld): use -B flag
1 parent 45442af commit 2895c22

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/cli/src/build/request.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2704,8 +2704,12 @@ impl BuildRequest {
27042704

27052705
// Preserve the original args. We only preserve:
27062706
// -L <path>
2707-
// -arch
27082707
// -lxyz
2708+
// -m (arch/emulation)
2709+
// -B<path> (gcc program search path — Rust 1.86+ injects -B/gcc-ld + -fuse-ld=lld
2710+
// so that cc picks up the bundled lld; we must forward it for the patch
2711+
// linker invocation too, otherwise cc falls back to the system `ld`)
2712+
// -fuse-ld (linker selection)
27092713
// There might be more, but some flags might break our setup.
27102714
for (idx, arg) in original_args.iter().enumerate() {
27112715
if *arg == "-L" {
@@ -2718,6 +2722,7 @@ impl BuildRequest {
27182722
|| arg.starts_with("-Wl,--target=")
27192723
|| arg.starts_with("-Wl,-fuse-ld")
27202724
|| arg.starts_with("-fuse-ld")
2725+
|| arg.starts_with("-B")
27212726
|| arg.contains("-ld-path")
27222727
{
27232728
out_args.push(arg.to_string());

0 commit comments

Comments
 (0)