14#ifndef LLVM_CLANG_BASIC_POINTERAUTHOPTIONS_H
15#define LLVM_CLANG_BASIC_POINTERAUTHOPTIONS_H
19#include "llvm/ADT/STLForwardCompat.h"
20#include "llvm/Support/ErrorHandling.h"
21#include "llvm/Target/TargetOptions.h"
39 enum class Kind :
unsigned {
71 unsigned IsAddressDiscriminated : 1;
72 unsigned IsIsaPointer : 1;
73 unsigned AuthenticatesNullValues : 1;
77 unsigned ConstantDiscriminator : 16;
83 ARM8_3Key Key,
bool IsAddressDiscriminated,
86 std::optional<uint16_t> ConstantDiscriminatorOrNone = std::nullopt,
87 bool IsIsaPointer =
false,
bool AuthenticatesNullValues =
false)
88 : TheKind(
Kind::
ARM8_3), IsAddressDiscriminated(IsAddressDiscriminated),
89 IsIsaPointer(IsIsaPointer),
90 AuthenticatesNullValues(AuthenticatesNullValues),
91 SelectedAuthenticationMode(AuthenticationMode),
92 DiscriminationKind(OtherDiscrimination), Key(
llvm::to_underlying(Key)) {
94 ConstantDiscriminatorOrNone) &&
95 "constant discrimination requires a constant!");
96 if (ConstantDiscriminatorOrNone)
97 ConstantDiscriminator = *ConstantDiscriminatorOrNone;
101 ARM8_3Key Key,
bool IsAddressDiscriminated,
103 std::optional<uint16_t> ConstantDiscriminatorOrNone = std::nullopt,
104 bool IsIsaPointer =
false,
bool AuthenticatesNullValues =
false)
107 OtherDiscrimination, ConstantDiscriminatorOrNone,
108 IsIsaPointer, AuthenticatesNullValues) {}
118 return IsAddressDiscriminated;
128 return AuthenticatesNullValues;
137 return DiscriminationKind;
142 return ConstantDiscriminator;
148 llvm_unreachable(
"calling getKey() on disabled schema");
152 llvm_unreachable(
"bad key kind");
156 return SelectedAuthenticationMode;
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
Discrimination getOtherDiscrimination() const
bool isAddressDiscriminated() const
ARM8_3Key getARM8_3Key() const
PointerAuthSchema(ARM8_3Key Key, bool IsAddressDiscriminated, Discrimination OtherDiscrimination, std::optional< uint16_t > ConstantDiscriminatorOrNone=std::nullopt, bool IsIsaPointer=false, bool AuthenticatesNullValues=false)
Discrimination
Forms of extra discrimination.
@ None
No additional discrimination.
@ Type
Include a hash of the entity's type.
@ Decl
Include a hash of the entity's identity.
@ Constant
Discriminate using a constant value.
bool authenticatesNullValues() const
ARM8_3Key
Hardware pointer-signing keys in ARM8.3.
PointerAuthSchema(ARM8_3Key Key, bool IsAddressDiscriminated, PointerAuthenticationMode AuthenticationMode, Discrimination OtherDiscrimination, std::optional< uint16_t > ConstantDiscriminatorOrNone=std::nullopt, bool IsIsaPointer=false, bool AuthenticatesNullValues=false)
PointerAuthenticationMode getAuthenticationMode() const
uint16_t getConstantDiscrimination() const
bool hasOtherDiscrimination() const
bool isIsaPointer() const
The JSON file list parser is used to communicate input to InstallAPI.
constexpr uint16_t InitFiniPointerConstantDiscriminator
Constant discriminator to be used with function pointers in .init_array and .fini_array.
constexpr unsigned PointerAuthKeyNone
constexpr uint16_t StdTypeInfoVTablePointerConstantDiscrimination
Constant discriminator for std::type_info vtable pointers: 0xB1EA/45546 The value is ptrauth_string_d...
PointerAuthenticationMode
Diagnostic wrappers for TextAPI types for error reporting.
PointerAuthSchema CXXVTablePointers
The ABI for C++ virtual table pointers (the pointer to the table itself) as installed in an actual cl...
PointerAuthSchema InitFiniPointers
The ABI for function addresses in .init_array and .fini_array.
PointerAuthSchema CXXVTTVTablePointers
The ABI for C++ virtual table pointers as installed in a VTT.
bool ReturnAddresses
Should return addresses be authenticated?
PointerAuthSchema CXXTypeInfoVTablePointer
TypeInfo has external ABI requirements and is emitted without actually having parsed the libcxx defin...
bool AArch64JumpTableHardening
Use hardened lowering for jump-table dispatch?
PointerAuthSchema FunctionPointers
The ABI for C function pointers.
bool AuthTraps
Do authentication failures cause a trap?
PointerAuthSchema CXXMemberFunctionPointers
The ABI for C++ member function pointers.
PointerAuthSchema CXXVirtualVariadicFunctionPointers
The ABI for variadic C++ virtual function pointers.
PointerAuthSchema CXXVirtualFunctionPointers
The ABI for most C++ virtual function pointers, i.e. v-table entries.
bool IndirectGotos
Do indirect goto label addresses need to be authenticated?