Skip to content

Commit

Permalink
Rollup merge of rust-lang#102215 - alexcrichton:wasm-link-whole-archi…
Browse files Browse the repository at this point in the history
…ve, 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.
  • Loading branch information
Manishearth committed Nov 11, 2022
2 parents 37c5efa + 6630c14 commit c6251c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1260,11 +1260,11 @@ impl<'a> Linker for WasmLd<'a> {
}

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

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

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

0 comments on commit c6251c9

Please sign in to comment.