As part of a CHERI hybrid project I'm working on, I recently have attempted to use Morello gcc as my compiler, having used the CheriBSD `clang` compiler built via `cheribuild` [1] before. I downloaded pre-built binaries for x86_64 host and AArch64 targets, namely `arm-gnu-toolchain-10.1.morello-alp2-x86_64-aarch64-none-linux-gnu.tar.xz` [2]. One of the errors I encountered seems to be it doesn't know the type `ptraddr_t` (nor the older `vaddr_t`), which, as far as I'm aware, should be a CHERI type, as per Section 4.2.1 in the CHERI C Programming Guide [3]. I can `typedef` it to something like `intptr_t` or so for myself, but the lack of it might be seen as a bug (unless it was included in a more recent version I couldn't find after a cursory search).
Regards,Andrei.[1] https://github.com/CTSRD-CHERI/cheribuild[2] developer.arm.com/.../arm-gnu-toolchain-for-morello-downloads[3] www.cl.cam.ac.uk/.../UCAM-CL-TR-947.pdf
You're right - adding `#include <stddef.h>` does make `ptraddr_t` accepted. However, CheriBSD `clang` still seems to accept the type even without that particular include, which led to my confusion. Thanks for the clarifications.
Glad that worked! Non-primitive types like ptraddr_t are not directly defined by the compiler. It may be that another system header you include ends up including stddef.h itself on CheriBSD (but not on Linux).
Yes, it seems it's in `stdint.h` for CheriBSD `clang` (after a cursory `grep`, and removing that header from my test code) (it seems to be the same in purecap, just used hybrid here as I had it handy):
`rootfs-morello-hybrid/usr/include/sys/_stdint.h:133:typedef __ptraddr_t ptraddr_t;`