diff options
author | Chris Lattner <sabre@nondot.org> | 2005-02-13 17:42:11 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-02-13 17:42:11 +0000 |
commit | 1b9f9c5f67027011e8c8f376871197401bd40c84 (patch) | |
tree | e4e88018c57ce5a08717a1587a848e79e2ffde02 /llvm/lib/Bytecode | |
parent | 38a3ba0234caea30aa8b552b44f94b986c6981c5 (diff) | |
download | bcm5719-llvm-1b9f9c5f67027011e8c8f376871197401bd40c84.tar.gz bcm5719-llvm-1b9f9c5f67027011e8c8f376871197401bd40c84.zip |
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.
llvm-svn: 20151
Diffstat (limited to 'llvm/lib/Bytecode')
-rw-r--r-- | llvm/lib/Bytecode/Reader/ReaderWrappers.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp b/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp index 9b8491327fa..ce54b7a4e25 100644 --- a/llvm/lib/Bytecode/Reader/ReaderWrappers.cpp +++ b/llvm/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 |