Lines Matching +full:include +full:- +full:hidden +full:- +full:files
1 //===- llvm-link.cpp - Low-level LLVM linker ------------------------------===//
8 //===----------------------------------------------------------------------===//
11 // llvm-link a.bc b.bc c.bc -o x.bc
13 //===----------------------------------------------------------------------===//
15 #include "llvm/ADT/STLExtras.h"
16 #include "llvm/Bitcode/ReaderWriter.h"
17 #include "llvm/IR/AutoUpgrade.h"
18 #include "llvm/IR/DiagnosticInfo.h"
19 #include "llvm/IR/DiagnosticPrinter.h"
20 #include "llvm/IR/LLVMContext.h"
21 #include "llvm/IR/Module.h"
22 #include "llvm/IR/ModuleSummaryIndex.h"
23 #include "llvm/IR/Verifier.h"
24 #include "llvm/IRReader/IRReader.h"
25 #include "llvm/Linker/Linker.h"
26 #include "llvm/Object/ModuleSummaryIndexObjectFile.h"
27 #include "llvm/Support/CommandLine.h"
28 #include "llvm/Support/FileSystem.h"
29 #include "llvm/Support/ManagedStatic.h"
30 #include "llvm/Support/Path.h"
31 #include "llvm/Support/PrettyStackTrace.h"
32 #include "llvm/Support/Signals.h"
33 #include "llvm/Support/SourceMgr.h"
34 #include "llvm/Support/SystemUtils.h"
35 #include "llvm/Support/ToolOutputFile.h"
36 #include "llvm/Transforms/Utils/FunctionImportUtils.h"
38 #include <memory>
39 #include <utility>
44 cl::desc("<input bitcode files>"));
52 // llvm-link to simulate ThinLTO backend processes.
59 // must be specified in the case were we request imports via the -import
61 // exported (imported by a different llvm-link -import invocation), to ensure
64 SummaryIndex("summary-index", cl::desc("Module summary index filename"),
68 OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
75 DisableDITypeMap("disable-debug-info-type-map",
79 OnlyNeeded("only-needed", cl::desc("Link only needed symbols"));
86 cl::desc("Write output as LLVM assembly"), cl::Hidden);
92 DumpAsm("d", cl::desc("Print assembly as linked"), cl::Hidden);
95 SuppressWarnings("suppress-warnings", cl::desc("Suppress all linking warnings"),
99 "preserve-bc-uselistorder",
100 cl::desc("Preserve use-list order when writing LLVM bitcode."),
101 cl::init(true), cl::Hidden);
104 "preserve-ll-uselistorder",
105 cl::desc("Preserve use-list order when writing LLVM assembly."),
106 cl::init(false), cl::Hidden);
125 Result->materializeMetadata(); in loadFile()
158 std::unique_ptr<Module> Ret = std::move(I->second); in takeModule()
199 /// Import any functions requested via the -import option.
213 // Map of Module -> List of globals to import from the Module in importFunctions()
241 errs() << "Ignoring import request for non-existent function " in importFunctions()
248 if (F->hasWeakAnyLinkage()) { in importFunctions()
249 errs() << "Ignoring import request for weak-any function " << FunctionName in importFunctions()
260 F->materialize(); in importFunctions()
269 assert(&Context == &SrcModule->getContext() && "Context mismatch"); in importFunctions()
273 SrcModule->materializeMetadata(); in importFunctions()
291 const cl::list<std::string> &Files, in linkFiles() argument
295 for (const auto &File : Files) { in linkFiles()
302 // Note that when ODR merging types cannot verify input files in here When in linkFiles()
332 // All linker flags apply to linking of subsequent files. in linkFiles()
353 auto Composite = make_unique<Module>("llvm-link", Context); in main()
362 // First add all the regular input files in main()
366 // Next the -override ones. in main()
371 // Import any functions requested via -import in main()
391 Composite->print(Out.os(), nullptr, PreserveAssemblyUseListOrder); in main()