[PATCH] D99417: [AArch64][v8.5A] Add BTI to all function starts

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 26 08:51:14 PDT 2021


peter.smith added a comment.

This looks reasonable to me, while the linker moving a local function far away from its callers in the same object file is unlikely, it is at least theoretically possible with linker scripts or a symbol ordering file. My guess is that this would only affect a small number of functions?



================
Comment at: llvm/lib/Target/AArch64/AArch64BranchTargets.cpp:89
     // branch to a "BTI c" using any register.
-    if (&MBB == &*MF.begin() && (F.hasAddressTaken() || !F.hasLocalLinkage()))
+    if (&MBB == &*MF.begin())
       CouldCall = true;
----------------
A linker is not permitted to add a thunk for the R_AARCH64_CONDBR19 relocation (A conditional branch), it may be possible to exclude the conditional branch in the check. My guess is that it won't be worth it as calling a function with a conditional branch is not likely to be generated by the compiler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99417



More information about the llvm-commits mailing list