[clang] [clang][PAC][NFC] Provide addition support macros to ptrauth.h (PR #161027)

Anatoly Trosinenko via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 7 04:53:11 PDT 2025


================
@@ -722,6 +722,40 @@ type.  Implementations are not required to make all bits of the result equally
 significant; in particular, some implementations are known to not leave
 meaningful data in the low bits.
 
+``ptrauth_nop_cast``
+^^^^^^^^^^^^^^^^^^^^
+
+.. code-block:: c
+
+  ptrauth_nop_cast(__type, __value)
+
+Cast a pointer to the given type without changing any signature.
+
+This operation can be used to convert a value from one type to another without
+attempting to re-sign the value. This makes it possible to view a signed value
+of one type as another type signed with the same schema. This can be used to
+convert implicit schemas to explicit schemas, to convert to or from opaque
+types, or simply to change the effective underlying type of a signed value.
+
+The `__type` must be a pointer sized value compatible with the `__ptrauth`
+qualifier. The authentication schema must not include address diversity.
----------------
atrosinenko wrote:

> The authentication schema must not include address diversity.

It is probably worth clarifying explicitly whether this applies to "input" type (implicitly provided via `__value`), "output" type (explicitly specified by `__type` argument) or both.

https://github.com/llvm/llvm-project/pull/161027


More information about the cfe-commits mailing list