aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-lto/llvm-lto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-lto/llvm-lto.cpp')
-rw-r--r--tools/llvm-lto/llvm-lto.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/llvm-lto/llvm-lto.cpp b/tools/llvm-lto/llvm-lto.cpp
index ab1e162..3ecd13f 100644
--- a/tools/llvm-lto/llvm-lto.cpp
+++ b/tools/llvm-lto/llvm-lto.cpp
@@ -45,6 +45,12 @@ OutputFilename("o", cl::init(""),
cl::desc("Override output filename"),
cl::value_desc("filename"));
+static cl::list<std::string>
+ExportedSymbols("exported-symbol",
+ cl::desc("Symbol to export from the resulting object file"),
+ cl::ZeroOrMore);
+
+
int main(int argc, char **argv) {
// Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
@@ -107,6 +113,10 @@ int main(int argc, char **argv) {
}
}
+ // Add all the exported symbols to the table of symbols to preserve.
+ for (unsigned i = 0; i < ExportedSymbols.size(); ++i)
+ CodeGen.addMustPreserveSymbol(ExportedSymbols[i].c_str());
+
if (!OutputFilename.empty()) {
size_t len = 0;
std::string ErrorInfo;