[PATCH] CodeGen: Don't emit a thread-wrapper if we can't touch the backing variable
Richard Smith
richard at metafoo.co.uk
Thu Jun 12 16:02:47 PDT 2014
================
Comment at: lib/CodeGen/ItaniumCXXABI.cpp:1599
@@ +1598,3 @@
+ if (!isThreadLocalBackingVariableAlwaysReferenceable(VD, CGM))
+ return VD->hasDefinition() ? llvm::GlobalValue::WeakAnyLinkage
+ : llvm::GlobalValue::ExternalLinkage;
----------------
Hmm, what's the motivation for making this weak? Should it be strong if the `thread_local` variable is a strong definition?
(I'm also not completely sure whether `WeakAny` or `WeakODR` is appropriate for the case where the variable *is* weak; I *think* the intent is for the underlying mechanism to be replaceable, which implies using `WeakAny`.)
================
Comment at: test/CodeGenCXX/tls-init-funcs.cpp:6-7
@@ -5,2 +5,4 @@
+// CHECK: call {{.*}} @_ZTW3ext()
+// CHECK: declare hidden {{.*}} @_ZTW3ext()
// CHECK: define weak hidden {{.*}} @_ZTW1a
----------------
Why are these marked as `hidden`? Don't they need to be visible to support cross-DSO linking of `thread_local` variables?
http://reviews.llvm.org/D4109
More information about the cfe-commits
mailing list