[PATCH] D137360: [Linker] Remove nocallback attribute while linking
Gulfem Savrun Yeniceri via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 3 14:25:56 PDT 2022
gulfem created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
gulfem requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
GCC's leaf attribute is lowered to LLVM IR nocallback attribute.
Clang conservatively treats this function attribute as a hint on the
module level, and removes it while linking modules. More context can
be found in https://reviews.llvm.org/D131628.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137360
Files:
llvm/lib/Linker/LinkModules.cpp
Index: llvm/lib/Linker/LinkModules.cpp
===================================================================
--- llvm/lib/Linker/LinkModules.cpp
+++ llvm/lib/Linker/LinkModules.cpp
@@ -527,6 +527,12 @@
if (linkIfNeeded(GI, GVToClone))
return true;
+ // Since nocallback function attribute is treated as a hint on
+ // the module level, it is removed while linking modules.
+ for (Function &SF : *SrcM)
+ if (SF.isDeclaration() && SF.hasFnAttribute(llvm::Attribute::NoCallback))
+ SF.removeFnAttr(llvm::Attribute::NoCallback);
+
// For a variable in a comdat nodeduplicate, its initializer should be
// preserved (its content may be implicitly used by other members) even if
// symbol resolution does not pick it. Clone it into an unnamed private
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137360.473034.patch
Type: text/x-patch
Size: 778 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221103/dd081742/attachment.bin>
More information about the llvm-commits
mailing list