mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-18 06:38:41 +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 {
|
static void getSymbols(Module*M, std::vector<std::string>& symbols) {
|
||||||
void getSymbols(Module*M, std::vector<std::string>& symbols) {
|
|
||||||
// Loop over global variables
|
// Loop over global variables
|
||||||
for (Module::giterator GI = M->gbegin(), GE=M->gend(); GI != GE; ++GI) {
|
for (Module::giterator GI = M->gbegin(), GE=M->gend(); GI != GE; ++GI)
|
||||||
if (GI->hasInitializer()) {
|
if (GI->hasInitializer() && !GI->hasInternalLinkage())
|
||||||
std::string name ( GI->getName() );
|
if (!GI->getName().empty())
|
||||||
if (!name.empty()) {
|
symbols.push_back(GI->getName());
|
||||||
symbols.push_back(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Loop over functions
|
// Loop over functions.
|
||||||
for (Module::iterator FI = M->begin(), FE=M->end(); FI != FE; ++FI) {
|
for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI)
|
||||||
if (!FI->isExternal()) {
|
if (!FI->isExternal() && !FI->hasInternalLinkage())
|
||||||
std::string name ( FI->getName() );
|
if (!FI->getName().empty())
|
||||||
if (!name.empty()) {
|
symbols.push_back(FI->getName());
|
||||||
symbols.push_back(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get just the externally visible defined symbols from the bytecode
|
// Get just the externally visible defined symbols from the bytecode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user