[PATCH] D79311: [lld-macho] Support X86_64_RELOC_SIGNED_{1,2,4}

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 15 14:10:00 PDT 2020


thakis added inline comments.


================
Comment at: lld/MachO/Arch/X86_64.cpp:53
+  case X86_64_RELOC_SIGNED_2:
+  case X86_64_RELOC_SIGNED_4:
   case X86_64_RELOC_GOT_LOAD:
----------------
Is this correct? Looking at `lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp`, it has this handy table:

```
    ripRel32,              /// ex: movq _foo(%rip), %rax
    ripRel32Minus1,        /// ex: movb $0x12, _foo(%rip)
    ripRel32Minus2,        /// ex: movw $0x1234, _foo(%rip)
    ripRel32Minus4,        /// ex: movl $0x12345678, _foo(%rip)
    ripRel32Anon,          /// ex: movq L1(%rip), %rax
    ripRel32Minus1Anon,    /// ex: movb $0x12, L1(%rip)
    ripRel32Minus2Anon,    /// ex: movw $0x1234, L1(%rip)
    ripRel32Minus4Anon,    /// ex: movw $0x12345678, L1(%rip)

```

and it maps SIGNED(_1/2/4) to these and then it does relocations with offsets for the offset relocation types.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79311/new/

https://reviews.llvm.org/D79311





More information about the llvm-commits mailing list