From d565b20ab93cd6d84e2e50005e5759796be72381 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Mon, 20 Jun 2022 10:39:15 -0700 Subject: [PATCH] Emscripten: Drop -lc the emcc driver will add it when it is needed 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) https://github.com/emscripten-core/emscripten/issues/17191#issuecomment-1151607689 --- compiler/rustc_codegen_ssa/src/back/linker.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index ee097b5f05199..0f56d7bfa8501 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -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); }