Skip to content

Commit c6251c9

Browse files
authored
Rollup merge of rust-lang#102215 - alexcrichton:wasm-link-whole-archive, r=estebank
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.
2 parents 37c5efa + 6630c14 commit c6251c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1260,11 +1260,11 @@ impl<'a> Linker for WasmLd<'a> {
12601260
}
12611261

12621262
fn link_whole_staticlib(&mut self, lib: &str, _verbatim: bool, _search_path: &[PathBuf]) {
1263-
self.cmd.arg("-l").arg(lib);
1263+
self.cmd.arg("--whole-archive").arg("-l").arg(lib).arg("--no-whole-archive");
12641264
}
12651265

12661266
fn link_whole_rlib(&mut self, lib: &Path) {
1267-
self.cmd.arg(lib);
1267+
self.cmd.arg("--whole-archive").arg(lib).arg("--no-whole-archive");
12681268
}
12691269

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

0 commit comments

Comments
 (0)