[clang] [llvm] [AArch64] Add support for -mlong-calls code generation (PR #142982)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 08:22:35 PDT 2025


smithp35 wrote:

My understanding is that this will make all calls to global functions into long calls. 

In AArch64 static linkes are required to insert range extension thunks for out of range BLs. In the best case this is just another direct branch, at worst case for `--pic-veneer` this is just `adrp, add, br`. I would expect that on-demand linker inserted thunks would outperform making all calls long for the majority of programs. I'm interested in any data that shows that long calls works better, and whether that could feed back into the lld thunk generation code. For example are the thunks too far away from the caller which causes page faults etc.

I note that with `-ffunction-sections` and certain linker options calls to static functions can go out of range too. These would get handled by linker thunks though.

https://github.com/llvm/llvm-project/pull/142982


More information about the llvm-commits mailing list