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 | 027fa5f31c267b93eefd117fe782f7696dd722df (patch) | |
tree | 7b0f77bd325830a87f20ce7bf47930456002603b /llvm/lib/MC/MachObjectWriter.cpp | |
parent | d6e76fb20c071c78e43898dfc5151f77e1a10181 (diff) | |
download | bcm5719-llvm-027fa5f31c267b93eefd117fe782f7696dd722df.tar.gz bcm5719-llvm-027fa5f31c267b93eefd117fe782f7696dd722df.zip |
MC/Mach-O/x86_64: Relocations in debug sections should use local relocations
when possible.
- <rdar://problem/7934873>
llvm-svn: 103092
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/MachObjectWriter.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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<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). |