[PATCH] D44543: [AsmPrinter] Emit .weak directive for weak linkage on COFF

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 16 16:03:35 PDT 2018


mstorsjo added a comment.

FWIW, GCC does support `__attribute__((weak))` on Windows, but with slightly different semantics than what I think it has on ELF.

With GCC, you can't have a symbol declared with `__attribute__((weak))` not be present at link time, that fails. However, you can have a local fallback function definition within a TU defined weak, which only gets linked if no other TU defines the same symbol. (IIRC I did test that lld manages to link object files with this mechanism.)


Repository:
  rL LLVM

https://reviews.llvm.org/D44543





More information about the llvm-commits mailing list