Skip to content

Commit

Permalink
Emscripten: Drop -lc the emcc driver will add it when it is needed
Browse files Browse the repository at this point in the history
According to sbc100, when linking with emcc we shouldn't pass -lc:

> your best bet is to remove any/all explicit additions of -lc, since
> the compiler driver (emcc) will add it if/when its needed.
> (I don't think this is an emscripten bug BTW, but a rustc driver bug)

emscripten-core/emscripten#17191 (comment)
  • Loading branch information
hoodmane committed Jun 20, 2022
1 parent 8e430bf commit d565b20
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,10 @@ impl<'a> Linker for EmLinker<'a> {
}

fn link_staticlib(&mut self, lib: Symbol, _verbatim: bool) {
// remove -lc: the compiler driver emcc will add it if its needed.
if lib.as_str() == "c" {
return;
}
self.cmd.arg("-l").sym_arg(lib);
}

Expand Down

0 comments on commit d565b20

Please sign in to comment.