[all-commits] [llvm/llvm-project] c93d50: AArch64: use a constpool for blockaddress(...) on ...

Tim Northover via All-commits all-commits at lists.llvm.org
Mon Feb 8 07:13:53 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c93d50dd716879a7edb2c28f4bf9d435651f3766
      https://github.com/llvm/llvm-project/commit/c93d50dd716879a7edb2c28f4bf9d435651f3766
  Author: Tim Northover <t.p.northover at gmail.com>
  Date:   2021-02-08 (Mon, 08 Feb 2021)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
    M llvm/test/CodeGen/AArch64/arm64-blockaddress.ll
    M llvm/test/CodeGen/AArch64/arm64_32.ll

  Log Message:
  -----------
  AArch64: use a constpool for blockaddress(...) on MachO

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.




More information about the All-commits mailing list