summaryrefslogtreecommitdiff
path: root/lib/MC/WinCOFFObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-04-21 18:36:50 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-04-21 18:36:50 +0000
commit1ac7fe0f4dae8a9266fa6ff31ea4939ec64a3e5e (patch)
treeffc630d5cc68b37abc761f73f31f00f28c33e13e /lib/MC/WinCOFFObjectWriter.cpp
parent64d3d12f372fe88cbff7bbac63ea148df678d9b6 (diff)
downloadllvm-1ac7fe0f4dae8a9266fa6ff31ea4939ec64a3e5e.tar.gz
llvm-1ac7fe0f4dae8a9266fa6ff31ea4939ec64a3e5e.tar.bz2
llvm-1ac7fe0f4dae8a9266fa6ff31ea4939ec64a3e5e.tar.xz
Fix relative relocations. This is sufficient for running the rust testsuite with
MC :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/WinCOFFObjectWriter.cpp')
-rw-r--r--lib/MC/WinCOFFObjectWriter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp
index fe3342c886..101237aabb 100644
--- a/lib/MC/WinCOFFObjectWriter.cpp
+++ b/lib/MC/WinCOFFObjectWriter.cpp
@@ -656,8 +656,13 @@ void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm,
const MCSymbol *B = &Target.getSymB()->getSymbol();
MCSymbolData &B_SD = Asm.getSymbolData(*B);
- FixedValue = Layout.getSymbolOffset(&A_SD) - Layout.getSymbolOffset(&B_SD);
+ // Offset of the symbol in the section
+ int64_t a = Layout.getSymbolOffset(&B_SD);
+ // Ofeset of the relocation in the section
+ int64_t b = Layout.getFragmentOffset(Fragment) + Fixup.getOffset();
+
+ FixedValue = b - a;
// In the case where we have SymbA and SymB, we just need to store the delta
// between the two symbols. Update FixedValue to account for the delta, and
// skip recording the relocation.