[PATCH] D152221: Avoid cross-section branches in AArch64 inline asm

Daniel Hoekwater via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 01:46:44 PDT 2023


dhoekwater added a comment.

I'm adding this so that, once enabled, function splitting and basic block sections won't create link failures for AArch64.

If we have two basic blocks: BB1 and BB2 where BB1 contains an inline assembly label and BB2 contains inline assembly that branches to that label, function splitting and `fbasic-block-sections=all` can both place BB1 and BB2 in different text sections. Ex: https://godbolt.org/z/z8KareGn7. With function splitting, if the `beq label1` instruction is rarely taken, `label1` will be placed in the `.text.split` section, while `beq label1` remains in `.text`. If the linker places the two sections more than 1MB away from each other, the program will fail to link because the offset doesn't fit in `beq` machine code instruction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152221



More information about the llvm-commits mailing list