[PATCH] D77248: [llvm][IR] Add dso_local_equivalent Constant

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 14:21:48 PST 2020


leonardchan added inline comments.


================
Comment at: llvm/lib/CodeGen/DSOLocalEquivalentLowering.cpp:36
+    // Propagate function attributes.
+    Stub = Function::Create(F->getFunctionType(), F->getLinkage(), StubName, M);
+    Stub->setAttributes(F->getAttributes());
----------------
MaskRay wrote:
> I think the stub should be InternalLinkage (if you want to retain a symbol) or PrivateLinkage (if you don't want a symbol). You would not need hidden visibility below.
> 
> If you use a hidden function, and two translation units have dso_local declarations of the same function, the produced stubs will cause a duplicate definition error at link time.
Hmm. I'm guessing the link error would only occur though if comdats weren't supported? In that case I think perhaps the stubs should be internal/private to avoid multiple definitions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77248



More information about the llvm-commits mailing list