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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 15:37:22 PDT 2020


MaskRay marked 3 inline comments as done.
MaskRay added inline comments.


================
Comment at: lld/test/MachO/x86-64-reloc-signed.s:17
+_main:
+  movl $0x434241, _s(%rip)  # X86_64_RELOC_SIGNED4
+  callq _f
----------------
smeenai wrote:
> alexshap wrote:
> > smeenai wrote:
> > > int3 wrote:
> > > > nit: X86_64_RELOC_SIGNED_4 (missing underscore)
> > > (same nit for the two below)
> > btw, is there a guarantee that MC will emit a relocation of this particular type ? (and the same question might be relevant for other similar diffs). One way to (at least) verify it is to use llvm-objdump or llvm-readobj to check that the list of relocations contains exactly what's expected here. 
> Good point, and yeah, that seems worthwhile to check.
I did want to test initial relocations (the opposite of outstanding relocations; some ELF ppc64-* tests do this). Weirdly, llvm-readobj -r says the relocations are not ordered by offset (in ELF this is not guaranteed but the order is nice for a variety of reasons):

  Section __text {
    0x3D 1 2 1 X86_64_RELOC_SIGNED 0 _s
    0x26 1 2 1 X86_64_RELOC_BRANCH 0 _f
    0x20 1 2 1 X86_64_RELOC_SIGNED_1 0 _s
    0x1A 1 2 1 X86_64_RELOC_BRANCH 0 _f
    0x11 1 2 1 X86_64_RELOC_SIGNED_2 0 _s
    0xB 1 2 1 X86_64_RELOC_BRANCH 0 _f
    0x2 1 2 1 X86_64_RELOC_SIGNED_4 0 _s
  }

I'd hope this to be fixed first because otherwise we can't interleave instructions and CHECK lines for initial relocations in their order.


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