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

llvm-svn: 111824
This commit is contained in:
Benjamin Kramer 2010-08-23 19:05:46 +00:00
parent bf9294fb65
commit 40f83489b4
1 changed files with 3 additions and 2 deletions

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);