From bcf2db60dd3c37fe76dc1b5c5fa3e95b43b3776a Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 23 Aug 2010 19:05:46 +0000 Subject: 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 --- lib/MC/ELFObjectWriter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 573453f..bde9e84 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -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(Asm), Symbol); if (Base != &SD) Value += Layout.getSymbolAddress(&SD) - Layout.getSymbolAddress(Base); -- cgit v1.1