[lld] r222200 - [mach-o] enhance arm64 reloc parser to support local pointer relocations
Nick Kledzik
kledzik at apple.com
Mon Nov 17 16:30:22 PST 2014
Author: kledzik
Date: Mon Nov 17 18:30:22 2014
New Revision: 222200
URL: http://llvm.org/viewvc/llvm-project?rev=222200&view=rev
Log:
[mach-o] enhance arm64 reloc parser to support local pointer relocations
The arm64 assembler almost always uses r_extern=1 relocations in which the
r_symbolnum field is the index of the symbol the relocation references. But
sometimes it will set r_extern=0 in which case the linker needs to read the
content of the reloction to determine the target.
Add test case that the r_extern=0 relocation round trips.
Modified:
lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
Modified: lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp?rev=222200&r1=222199&r2=222200&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp Mon Nov 17 18:30:22 2014
@@ -717,7 +717,11 @@ void ArchHandler_arm64::appendSectionRel
ARM64_RELOC_TLVP_LOAD_PAGEOFF12 | rExtern | rLength4);
return;
case pointer64:
- appendReloc(relocs, sectionOffset, symbolIndexForAtom(*ref.target()), 0,
+ if (ref.target()->name().empty())
+ appendReloc(relocs, sectionOffset, sectionIndexForAtom(*ref.target()), 0,
+ ARM64_RELOC_UNSIGNED | rLength8);
+ else
+ appendReloc(relocs, sectionOffset, symbolIndexForAtom(*ref.target()), 0,
ARM64_RELOC_UNSIGNED | rExtern | rLength8);
return;
case delta64:
More information about the llvm-commits
mailing list