nickdesaulniers added a comment. With Diff 376790
inline __attribute__((__always_inline__)) __attribute__((gnu_inline)) void* memcpy() {} `clang -O2` is producing undefined references to `memcpy.inline`. Please add that to the new unit tests added here. diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index a8ae5f5fc0de..132834516473 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1303,7 +1303,7 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, llvm::Module *M = Fn->getParent(); llvm::Function *Clone = M->getFunction(FDInlineName); if (!Clone) { - Clone = llvm::Function::Create(Fn->getFunctionType(), Fn->getLinkage(), + Clone = llvm::Function::Create(Fn->getFunctionType(), llvm::GlobalValue::AvailableExternallyLinkage, Fn->getAddressSpace(), FDInlineName, M); Clone->addFnAttr(llvm::Attribute::AlwaysInline); } fixes that, but I don't think that's the right visibility. 00000000000002a0 T memcpy.inline should be `t` not `T` I think? Because now the failure looks like ld.lld: error: duplicate symbol: memcpy.inline >>> defined at file.c >>> fs/efivarfs/file.o:(memcpy.inline) >>> defined at super.c >>> fs/efivarfs/super.o:(.text+0x800) Perhaps `llvm::GlobalValue::InternalLinkage`? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111009/new/ https://reviews.llvm.org/D111009 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits