[PATCH] D155732: [MC][COFF][AArch64] Avoid incorrect IMAGE_REL_ARM64_BRANCH26 relocations.

Hiroshi Yamauchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 11:49:30 PDT 2023


hjyamauchi added a comment.

In D155732#4515655 <https://reviews.llvm.org/D155732#4515655>, @compnerd wrote:

> https://learn.microsoft.com/en-us/windows/win32/debug/pe-format indicates that there does exist such a relocation:
>
>> IMAGE_REL_ARM64_BRANCH26    0x0003   The 26-bit relative displacement to the target, for B and BL instructions.
>
> If this relocation is unsupported, we should just disable that relocation from being formed or we should figure out what the linker expectations are.

Yeah. To be clearer, what I observed was that the relocation type works as long as the offset that's embedded in the instruction is zero (I suspect that the linker doesn't use the offset in relocation or assumes it's zero.) I also tried a small local patch in lld to take this non-zero offset into account in the relocation and it also avoided the crashes I'm seeing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155732



More information about the llvm-commits mailing list