summaryrefslogtreecommitdiff
path: root/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-13 17:42:11 +0000
committerChris Lattner <sabre@nondot.org>2005-02-13 17:42:11 +0000
commite5cea5eb89c9e96e8c8f5318c393d573ac8662bc (patch)
treeef869ebd4873a2c9777dc1d9906fefa7459f2f7a /lib/Bytecode
parent004e19e38d810c3146c77b68a9274210ee008b1d (diff)
downloadllvm-e5cea5eb89c9e96e8c8f5318c393d573ac8662bc.tar.gz
llvm-e5cea5eb89c9e96e8c8f5318c393d573ac8662bc.tar.bz2
llvm-e5cea5eb89c9e96e8c8f5318c393d573ac8662bc.tar.xz
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
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Reader/ReaderWrappers.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/lib/Bytecode/Reader/ReaderWrappers.cpp b/lib/Bytecode/Reader/ReaderWrappers.cpp
index 9b8491327f..ce54b7a4e2 100644
--- a/lib/Bytecode/Reader/ReaderWrappers.cpp
+++ b/lib/Bytecode/Reader/ReaderWrappers.cpp
@@ -328,28 +328,18 @@ bool llvm::GetBytecodeDependentLibraries(const std::string &fname,
}
}
-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);
- }
- }
- }
-
- //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);
- }
- }
- }
-}
+ 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() && !FI->hasInternalLinkage())
+ if (!FI->getName().empty())
+ symbols.push_back(FI->getName());
}
// Get just the externally visible defined symbols from the bytecode