aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-link/llvm-link.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-link/llvm-link.cpp')
-rw-r--r--llvm/tools/llvm-link/llvm-link.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index 1ada60e..8d29caf 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -70,6 +70,11 @@ static cl::opt<std::string>
OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
cl::value_desc("filename"));
+static cl::opt<std::string>
+ InitialModule("initial-module",
+ cl::desc("Link to existing destination module"), cl::init(""),
+ cl::value_desc("filename"));
+
static cl::opt<bool>
Internalize("internalize", cl::desc("Internalize linked symbols"));
@@ -360,7 +365,9 @@ int main(int argc, char **argv) {
if (!DisableDITypeMap)
Context.enableDebugTypeODRUniquing();
- auto Composite = make_unique<Module>("llvm-link", Context);
+ auto Composite = InitialModule.empty()
+ ? make_unique<Module>("llvm-link", Context)
+ : loadFile(argv[0], InitialModule, Context);
Linker L(*Composite);
unsigned Flags = Linker::Flags::None;