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

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 15 15:17:09 PDT 2018


rnk added a comment.

I don't think we can use LLVM linkage to mean ELF weak. According to langref, weak/weak_odr are 100% equivalent to linkonce/linkonce_odr with the exception that they are non-discardable. Based on that, we apply weak_odr linkage to wide variety of things that must be comdat deduplicated but must not be discarded. For example, if you dllexport a class with inline methods, it is weak_odr. Similarly, if you do explicit template instantiation, the result is weak_odr.

Are we sure we want MC to emulate ELF weak symbols for all these things? I'm not sure we do.

That suggests that `__attribute__((weak))` should probably be encoded into IR in some other way.


Repository:
  rL LLVM

https://reviews.llvm.org/D44543





More information about the llvm-commits mailing list