Do not put internal symbols into the symbol table.  This shrinks the symbol
table for archives in common cases, and prevents trying to resolve a
external reference with an internal reference.  This shrinks the libpython.a
symbol table from 126302 to 19770 bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20151 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Bytecode/Reader/ReaderWrappers.cpp b/lib/Bytecode/Reader/ReaderWrappers.cpp
index 9b84913..ce54b7a 100644
--- a/lib/Bytecode/Reader/ReaderWrappers.cpp
+++ b/lib/Bytecode/Reader/ReaderWrappers.cpp
@@ -328,28 +328,18 @@
   }
 }
 
-namespace {
-void getSymbols(Module*M, std::vector<std::string>& symbols) {
+static void getSymbols(Module*M, std::vector<std::string>& symbols) {
   // Loop over global variables
-  for (Module::giterator GI = M->gbegin(), GE=M->gend(); GI != GE; ++GI) {
-    if (GI->hasInitializer()) {
-      std::string name ( GI->getName() );
-      if (!name.empty()) {
-        symbols.push_back(name);
-      }
-    }
-  }
+  for (Module::giterator GI = M->gbegin(), GE=M->gend(); GI != GE; ++GI)
+    if (GI->hasInitializer() && !GI->hasInternalLinkage())
+      if (!GI->getName().empty())
+        symbols.push_back(GI->getName());
 
-  //Loop over functions
-  for (Module::iterator FI = M->begin(), FE=M->end(); FI != FE; ++FI) {
-    if (!FI->isExternal()) {
-      std::string name ( FI->getName() );
-      if (!name.empty()) {
-        symbols.push_back(name);
-      }
-    }
-  }
-}
+  // Loop over functions.
+  for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI)
+    if (!FI->isExternal() && !FI->hasInternalLinkage())
+      if (!FI->getName().empty())
+        symbols.push_back(FI->getName());
 }
 
 // Get just the externally visible defined symbols from the bytecode