diff options
author | Oliver Hunt <oliver@apple.com> | 2024-07-22 18:29:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-22 18:29:06 -0700 |
commit | 4dcd91aea3858fe60c65701a92060a04f789886f (patch) | |
tree | 88182008cde9784c9c1aae6d195abc8fd6652e4d /clang/lib/CodeGen/CodeGenModule.h | |
parent | d3fb41dddc11b0ebc338a3b9e6a5ab7288ff7d1d (diff) | |
download | llvm-4dcd91aea3858fe60c65701a92060a04f789886f.zip llvm-4dcd91aea3858fe60c65701a92060a04f789886f.tar.gz llvm-4dcd91aea3858fe60c65701a92060a04f789886f.tar.bz2 |
[PAC] Implement authentication for C++ member function pointers (#99576)
Introduces type based signing of member function pointers. To support
this discrimination schema we no longer emit member function pointer to
virtual methods and indices into a vtable but migrate to using thunks.
This does mean member function pointers are no longer necessarily
directly comparable, however as such comparisons are UB this is
acceptable.
We derive the discriminator from the C++ mangling of the type of the
pointer being authenticated.
Co-Authored-By: Akira Hatanaka ahatanaka@apple.com
Co-Authored-By: John McCall rjmccall@apple.com
Co-authored-by: Ahmed Bougacha <ahmed@bougacha.org>
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 657e681..284bba8 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -973,8 +973,16 @@ public: llvm::Constant *getFunctionPointer(llvm::Constant *Pointer, QualType FunctionType); + llvm::Constant *getMemberFunctionPointer(const FunctionDecl *FD, + llvm::Type *Ty = nullptr); + + llvm::Constant *getMemberFunctionPointer(llvm::Constant *Pointer, + QualType FT); + CGPointerAuthInfo getFunctionPointerAuthInfo(QualType T); + CGPointerAuthInfo getMemberFunctionPointerAuthInfo(QualType FT); + CGPointerAuthInfo getPointerAuthInfoForPointeeType(QualType type); CGPointerAuthInfo getPointerAuthInfoForType(QualType type); |