From bda3c97c16916c6a0b94b01f59acbc98b845e7b6 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 21 Apr 2016 01:59:39 +0000 Subject: ThinLTO/ModuleLinker: add a flag to not always pull-in linkonce when performing importing Summary: The function importer already decided what symbols need to be pulled in. Also these magically added ones will not be in the export list for the source module, which can confuse the internalizer for instance. Reviewers: tejohnson, rafael Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D19096 From: Mehdi Amini llvm-svn: 266948 --- llvm/tools/llvm-link/llvm-link.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'llvm/tools') diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp index 73ac8727e71..0e720bd06ea 100644 --- a/llvm/tools/llvm-link/llvm-link.cpp +++ b/llvm/tools/llvm-link/llvm-link.cpp @@ -276,8 +276,10 @@ static bool importFunctions(const char *argv0, LLVMContext &Context, if (renameModuleForThinLTO(*SrcModule, *Index, &GlobalsToImport)) return true; - if (L.linkInModule(std::move(SrcModule), Linker::Flags::None, - &GlobalsToImport)) + // Instruct the linker to not automatically import linkonce defintion. + unsigned Flags = Linker::Flags::DontForceLinkLinkonceODR; + + if (L.linkInModule(std::move(SrcModule), Flags, &GlobalsToImport)) return false; } -- cgit v1.2.3