aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-02 14:12:56 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-02 14:12:56 +0000
commitb964366a9a282dee620651611c97c80311b11a8b (patch)
tree0e59c24be9d23a6da2a5fe08c4a22f2bb70d6a36 /tools
parent86b4f1a96fc1bc8890398d20b0153b7d434b835c (diff)
downloadexternal_llvm-b964366a9a282dee620651611c97c80311b11a8b.zip
external_llvm-b964366a9a282dee620651611c97c80311b11a8b.tar.gz
external_llvm-b964366a9a282dee620651611c97c80311b11a8b.tar.bz2
Add a -exported-symbol option to llvm-lto.
Patch by Tom Roeder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191825 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-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;