Skip to content

Commit 6630c14

Browse files
committed
Implement the +whole-archive modifier for wasm-ld
This implements the `Linker::{link_whole_staticlib,link_whole_rlib}` methods for the `WasmLd` linker used on wasm targets. Previously these methods were noops since I think historically `wasm-ld` did not have support for `--whole-archive` but nowadays it does, so the flags are passed through.
1 parent 8ab71ab commit 6630c14

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,11 +1265,11 @@ impl<'a> Linker for WasmLd<'a> {
12651265
}
12661266

12671267
fn link_whole_staticlib(&mut self, lib: &str, _verbatim: bool, _search_path: &[PathBuf]) {
1268-
self.cmd.arg("-l").arg(lib);
1268+
self.cmd.arg("--whole-archive").arg("-l").arg(lib).arg("--no-whole-archive");
12691269
}
12701270

12711271
fn link_whole_rlib(&mut self, lib: &Path) {
1272-
self.cmd.arg(lib);
1272+
self.cmd.arg("--whole-archive").arg(lib).arg("--no-whole-archive");
12731273
}
12741274

12751275
fn gc_sections(&mut self, _keep_metadata: bool) {

0 commit comments

Comments
 (0)