Skip to content

Commit 400e754

Browse files
committed
rustc: Don't pass -fuse-ld=lld on wasm targets
This argument isn't necessary for WebAssembly targets since `wasm-ld` is the only linker for the targets. Passing it otherwise interferes with Clang's linker selection on `wasm32-wasip2` so avoid it altogether.
1 parent 7a77108 commit 400e754

File tree

1 file changed

+7
-1
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+7
-1
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -3127,7 +3127,13 @@ fn add_lld_args(
31273127

31283128
// 2. Implement the "linker flavor" part of this feature by asking `cc` to use some kind of
31293129
// `lld` as the linker.
3130-
cmd.arg("-fuse-ld=lld");
3130+
//
3131+
// Note that wasm targets skip this step since the only option there anyway
3132+
// is to use LLD but the `wasm32-wasip2` target relies on a wrapper around
3133+
// this, `wasm-component-ld`, which is overridden if this option is passed.
3134+
if !sess.target.is_like_wasm {
3135+
cmd.arg("-fuse-ld=lld");
3136+
}
31313137

31323138
if !flavor.is_gnu() {
31333139
// Tell clang to use a non-default LLD flavor.

0 commit comments

Comments
 (0)