[llvm-branch-commits] Prepare libcxx and libcxxabi for pointer field protection. (PR #151651)
Peter Collingbourne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Sep 10 11:32:42 PDT 2025
================
@@ -1262,6 +1275,14 @@ typedef __char32_t char32_t;
# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER 0
# endif
+# if defined(__POINTER_FIELD_PROTECTION__)
+# define _LIBCPP_PFP [[clang::pointer_field_protection]]
+# define _LIBCPP_NO_PFP [[clang::no_field_protection]]
----------------
pcc wrote:
`[[clang::pointer_field_protection]]` will enable PFP on a type even if the command line flag is not passed, so we should avoid it when PFP is not enabled on the command line to avoid ABI breaks.
Checking attribute availability for `[[clang::no_field_protection]]` sounds fine to me.
https://github.com/llvm/llvm-project/pull/151651
More information about the llvm-branch-commits
mailing list