Skip to content

Draft: Support CHERI targets

When targetting CHERI systems such as Arm Morello, pointers (and therefore uintptr_t) are twice the size of size_t/long, and carry additional metadata such as bounds and permissions (as well as a validity bit).

This set of changes allows me to build glib on my Morello desktop running CheriBSD and all tests except two pass:

Summary of Failures:

 12/359 glib:glib / convert                                             FAIL              0.17s   killed by signal 6 SIGABRT
226/359 glib:gio / converter-stream                                     FAIL              1.57s   killed by signal 6 SIGABRT


Ok:                 357
Expected Fail:      0
Fail:               2
Unexpected Pass:    0
Skipped:            0
Timeout:            0

I think those two failures are not related to CHERI but rather due to FreeBSD/Linux differences.

As this contains many changes across various files, I am also happy to split this up into individual merge requests, but I wanted to put this out here to check whether these changes are generally acceptable.

Only the first commit and the last commit contain any changes that involve CHERI builtin macros/intrinisics - everything else should be general portability improvements that do not affect existing targets.

I also believe these changes are ABI compatible, but I have not 100% verified this.

Merge request reports