[PATCH] D152661: [XRay] Make xray_fn_idx entries PC-relative

Oleksii Lozovskyi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 17 21:47:23 PDT 2023


ilammy added a comment.

In D145850#4412388 <https://reviews.llvm.org/D145850#4412388>, @MaskRay wrote:

> `xray_fn_idx` entries should use PC-relative relocations as well, but I never get around to fix it. I wonder whether the change may make this patch unneeded or we are going to find other Mach-O relocation related issues.

D145850 <https://reviews.llvm.org/D145850> is isolation fixes the linker issue for me even with `-fxray-function-index`.

---

D152661 <https://reviews.llvm.org/D152661> – this change – applied in isolation still causes the same error:

  ld: in section __DATA,xray_instr_map reloc 0: X86_64_RELOC_SUBTRACTOR must have r_extern=1 file '/var/folders/hv/h2_fjzgx1fl2mh85t65xsv6m0000gn/T/main-5630d5.o' for architecture x86_64

with the linker not being able to handle relocations in `xray_instr_map` specifically.

---

When if I apply D145850 <https://reviews.llvm.org/D145850> and then D152661 <https://reviews.llvm.org/D152661> on top of it, //code generation// appears to fail:

  hello.s:53:8: error: expected relocatable expression
          .quad   (lxray_sleds_end0-lxray_sleds_start0)>>4
                  ^

Assembler can't emit a relocation for this expression involving references to local symbols.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152661



More information about the llvm-commits mailing list