mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-08 03:30:22 +00:00
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
This commit is contained in:
parent
004e19e38d
commit
e5cea5eb89
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user