[PATCH] D148701: [LLD][ELF][AArch64] Add AArch64 short range thunk support

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 15:14:11 PDT 2023


MaskRay added a comment.

Thanks for the patch. AArch64ADRPThunk and AArch64ABSLongThunk duplicate `writeTo` and `getMayUseShortThunk` now. Shall we define a base class for the two classes to share code?

Is there any analysis how frequently this short thunk mode is going to trigger?

We need a thunk for `b far` or `bl far`. By using a `b` instruction, we can reach from +-128MiB at the thunk section location (instead of the original call site).
This does not guarantee a 256MiB range without indirect branches.
This is in part because `ThunkCreator::getThunk` picks the first available thunk, not the best one.

Let's use `aarch64-call26-thunk.s` as an example. If I change `Inputs/abs.s` to use `big = 0x8210120` (shorter addresses don't need a thunk), I'll get a short thunk. If I use `big = 0x8210124`, I'll get a long thunk.


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

https://reviews.llvm.org/D148701



More information about the llvm-commits mailing list