mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
MCELF: Use precomputed symbol indices, patch by Roman Divacky.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112079 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2177a04e24
commit
7b83c26051
@ -567,18 +567,14 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
|
||||
uint64_t
|
||||
ELFObjectWriterImpl::getSymbolIndexInSymbolTable(const MCAssembler &Asm,
|
||||
const MCSymbol *S) {
|
||||
for (unsigned i = 0, e = LocalSymbolData.size(); i != e; ++i)
|
||||
if (&LocalSymbolData[i].SymbolData->getSymbol() == S)
|
||||
return i + /* empty symbol */ 1;
|
||||
for (unsigned i = 0, e = ExternalSymbolData.size(); i != e; ++i)
|
||||
if (&ExternalSymbolData[i].SymbolData->getSymbol() == S)
|
||||
return i + LocalSymbolData.size() + Asm.size() + /* empty symbol */ 1;
|
||||
for (unsigned i = 0, e = UndefinedSymbolData.size(); i != e; ++i)
|
||||
if (&UndefinedSymbolData[i].SymbolData->getSymbol() == S)
|
||||
return i + LocalSymbolData.size() + ExternalSymbolData.size() +
|
||||
Asm.size() + /* empty symbol */ 1;
|
||||
MCSymbolData &SD = Asm.getSymbolData(*S);
|
||||
|
||||
llvm_unreachable("Cannot find symbol which should exist!");
|
||||
// Local symbol.
|
||||
if (!SD.isExternal() && !S->isUndefined())
|
||||
return SD.getIndex() + /* empty symbol */ 1;
|
||||
|
||||
// External or undefined symbol.
|
||||
return SD.getIndex() + Asm.size() + /* empty symbol */ 1;
|
||||
}
|
||||
|
||||
void ELFObjectWriterImpl::ComputeSymbolTable(MCAssembler &Asm) {
|
||||
|
Loading…
Reference in New Issue
Block a user