summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commitc3dc4867523f395709b95da2a3d79cf30f5c6a6a (patch)
tree29d10356dd6e18655a8d87153b689f117c9e58e3 /llvm/lib
parent46bda61a811e15709fd27247572064efef4d337c (diff)
downloadbcm5719-llvm-c3dc4867523f395709b95da2a3d79cf30f5c6a6a.tar.gz
bcm5719-llvm-c3dc4867523f395709b95da2a3d79cf30f5c6a6a.zip
Fix relative relocations. This is sufficient for running the rust testsuite with
MC :-) llvm-svn: 129923
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/WinCOFFObjectWriter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp
index fe3342c886b..101237aabb0 100644
--- a/llvm/lib/MC/WinCOFFObjectWriter.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud