diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-23 19:05:46 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-23 19:05:46 +0000 |
commit | bcf2db60dd3c37fe76dc1b5c5fa3e95b43b3776a (patch) | |
tree | d571dc79538becb87759c9911f4eb60807f9ae54 | |
parent | baf2883e0a294fabc059699037ad92822c46bd61 (diff) | |
download | external_llvm-bcf2db60dd3c37fe76dc1b5c5fa3e95b43b3776a.zip external_llvm-bcf2db60dd3c37fe76dc1b5c5fa3e95b43b3776a.tar.gz external_llvm-bcf2db60dd3c37fe76dc1b5c5fa3e95b43b3776a.tar.bz2 |
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
-rw-r--r-- | lib/MC/ELFObjectWriter.cpp | 5 |
1 files 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<MCAssembler &>(Asm), Symbol); if (Base != &SD) Value += Layout.getSymbolAddress(&SD) - Layout.getSymbolAddress(Base); |