diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 6381989b7f93c..6a0b810e347f1 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -2465,7 +2465,8 @@ def CHERICCallee : DeclOrTypeAttr { // InheritableAttr { } def CHERICCallback : DeclOrTypeAttr { // InheritableAttr { - let Spellings = [GNU<"cheri_ccallback">]; + let Spellings = [GNU<"cheri_ccallback">, + GNU<"cheriot_ccallback">]; let Documentation = [Undocumented]; } @@ -2481,14 +2482,17 @@ def CHERIMethodClass : DeclOrTypeAttr { // InheritableAttr { } def CHERICompartmentName : DeclOrTypeAttr { - let Spellings = [GNU<"cheri_compartment">]; + let Spellings = [GNU<"cheri_compartment">, + GNU<"cheriot_compartment">]; let Documentation = [Undocumented]; let Subjects = SubjectList<[Function], ErrorDiag>; let Args = [StringArgument<"CompartmentName">]; } def CHERILibCall : DeclOrTypeAttr { - let Spellings = [GNU<"cheri_libcall">]; + let Spellings = [GNU<"cheri_libcall">, + GNU<"cheriot_libcall"> + ]; let Documentation = [Undocumented]; let Subjects = SubjectList<[Function], ErrorDiag>; } diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp index 0bb0ed26d3513..20a544696f0ee 100644 --- a/clang/lib/Basic/Targets/RISCV.cpp +++ b/clang/lib/Basic/Targets/RISCV.cpp @@ -241,9 +241,9 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts, // Macros for CHERIoT in the default and bare-metal ABIs. if (ABI == "cheriot" || ABI == "cheriot-baremetal") - Builder.defineMacro("__CHERIOT__", "20250215"); + Builder.defineMacro("__CHERIOT__", "20250217"); if (ABI == "cheriot-baremetal") - Builder.defineMacro("__CHERIOT_BAREMETAL__", "20250215"); + Builder.defineMacro("__CHERIOT_BAREMETAL__", "20250217"); Builder.defineMacro("__riscv_clen", Twine(getCHERICapabilityWidth())); // TODO: _MIPS_CAP_ALIGN_MASK equivalent? diff --git a/clang/test/CodeGen/cheri/cheri-mcu-call-libcall.c b/clang/test/CodeGen/cheri/cheri-mcu-call-libcall.c index d8a6d6aba6c24..5d7d8460ae344 100644 --- a/clang/test/CodeGen/cheri/cheri-mcu-call-libcall.c +++ b/clang/test/CodeGen/cheri/cheri-mcu-call-libcall.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 %s -o - "-triple" "riscv32cheriot-unknown-cheriotrtos" "-emit-llvm" "-mframe-pointer=none" "-mcmodel=small" "-target-abi" "cheriot" "-Oz" "-Werror" "-cheri-compartment=example" | FileCheck %s -#define LIBCALL __attribute__((cheri_libcall)) +#define LIBCALL __attribute__((cheriot_libcall)) LIBCALL int add(int a, int b); diff --git a/clang/test/CodeGen/cheri/cheri-mcu-ccall.c b/clang/test/CodeGen/cheri/cheri-mcu-ccall.c index 05f419b677ba4..0ab1be4b1ee94 100644 --- a/clang/test/CodeGen/cheri/cheri-mcu-ccall.c +++ b/clang/test/CodeGen/cheri/cheri-mcu-ccall.c @@ -1,11 +1,11 @@ // RUN: %clang_cc1 %s -o - "-triple" "riscv32cheriot-unknown-cheriotrtos" "-emit-llvm" "-mframe-pointer=none" "-mcmodel=small" "-target-abi" "cheriot" "-Oz" "-Werror" "-cheri-compartment=example" | FileCheck %s // CHECK: define dso_local chericcallcce i32 @_Z5test2ii(i32 noundef %a0, i32 noundef %a1) local_unnamed_addr addrspace(200) #0 -__attribute__((cheri_compartment("example"))) int test2(int a0, int a1) { +__attribute__((cheriot_compartment("example"))) int test2(int a0, int a1) { return a0 + a1; } -__attribute__((cheri_compartment("other"))) int test6callee(int *a0, int *a1, int *a2, int *a3, int *a4, int *a5); +__attribute__((cheriot_compartment("other"))) int test6callee(int *a0, int *a1, int *a2, int *a3, int *a4, int *a5); int testcall6() { static int stack_arg; diff --git a/clang/test/CodeGen/cheri/cheri-mcu-interrupts.c b/clang/test/CodeGen/cheri/cheri-mcu-interrupts.c index 7d7e08f42271e..3061afb389a9e 100644 --- a/clang/test/CodeGen/cheri/cheri-mcu-interrupts.c +++ b/clang/test/CodeGen/cheri/cheri-mcu-interrupts.c @@ -37,6 +37,13 @@ void default_enable_callback(void) { } +// CHECK: define dso_local chericcallcc void @default_enable_callback2() local_unnamed_addr addrspace(200) #[[DEFEN]] +__attribute__((cheriot_ccallback)) +void default_enable_callback2(void) +{ +} + + // Explicitly setting interrupt status should override the default // CHECK: define dso_local chericcallcce i32 @_Z23explicit_disable_calleev() local_unnamed_addr addrspace(200) #[[EXPDIS:[0-9]]] diff --git a/clang/test/CodeGen/cheri/cheriot-libcall-ptr-decay.c b/clang/test/CodeGen/cheri/cheriot-libcall-ptr-decay.c index 654a2b95f56e8..0d403f6deccd8 100644 --- a/clang/test/CodeGen/cheri/cheriot-libcall-ptr-decay.c +++ b/clang/test/CodeGen/cheri/cheriot-libcall-ptr-decay.c @@ -17,7 +17,7 @@ void foo(void (*bar)()) // CHECK-NEXT: entry: // CHECK-NEXT: ret void // -void __attribute__((cheri_libcall)) bar() +void __attribute__((cheriot_libcall)) bar() { return; } diff --git a/clang/test/CodeGenCXX/cheri/cheriot-libcall-ptr-decay.cpp b/clang/test/CodeGenCXX/cheri/cheriot-libcall-ptr-decay.cpp index 9a5c2b3b3dea7..7ce0f1d1c76ea 100644 --- a/clang/test/CodeGenCXX/cheri/cheriot-libcall-ptr-decay.cpp +++ b/clang/test/CodeGenCXX/cheri/cheriot-libcall-ptr-decay.cpp @@ -17,7 +17,7 @@ void foo(void (*bar)()) // CHECK-NEXT: entry: // CHECK-NEXT: ret void // -void __attribute__((cheri_libcall)) bar() +void __attribute__((cheriot_libcall)) bar() { return; } diff --git a/clang/test/Preprocessor/init.c b/clang/test/Preprocessor/init.c index 18308dbe4f136..fa5ef3838ee0d 100644 --- a/clang/test/Preprocessor/init.c +++ b/clang/test/Preprocessor/init.c @@ -320,8 +320,8 @@ // Check for CHERIoT-specific defines // RUN: %clang_cc1 %s -o - "-triple" "riscv32-unknown-unknown" "-emit-llvm" "-mframe-pointer=none" "-mcmodel=small" "-target-cpu" "cheriot" "-target-feature" "+xcheri" "-target-feature" "-64bit" "-target-feature" "-relax" "-target-feature" "-xcheri-rvc" "-target-feature" "-save-restore" "-target-abi" "cheriot" -E -dM < /dev/null | FileCheck -check-prefix CHERIOT %s // RUN: %clang_cc1 %s -o - "-triple" "riscv32-unknown-unknown" "-emit-llvm" "-mframe-pointer=none" "-mcmodel=small" "-target-cpu" "cheriot" "-target-feature" "+xcheri" "-target-feature" "-64bit" "-target-feature" "-relax" "-target-feature" "-xcheri-rvc" "-target-feature" "-save-restore" "-target-abi" "cheriot-baremetal" -E -dM < /dev/null | FileCheck -check-prefixes CHERIOT,CHERIOT-BAREMETAL %s -// CHERIOT-BAREMETAL: #define __CHERIOT_BAREMETAL__ 20250215 -// CHERIOT: #define __CHERIOT__ 20250215 +// CHERIOT-BAREMETAL: #define __CHERIOT_BAREMETAL__ 20250217 +// CHERIOT: #define __CHERIOT__ 20250217 // RUN: %cheri128_cc1 -fgnuc-version=4.2.1 -E -dM -ffreestanding < /dev/null | FileCheck -check-prefixes CHERI-COMMON,CHERI-MIPS,CHERI128 %s diff --git a/clang/test/Sema/cheri/cheri-mcu-compartment-warns.c b/clang/test/Sema/cheri/cheri-mcu-compartment-warns.c index 6dbd70ebafbcf..ae22403cff417 100644 --- a/clang/test/Sema/cheri/cheri-mcu-compartment-warns.c +++ b/clang/test/Sema/cheri/cheri-mcu-compartment-warns.c @@ -1,13 +1,13 @@ // RUN: %clang_cc1 %s -o - -triple riscv32cheriot-unknown-cheriotrtos -emit-llvm -mframe-pointer=none -mcmodel=small -target-abi cheriot -Oz -Werror -verify=libcall // RUN: %clang_cc1 %s -o - -triple riscv32cheriot-unknown-cheriotrtos -emit-llvm -mframe-pointer=none -mcmodel=small -target-abi cheriot -Oz -Werror -verify=wrong-compartment -cheri-compartment=wrong -__attribute__((cheri_libcall)) +__attribute__((cheriot_libcall)) int add(int a, int b) // wrong-compartment-error{{CHERI libcall exported from compilation unit for compartment 'wrong' (provided with -cheri-compartment=)}} { return a+b; } -__attribute__((cheri_compartment("example"))) +__attribute__((cheriot_compartment("example"))) int shouldBePrototype(void) // libcall-error{{CHERI compartment entry declared for compartment 'example' but implemented in '' (provided with -cheri-compartment=)}} wrong-compartment-error{{CHERI compartment entry declared for compartment 'example' but implemented in 'wrong' (provided with -cheri-compartment=)}} { return 1;