Add the symbol offset to the relocation value when we relocate against section. By Roman Divacky.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111824 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2010-08-23 19:05:46 +00:00
parent baf2883e0a
commit bcf2db60dd

View File

@ -511,9 +511,10 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm,
const MCSymbolData *Base = Asm.getAtom(Layout, &SD);
if (Base) {
if (MCFragment *F = SD.getFragment())
if (MCFragment *F = SD.getFragment()) {
Index = F->getParent()->getOrdinal() + getNumOfLocalSymbols(Asm) + 1;
else
Value += Layout.getSymbolAddress(&SD);
} else
Index = getSymbolIndexInSymbolTable(const_cast<MCAssembler &>(Asm), Symbol);
if (Base != &SD)
Value += Layout.getSymbolAddress(&SD) - Layout.getSymbolAddress(Base);