When using cross-DSO, some indirect calls are not guarded by a branch to a trap but instead follow a call to __cfi_slowpath. For example:
if (!InlinedFastCheck(f)) {
call *f
} else {
__cfi_slowpath(CallSiteTypeId, f); call *f
}
In this case, the second call to f is not marked as protected by the current code. We thus recognize if an indirect call directly follows a call to a function that will trap on CFI violations and treat them as protected.
We also ignore indirect calls in the PLT, since on AArch64 each entry contains an indirect call that should not be protected by CFI.
Why?