From: Rafael Espindola Date: Thu, 23 Sep 2010 18:01:31 +0000 (+0000) Subject: Correctly compute the offset of the symbol. Forgot these bits from the X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a5c6b78bf8a009609258ed6c11ac4580ad6426f5;p=oota-llvm.git Correctly compute the offset of the symbol. Forgot these bits from the last commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114678 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 7960a07499a..587489c26be 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -504,7 +504,10 @@ void ELFObjectWriterImpl::RecordRelocation(const MCAssembler &Asm, if (Base) { if (F && !SD.isExternal()) { Index = F->getParent()->getOrdinal() + LocalSymbolData.size() + 1; - Value += Layout.getSymbolAddress(&SD); + + MCSectionData *FSD = F->getParent(); + // Offset of the symbol in the section + Value += Layout.getSymbolAddress(&SD) - Layout.getSectionAddress(FSD); } else Index = getSymbolIndexInSymbolTable(Asm, Symbol); if (Base != &SD)