From db4c7e606f6bcc42ed8d853be5d67dfb9fa0edee Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 11 May 2010 23:53:11 +0000 Subject: MC/Mach-O/x86_64: Fix PCrel adjustment for x86_64, which was using the fixup offset instead of the fixup address as intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103527 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MachObjectWriter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/MC/MachObjectWriter.cpp') diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index a0f708244d..3ca6708005 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -479,6 +479,7 @@ public: // See . uint32_t FixupOffset = Layout.getFragmentOffset(Fragment) + Fixup.Offset; + uint32_t FixupAddress = Layout.getFragmentAddress(Fragment) + Fixup.Offset; int64_t Value = 0; unsigned Index = 0; unsigned IsExtern = 0; @@ -591,7 +592,7 @@ public: Value += Layout.getSymbolAddress(&SD); if (IsPCRel) - Value -= FixupOffset + (1 << Log2Size); + Value -= FixupAddress + (1 << Log2Size); } else { report_fatal_error("unsupported relocation of undefined symbol '" + Symbol->getName() + "'"); -- cgit v1.2.3-18-g5258