diff options
author | Ahmed Bougacha <ahmed@bougacha.org> | 2024-06-20 11:55:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 11:55:41 -0700 |
commit | 50b919378186ebb59e2dd402720f6ea8576d2477 (patch) | |
tree | 21c1a6f6ab03a81881d81eb46d5c8a10d211b185 /clang/docs | |
parent | 99f5fcb0d1e04125daa404ff14c9cd14b7a2c40b (diff) | |
download | llvm-50b919378186ebb59e2dd402720f6ea8576d2477.zip llvm-50b919378186ebb59e2dd402720f6ea8576d2477.tar.gz llvm-50b919378186ebb59e2dd402720f6ea8576d2477.tar.bz2 |
[clang] Define ptrauth_string_discriminator builtin. (#93903)
This exposes the ABI-stable hash function that allows computing a 16-bit
discriminator from a constant string.
This allows manually matching the implicit string discriminators
computed in the ABI (e.g., from mangled names for vtable pointer/entry
signing), as well as enabling the use of interesting discriminators when
manually annotating specific pointers with the __ptrauth qualifier.
The argument must be a string literal of char character type. The
result has type ptrauth_extra_data_t.
The result value is never zero and always within range for both the
__ptrauth qualifier and ptrauth_blend_discriminator.
This can be used in constant expressions.
Co-authored-by: John McCall <rjmccall@apple.com>
Diffstat (limited to 'clang/docs')
-rw-r--r-- | clang/docs/PointerAuthentication.rst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/docs/PointerAuthentication.rst b/clang/docs/PointerAuthentication.rst index 19b3384..130e657 100644 --- a/clang/docs/PointerAuthentication.rst +++ b/clang/docs/PointerAuthentication.rst @@ -328,6 +328,23 @@ be done in a single instruction with an immediate integer. ``pointer`` must have pointer type, and ``integer`` must have integer type. The result has type ``ptrauth_extra_data_t``. +``ptrauth_string_discriminator`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: c + + ptrauth_string_discriminator(string) + +Compute a constant discriminator from the given string. + +``string`` must be a string literal of ``char`` character type. The result has +type ``ptrauth_extra_data_t``. + +The result value is never zero and always within range for both the +``__ptrauth`` qualifier and ``ptrauth_blend_discriminator``. + +This can be used in constant expressions. + ``ptrauth_strip`` ^^^^^^^^^^^^^^^^^ |