Skip to content

Commit 51f7cc3

Browse files
nwfresistor
authored andcommitted
[CHERIoT] ELF/Writer: fix import entry perm mask
The loader reserves 8, not 4, bits for permission flags; the linker should agree.
1 parent f42b354 commit 51f7cc3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lld/ELF/Writer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3266,7 +3266,13 @@ class CompartmentReportWriter {
32663266
imports.push_back(json::Object{
32673267
{"kind", "MMIO"},
32683268
{"start", entry.start},
3269-
{"length", entry.length & 0xfffffff},
3269+
/*
3270+
* Length and permissions are bit-stuffed into the same 32-bit
3271+
* word, with the top 8 bits reserved for permission flags and
3272+
* the bottom 24 for length. See CHERIoT-RTOS's
3273+
* sdk/core/loader/types.h ReservedPermissionsMask
3274+
*/
3275+
{"length", entry.length & 0x00ffffff},
32703276
{"permits_load", (entry.length & ImportPermitsLoad) != 0},
32713277
{"permits_store", (entry.length & ImportPermitsStore) != 0},
32723278
{"permits_load_store_capabilities",

0 commit comments

Comments
 (0)