[PATCH] D148573: Port -fsanitize=function to AArch64
Peter Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 18 06:26:22 PDT 2023
peter.smith added a comment.
As it stands I think this may have problems with -mbranch-protection. In that case we'll need a `BTI c` to be the target of the indirect branch. I'm guessing something like:
_Z3funv
BTI C ; In hint space
B . + 8
.word .L__llvm_rtti_proxy-_Z3funv
Otherwise when the indirect call is made then it will fail on a system with BTI enabled.
Not too sure how much of a problem this is for the implementation. The `BTI c` can't be used as a signature, I guess the code in the caller could check the value at `_z3funv + 4` . The feature could be marked as incompatible with `-mbranch-protection`. I guess it may not work well with patchable functions either.
I would expect the emitGlobalConstant to emit data. This would be visible in the object file as we'd have:
$d
<signature>
<rtti>
$x
instructions.
At the moment I don't think that this would affect anything except disassemblers, and the LLD cortex-a53 eratta work around which excludes $d from the disassembly. It is something that it could be worth fixing, expecially if there is a `BTI C` involved.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148573/new/
https://reviews.llvm.org/D148573
More information about the cfe-commits
mailing list