Skip to content

Conversation

@resistor
Copy link
Collaborator

This series of patches refactors CHERIoT compartment relocation handling in LLD. The main
change is to resolve which relocations are PCC-relative vs CGP-relative during the rewriting
pre-pass, and to bake that decision using internal relocation numbers. This simplifies logic
downstream, as we no longer have to handle all the possibilities in every case statement.

  • [CHERI] Rename target-specific RelExpr entries to match upstream naming convention.
  • [CHERIoT] Introduce INTERNAL_R_RISCV_CHERIOT_COMPARTMENT_PCCREL_LO_I to simplify the control flow surrounding the relocation of AUIPCC sequences.
  • [CHERIoT] Remove legacy handling of R_RISCV_CHERIOT_COMPARTMENT_LO_I without paired reloc.
  • [CHERIoT] Introduce INTERNAL_R_RISCV_CHERIOT_COMPARTMENT_PCCREL_HI to simplify handling of PCC-relative R_RISCV_CHERIOT_COMPARTMENT_HI relocs.
  • [CHERIoT] Restore upstream use of relocateNoSym for call reloc resolution.
  • [CHERIoT] Update comments regarding the CHERIoT relocation pre-pass.

…to simplify

the control flow surrounding the relocation of AUIPCC sequences.
…without paired reloc.

This further simplifies control flow around CHERIoT relocation handling, and allows us to
collapse the CGPREL_LO_I and CGPREL_LO_S RelExpr's together.
… simplify handling of

PCC-relative R_RISCV_CHERIOT_COMPARTMENT_HI relocs.
…tion.

This is possible now that isPCCRelative is no longer called in relocate().
@resistor
Copy link
Collaborator Author

Manually verified the RTOS test suite passes after these changes.

@resistor resistor marked this pull request as ready for review November 22, 2025 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant