summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-lto
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-03 18:29:09 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-03 18:29:09 +0000
commitcda2911caaf64f11905dcc0757a1b291943bbe9a (patch)
tree479d25f058fde301d3cbf8a362335a011fd66585 /llvm/tools/llvm-lto
parent3d78fe8fa02e75c4416b36c5537fdff614fee040 (diff)
downloadbcm5719-llvm-cda2911caaf64f11905dcc0757a1b291943bbe9a.tar.gz
bcm5719-llvm-cda2911caaf64f11905dcc0757a1b291943bbe9a.zip
Optimize linkonce_odr unnamed_addr functions during LTO.
Generalize the API so we can distinguish symbols that are needed just for a DSO symbol table from those that are used from some native .o. The symbols that are only wanted for the dso symbol table can be dropped if llvm can prove every other dso has a copy (linkonce_odr) and the address is not important (unnamed_addr). llvm-svn: 191922
Diffstat (limited to 'llvm/tools/llvm-lto')
-rw-r--r--llvm/tools/llvm-lto/llvm-lto.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index 3ecd13f5c71..1d03fa62a87 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -50,6 +50,10 @@ ExportedSymbols("exported-symbol",
cl::desc("Symbol to export from the resulting object file"),
cl::ZeroOrMore);
+static cl::list<std::string>
+DSOSymbols("dso-symbol",
+ cl::desc("Symbol to put in the symtab in the resulting dso"),
+ cl::ZeroOrMore);
int main(int argc, char **argv) {
// Print a stack trace if we signal out.
@@ -117,6 +121,10 @@ int main(int argc, char **argv) {
for (unsigned i = 0; i < ExportedSymbols.size(); ++i)
CodeGen.addMustPreserveSymbol(ExportedSymbols[i].c_str());
+ // Add all the dso symbols to the table of symbols to expose.
+ for (unsigned i = 0; i < DSOSymbols.size(); ++i)
+ CodeGen.addDSOSymbol(DSOSymbols[i].c_str());
+
if (!OutputFilename.empty()) {
size_t len = 0;
std::string ErrorInfo;
OpenPOWER on IntegriCloud