From cda2911caaf64f11905dcc0757a1b291943bbe9a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 3 Oct 2013 18:29:09 +0000 Subject: 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 --- llvm/tools/llvm-lto/llvm-lto.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'llvm/tools/llvm-lto') 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 +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; -- cgit v1.2.3