From ae7fb0b03ebc524e6c47f0262b8dc87810fee1a8 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 5 May 2010 17:22:39 +0000 Subject: MC/Mach-O/x86_64: Relocations in debug sections should use local relocations when possible. - git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103092 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MachObjectWriter.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/MC/MachObjectWriter.cpp') diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index a533ccfdc6..f4aef96e30 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -548,6 +548,17 @@ public: MCSymbolData &SD = Asm.getSymbolData(*Symbol); const MCSymbolData *Base = Asm.getAtom(Layout, &SD); + // Relocations inside debug sections always use local relocations when + // possible. This seems to be done because the debugger doesn't fully + // understand x86_64 relocation entries, and expects to find values that + // have already been fixed up. + if (Symbol->isDefined()) { + const MCSectionMachO &Section = static_cast( + Fragment->getParent()->getSection()); + if (Section.hasAttribute(MCSectionMachO::S_ATTR_DEBUG)) + Base = 0; + } + // x86_64 almost always uses external relocations, except when there is no // symbol to use as a base address (a local symbol with no preceeding // non-local symbol). -- cgit v1.2.3-18-g5258