[PATCH] D108479: [Clang] Add __builtin_addressof_nocfi
Jessica Clarke via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 13 19:07:13 PST 2021
jrtc27 added a comment.
In D108479#3110003 <https://reviews.llvm.org/D108479#3110003>, @rjmccall wrote:
> `std::addressof(&someFunction)` certainly ought to return a signed pointer under ptrauth, so if your goal here is to get a completely unadorned symbol address, I think you do need a different builtin, and it probably ought to return a `void*` to emphasize that it shouldn't be used as a normal value. Maybe it should even be semantically restricted to require a constant decl reference as its operand? Related and perhaps illuminating question: if it were implementable, would you also want to force the suppression of lazy-binding thunks and/or decorations like the THUMB bit?
Similarly, should it point to the descriptor or the entry point for ABIs with function descriptors? Personally I think trying to generalise this builtin just opens a huge can of worms when you look at other architectures and ABIs (and what it does can have implications for CHERI/Morello where we have various weird experimental ABIs), so you may just be best off having the original specialised builtin with very clear semantics.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108479/new/
https://reviews.llvm.org/D108479
More information about the cfe-commits
mailing list