-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standard macros to identify CHERI support and ABIs #13
Comments
Do you expect these to be 0/1 values or defined/not defined?
|
Also whether a descriptor ABI is in use or not is done based on the value of |
I think it makes sense to have these as 0/1 values instead of defined/undefined, for the reasons that @arichardson mentioned. It also means that using them without including |
That's just asking for confusion given that's not how normal feature macros work, and you need to handle undefined correctly anyway to deal with non-CHERI compilers. I foresee people erroneously using |
That's certainly the downside of it, that said this scheme doesn't support non-CHERI compilers anyway, since the macros are defined in |
Yes, I was in the middle of writing that when I got distracted by something else. Whatever we decide on for names (if anything different) should just be done as clang pre-defined macros like everything else IMO. |
I think it would be quite helpful if the guide introduced a small set of macros that identify the available CHERI functionalities. CHERI LLVM already defines macros such as
__CHERI_PURE_CAPABILITY__
, but these are quite a mouthful and do not clearly distinguish between "support for functionality X is enabled" and "ABI Y is being used". To avoid impacting existing software, I would suggest keeping those built-in compiler macros and adding the ones proposed here tocheriintrin.h
.Support macros:
CHERI_SUPPORTED
: CHERI architectural functionalities are availableABI macros:
CHERI_ABI_HYBRID
: the hybrid-cap ABI is used (impliesCHERI_SUPPORTED
)CHERI_ABI_PURE
: the pure-cap ABI is ued (impliesCHERI_SUPPORTED
)These lists could be extended to identify further functionalities and ABIs (e.g. descriptor-based).
The text was updated successfully, but these errors were encountered: