From 027fa5f31c267b93eefd117fe782f7696dd722df 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. - llvm-svn: 103092 --- llvm/lib/MC/MachObjectWriter.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index a533ccfdc64..f4aef96e302 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/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