summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/tools/llvm-lto/llvm-lto.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index 3a9ff812e42..395988c0ebf 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -101,6 +101,11 @@ static cl::opt<std::string>
cl::desc("Provide the index produced by a ThinLink, required "
"to perform the promotion and/or importing."));
+static cl::opt<std::string> ThinLTOModuleId(
+ "thinlto-module-id",
+ cl::desc("For the module ID for the file to process, useful to "
+ "match what is in the index."));
+
static cl::opt<bool>
SaveModuleFile("save-merged-module", cl::init(false),
cl::desc("Write merged LTO module to file before CodeGen"));
@@ -318,6 +323,12 @@ static std::unique_ptr<Module> loadModule(StringRef Filename,
report_fatal_error("Can't load module for file " + Filename);
}
maybeVerifyModule(*M);
+
+ if (ThinLTOModuleId.getNumOccurrences()) {
+ if (InputFilenames.size() != 1)
+ report_fatal_error("Can't override the module id for multiple files");
+ M->setModuleIdentifier(ThinLTOModuleId);
+ }
return M;
}
OpenPOWER on IntegriCloud