[PATCH] D23721: [gold/ThinLTO] Restore ThinLTO file management in gold plugin
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 19 18:32:16 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279356: [gold/ThinLTO] Restore ThinLTO file management in gold plugin (authored by tejohnson).
Changed prior to commit:
https://reviews.llvm.org/D23721?vs=68715&id=68757#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23721
Files:
llvm/trunk/test/tools/gold/X86/thinlto.ll
llvm/trunk/tools/gold/gold-plugin.cpp
Index: llvm/trunk/test/tools/gold/X86/thinlto.ll
===================================================================
--- llvm/trunk/test/tools/gold/X86/thinlto.ll
+++ llvm/trunk/test/tools/gold/X86/thinlto.ll
@@ -35,6 +35,16 @@
; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED
; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
+; Check with --no-map-whole-files
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN: --plugin-opt=save-temps \
+; RUN: --plugin-opt=thinlto \
+; RUN: --plugin-opt=jobs=1 \
+; RUN: --no-map-whole-files \
+; RUN: -shared %t.o %t2.o -o %t4
+; RUN: llvm-bcanalyzer -dump %t4.index.bc | FileCheck %s --check-prefix=COMBINED
+; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM
+
; Next force multi-threaded mode
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
; RUN: --plugin-opt=save-temps \
Index: llvm/trunk/tools/gold/gold-plugin.cpp
===================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp
+++ llvm/trunk/tools/gold/gold-plugin.cpp
@@ -818,10 +818,19 @@
if (unsigned NumOpts = options::extra.size())
cl::ParseCommandLineOptions(NumOpts, &options::extra[0]);
+ // Map to own RAII objects that manage the file opening and releasing
+ // interfaces with gold. This is needed only for ThinLTO mode, since
+ // unlike regular LTO, where addModule will result in the opened file
+ // being merged into a new combined module, we need to keep these files open
+ // through Lto->run().
+ DenseMap<void *, std::unique_ptr<PluginInputFile>> HandleToInputFile;
+
std::unique_ptr<LTO> Lto = createLTO();
for (claimed_file &F : Modules) {
- PluginInputFile InputFile(F.handle);
+ if (options::thinlto && !HandleToInputFile.count(F.leader_handle))
+ HandleToInputFile.insert(std::make_pair(
+ F.leader_handle, llvm::make_unique<PluginInputFile>(F.handle)));
const void *View = getSymbolsAndView(F);
if (!View)
continue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23721.68757.patch
Type: text/x-patch
Size: 2014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160820/aab50cd1/attachment.bin>
More information about the llvm-commits
mailing list