diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp --- a/llvm/lib/Linker/LinkModules.cpp +++ b/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