diff options
author | Ahmed Bougacha <ahmed@bougacha.org> | 2024-06-20 12:09:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 12:09:54 -0700 |
commit | 7c814c13d0df6dbd0ef6a8b2be214d3f6edbb566 (patch) | |
tree | 1b86178fc5466607e05b338924be525d1d01b0d5 /clang/lib/CodeGen/CodeGenModule.h | |
parent | 50b919378186ebb59e2dd402720f6ea8576d2477 (diff) | |
download | llvm-7c814c13d0df6dbd0ef6a8b2be214d3f6edbb566.zip llvm-7c814c13d0df6dbd0ef6a8b2be214d3f6edbb566.tar.gz llvm-7c814c13d0df6dbd0ef6a8b2be214d3f6edbb566.tar.bz2 |
[clang] Define ptrauth_sign_constant builtin. (#93904)
This is a constant-expression equivalent to
ptrauth_sign_unauthenticated. Its constant nature lets us guarantee
a non-attackable sequence is generated, unlike
ptrauth_sign_unauthenticated which we generally discourage using.
It being a constant also allows its usage in global initializers, though
requiring constant pointers and discriminators.
The value must be a constant expression of pointer type which evaluates
to a non-null pointer.
The key must be a constant expression of type ptrauth_key.
The extra data must be a constant expression of pointer or integer type;
if an integer, it will be coerced to ptrauth_extra_data_t.
The result will have the same type as the original value.
This can be used in constant expressions.
Co-authored-by: John McCall <rjmccall@apple.com>
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 9b63f47..04e1a39 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -937,6 +937,11 @@ public: // Return the function body address of the given function. llvm::Constant *GetFunctionStart(const ValueDecl *Decl); + llvm::Constant * + getConstantSignedPointer(llvm::Constant *Pointer, unsigned Key, + llvm::Constant *StorageAddress, + llvm::ConstantInt *OtherDiscriminator); + // Return whether RTTI information should be emitted for this target. bool shouldEmitRTTI(bool ForEH = false) { return (ForEH || getLangOpts().RTTI) && !getLangOpts().CUDAIsDevice && |