diff options
| author | Martin Storsjö <martin@martin.st> | 2019-12-17 00:20:32 +0200 |
|---|---|---|
| committer | Martin Storsjö <martin@martin.st> | 2020-01-13 23:36:26 +0200 |
| commit | 810b28edb3f64569054d49d6ddf18a4d802d9b11 (patch) | |
| tree | 3e6d95ead285209f15626f331e19a0f97d0c03a4 /clang/lib/CodeGen | |
| parent | 80a094e1348ae850cd996e947d70e34abf331685 (diff) | |
| download | bcm5719-llvm-810b28edb3f64569054d49d6ddf18a4d802d9b11.tar.gz bcm5719-llvm-810b28edb3f64569054d49d6ddf18a4d802d9b11.zip | |
[ItaniumCXXABI] Make tls wrappers properly comdat
Just marking a symbol as weak_odr/linkonce_odr isn't enough for
actually tolerating multiple copies of it at linking on windows,
it has to be made a proper comdat; make it comdat for all platforms
for consistency.
This should hopefully fix
https://bugzilla.mozilla.org/show_bug.cgi?id=1566288.
Differential Revision: https://reviews.llvm.org/D71572
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/ItaniumCXXABI.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index 6ed172bb107..b5b8702c551 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -2546,6 +2546,9 @@ ItaniumCXXABI::getOrCreateThreadLocalWrapper(const VarDecl *VD, llvm::Function::Create(FnTy, getThreadLocalWrapperLinkage(VD, CGM), WrapperName.str(), &CGM.getModule()); + if (CGM.supportsCOMDAT() && Wrapper->isWeakForLinker()) + Wrapper->setComdat(CGM.getModule().getOrInsertComdat(Wrapper->getName())); + CGM.SetLLVMFunctionAttributes(GlobalDecl(), FI, Wrapper); // Always resolve references to the wrapper at link time. |

