diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-23 18:24:20 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-23 18:24:20 +0000 |
commit | 620b68e8831890176b82df611117622728065233 (patch) | |
tree | 2ddb9a172ec130254b4785ce52e2bebd152d9f8b | |
parent | c49f5b2f111cad4596ed285bae771f62a25bd9e7 (diff) | |
download | bcm5719-llvm-620b68e8831890176b82df611117622728065233.tar.gz bcm5719-llvm-620b68e8831890176b82df611117622728065233.zip |
Use the proper relocation section + cleanup, from Roman Divacky.
llvm-svn: 111819
-rw-r--r-- | llvm/lib/MC/ELFObjectWriter.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index f4b68c4e481..573453fc86f 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -511,7 +511,10 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm, const MCSymbolData *Base = Asm.getAtom(Layout, &SD); if (Base) { - Index = getSymbolIndexInSymbolTable(const_cast<MCAssembler &>(Asm), &Base->getSymbol()); + if (MCFragment *F = SD.getFragment()) + Index = F->getParent()->getOrdinal() + getNumOfLocalSymbols(Asm) + 1; + else + Index = getSymbolIndexInSymbolTable(const_cast<MCAssembler &>(Asm), Symbol); if (Base != &SD) Value += Layout.getSymbolAddress(&SD) - Layout.getSymbolAddress(Base); Addend = Value; @@ -521,8 +524,7 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm, if (F) { // Index of the section in .symtab against this symbol // is being relocated + 2 (empty section + abs. symbols). - Index = SD.getFragment()->getParent()->getOrdinal() + - getNumOfLocalSymbols(Asm) + 1; + Index = F->getParent()->getOrdinal() + getNumOfLocalSymbols(Asm) + 1; MCSectionData *FSD = F->getParent(); // Offset of the symbol in the section |