On 17/09/2025 11:04, Hesham Almatary wrote:
This commit replaces the use of __CHERI__ macro with __has_feature(capabilities) similar to CheriBSD. Recent CHERI-LLVM (morello/dev), changes the assumption about __CHERI__, and only defines it for purecap code, while adding a new
Understood. Considering this change in LLVM morello/dev, it makes sense to align the kernel, even though it means giving up support for older Morello GCC builds.
__CHERI_HYBRID__ define. __has_feature(capabilities) is 1:1 mapped to the older __CHERI__ behaviour as it is defined for either hybrid or purecap code. Future efforts to support purecap kernels will have to revisit this assumption especially if both hybrid and purecap kernels are going to be supported in the same codebase.
__has_feature is always defined in Clang and recent GCC toolchain from GCC 14, but not older. This commit will break this Linux build if attempted to build with older GCC.
Signed-off-by: Hesham Almatary Hesham.Almatary@cl.cam.ac.uk
Documentation/cheri/pcuabi.rst | 88 +++++++++++------------ arch/arm64/include/uapi/asm/posix_types.h | 2 +- include/linux/cheri.h | 4 +- include/linux/compiler_types.h | 2 +- include/linux/types.h | 2 +- lib/cheri.c | 4 +- lib/test_printf.c | 2 +- lib/vsprintf.c | 14 ++-- 8 files changed, 59 insertions(+), 59 deletions(-)
Looks good, applied on morello/next. Thanks!
- Kevin