| # Copyright Microsoft and CHERIoT Contributors. | |
| # SPDX-License-Identifier: MIT | |
| SECTIONS | |
| { | |
| . = 0; | |
| .compartment_export_table : ALIGN(8) | |
| { | |
| # Space for the compartment's PCC and GDC. | |
| . = . + 16; | |
| # Space for the error handler. | |
| . = . + 4; | |
| # Array of compartment exports | |
| *(.compartment_exports); | |
| } | |
| # Lay out the compartment imports section. This will end up on PCC. | |
| .compartment_import_table : ALIGN(8) | |
| { | |
| # Array of compartment imports. | |
| HIDDEN(__compartment_pcc_start = .); | |
| # The first import table entry is the compartment switcher. | |
| HIDDEN(.compartment_switcher = .); | |
| . = . + 8; | |
| *(.compartment_imports .compartment_imports.*); | |
| } | |
| # Lay out the code | |
| .text : | |
| { | |
| # HIDDEN(__compartment_code_start = .); | |
| *(.text .text.*); | |
| } | |
| # Read-only data that will end up in the compartment's PCC. | |
| .rodata : | |
| { | |
| *(.rodata .rodata.*); | |
| *(.data.rel.ro .data.rel.ro.*); | |
| } | |
| # BSS remains in a separate section so that we can find it later. | |
| .bss : | |
| { | |
| *(.sbss .sbss.*); | |
| *(.bss .bss.*); | |
| } | |
| # Statically allocated sealed objects | |
| .sealed_objects : | |
| { | |
| *(.sealed_objects .sealed_objects.*); | |
| } | |
| # Throw some stuff away that we don't need. | |
| /DISCARD/ : | |
| { | |
| *(.comment); | |
| # Libraries may not have data sections. | |
| *(.data .data.*); | |
| *(.sdata .sdata.*); | |
| } | |
| } |