[llvm-commits] [llvm] r105389 - /llvm/trunk/tools/gold/gold-plugin.cpp

Rafael Espindola rafael.espindola at gmail.com
Thu Jun 3 07:45:44 PDT 2010


Author: rafael
Date: Thu Jun  3 09:45:44 2010
New Revision: 105389

URL: http://llvm.org/viewvc/llvm-project?rev=105389&view=rev
Log:
Don't preserve all symbols in a .so and instead trust gold to know what is
needed. The result is that now we are able to drop unnecessary symbol from
shared libraries.

Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=105389&r1=105388&r2=105389&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Jun  3 09:45:44 2010
@@ -343,19 +343,17 @@
 
   // If we don't preserve any symbols, libLTO will assume that all symbols are
   // needed. Keep all symbols unless we're producing a final executable.
-  if (output_type == LTO_CODEGEN_PIC_MODEL_STATIC) {
-    bool anySymbolsPreserved = false;
-    for (std::list<claimed_file>::iterator I = Modules.begin(),
+  bool anySymbolsPreserved = false;
+  for (std::list<claimed_file>::iterator I = Modules.begin(),
          E = Modules.end(); I != E; ++I) {
-      (*get_symbols)(I->handle, I->syms.size(), &I->syms[0]);
-      for (unsigned i = 0, e = I->syms.size(); i != e; i++) {
-        if (I->syms[i].resolution == LDPR_PREVAILING_DEF) {
-          lto_codegen_add_must_preserve_symbol(cg, I->syms[i].name);
-          anySymbolsPreserved = true;
-
-          if (options::generate_api_file)
-            api_file << I->syms[i].name << "\n";
-        }
+    (*get_symbols)(I->handle, I->syms.size(), &I->syms[0]);
+    for (unsigned i = 0, e = I->syms.size(); i != e; i++) {
+      if (I->syms[i].resolution == LDPR_PREVAILING_DEF) {
+        lto_codegen_add_must_preserve_symbol(cg, I->syms[i].name);
+        anySymbolsPreserved = true;
+
+        if (options::generate_api_file)
+          api_file << I->syms[i].name << "\n";
       }
     }
 





More information about the llvm-commits mailing list