diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-05 17:22:39 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-05 17:22:39 +0000 |
commit | ae7fb0b03ebc524e6c47f0262b8dc87810fee1a8 (patch) | |
tree | a58664e15701d25d0c42a7211ee2aa3a7279a024 /lib/MC/MachObjectWriter.cpp | |
parent | e4eae84f76940e429711ca8908b8d22ac83440cc (diff) |
MC/Mach-O/x86_64: Relocations in debug sections should use local relocations
when possible.
- <rdar://problem/7934873>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103092 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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<const MCSectionMachO&>( + 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). |