[PATCH] D71572: [ItaniumCXXABI] Use linkonce_odr instead of weak_odr for tls wrappers on Windows

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 16 18:54:26 PST 2019


rsmith added inline comments.


================
Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:2522
+  if (CGM.getTriple().isOSWindows())
+    return llvm::GlobalValue::LinkOnceODRLinkage;
   return llvm::GlobalValue::WeakODRLinkage;
----------------
I think the thread wrapper should probably be `linkonce_odr` across all platforms, at least in all TUs that don't contain a definition of the variable. Every such TU is supposed to provide its own copy regardless, so making it non-discardable seems to serve no purpose.

That said, I suspect this is only hiding the real problem (by discarding the symbol before it creates a link error), and you'd still get link errors if you have two TUs that both use the same thread-local variable and happen to not inline / discard their thread wrappers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71572/new/

https://reviews.llvm.org/D71572





More information about the cfe-commits mailing list