[PATCH] D85126: AArch64: use a constpool for blockaddress(...) on MachO

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 05:37:14 PDT 2020


t.p.northover created this revision.
t.p.northover added a reviewer: ab.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls, mcrosier.
Herald added a project: LLVM.
t.p.northover requested review of this revision.

More MachO madness for everyone. MachO relocations are only 32-bits, which means the `ARM64_RELOC_ADDEND` one only actually has 24 (signed) bits for the actual addend. This is a problem when calculating the address of a basic block; because it has no symbol of its own, the sequence

  adrp x0, Ltmp0 at PAGE
  add x0, x0, x0 Ltmp0 at PAGEOFF

is represented by relocation with an addend that contains the offset from the function start to Ltmp, and so the largest function where this is guaranteed to work is 8MB. That's not quite big enough that we can call it user error (IMO).

So this patch puts the any blockaddress into a constant-pool, where the addend is instead stored in the (x)word being relocated, which is obviously big enough for any function.


https://reviews.llvm.org/D85126

Files:
  llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/test/CodeGen/AArch64/arm64-blockaddress.ll
  llvm/test/CodeGen/AArch64/arm64_32.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85126.282598.patch
Type: text/x-patch
Size: 4939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200803/8ed43a63/attachment.bin>


More information about the llvm-commits mailing list