mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Don't special case undefined symbol when deciding the symbol order.
ELF has no restrictions on where undefined symbols go relative to other defined symbols. In fact, gas just sorts them together. Do the same. This was there since r111174 probably just because the MachO writer has it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238513 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -805,7 +805,6 @@ void ELFObjectWriter::computeSymbolTable(
|
||||
|
||||
std::vector<ELFSymbolData> LocalSymbolData;
|
||||
std::vector<ELFSymbolData> ExternalSymbolData;
|
||||
std::vector<ELFSymbolData> UndefinedSymbolData;
|
||||
|
||||
// Add the data for the symbols.
|
||||
bool HasLargeSectionIndex = false;
|
||||
@@ -902,7 +901,7 @@ void ELFObjectWriter::computeSymbolTable(
|
||||
MSD.Name = StrTabBuilder.add(Name);
|
||||
|
||||
if (MSD.SectionIndex == ELF::SHN_UNDEF)
|
||||
UndefinedSymbolData.push_back(MSD);
|
||||
ExternalSymbolData.push_back(MSD);
|
||||
else if (Local)
|
||||
LocalSymbolData.push_back(MSD);
|
||||
else
|
||||
@@ -930,7 +929,6 @@ void ELFObjectWriter::computeSymbolTable(
|
||||
// Symbols are required to be in lexicographic order.
|
||||
array_pod_sort(LocalSymbolData.begin(), LocalSymbolData.end());
|
||||
array_pod_sort(ExternalSymbolData.begin(), ExternalSymbolData.end());
|
||||
array_pod_sort(UndefinedSymbolData.begin(), UndefinedSymbolData.end());
|
||||
|
||||
// Set the symbol indices. Local symbols must come before all other
|
||||
// symbols with non-local bindings.
|
||||
@@ -954,12 +952,6 @@ void ELFObjectWriter::computeSymbolTable(
|
||||
writeSymbol(Writer, StringIndex, MSD, Layout);
|
||||
assert(MCELF::GetBinding(MSD.Symbol->getData()) != ELF::STB_LOCAL);
|
||||
}
|
||||
for (ELFSymbolData &MSD : UndefinedSymbolData) {
|
||||
unsigned StringIndex = StrTabBuilder.getOffset(MSD.Name);
|
||||
MSD.Symbol->setIndex(Index++);
|
||||
writeSymbol(Writer, StringIndex, MSD, Layout);
|
||||
assert(MCELF::GetBinding(MSD.Symbol->getData()) != ELF::STB_LOCAL);
|
||||
}
|
||||
|
||||
uint64_t SecEnd = OS.tell();
|
||||
SectionOffsets[SymtabSection] = std::make_pair(SecStart, SecEnd);
|
||||
|
Reference in New Issue
Block a user