Skip to content

Conversation

@resistor
Copy link
Collaborator

This is needed because Cheriot uses 11-bit shifts on AUIPCC (differing from normal RISC-V CHERI), and requires that the HI and LO relocs offset the target in the same direction. This is meant to be handled for all of Cheriot via R_RISCV_CHERIOT_COMPARTMENT_HI and R_RISCV_CHERIOT_COMPARTMENT_LO_I, but that is complicated by the simultaneous need to relax calls in (almost) all situations, which requires using R_RISCV_CHERI_CCALL.

The solution is to preserve R_RISCV_CHERI_CCALL through relaxation, but then to remap it onto R_RISCV_CHERIOT_COMPARTMENT_HI / R_RISCV_CHERIOT_COMPARTMENT_LO_I during relocation. This gets us relaxation in the common case, and correct offsetting in the scenario where relaxation fails.

@resistor resistor changed the title [cheriot] If a R_RISCV_CHERI_CCALL relocation survives relocation, remap it to CHERIOT compartment relocs. [cheriot] If a R_RISCV_CHERI_CCALL reloc survives relaxation, remap it to CHERIOT compartment relocs. Feb 14, 2025
@resistor
Copy link
Collaborator Author

Fixes #106

…t to CHERIOT compartment relocs.

This is needed because Cheriot uses 11-bit shifts on AUIPCC (differing from normal RISC-V CHERI), and requires that the HI and LO relocs offset the target in the same direction. This is meant to be handled for all of Cheriot via R_RISCV_CHERIOT_COMPARTMENT_HI and R_RISCV_CHERIOT_COMPARTMENT_LO_I, but that is complicated by the simultaneous need to relax calls in (almost) all situations, which requires using R_RISCV_CHERI_CCALL.

The solution is to preserve R_RISCV_CHERI_CCALL through relaxation, but then to remap it onto R_RISCV_CHERIOT_COMPARTMENT_HI / R_RISCV_CHERIOT_COMPARTMENT_LO_I during relocation. This gets us relaxation in the common case, and correct offsetting in the scenario where relaxation fails.
@resistor
Copy link
Collaborator Author

Superseded by #114

@resistor resistor closed this Feb 15, 2025
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