Skip to content

Conversation

@resistor
Copy link
Collaborator

@resistor resistor commented Nov 3, 2025

  • [ELF][RISCV] Don't set sizeRel
  • [ELF][RISCV] Don't set cheriCapCallRel
  • [RISCV] Drop CHERI-RISC-V-specific assembly modifiers and relocations
  • [BinaryFormat][RISCV] Mark no-longer used CHERI relocations deprecated
  • [BinaryFormat][RISCV] Ditch R_RISCV_CHERI_CAPABILITY_CALL in comment
  • [BinaryFormat][RISCV] Delete R_RISCV_CHERI_SIZE
  • [ELF][CHERI] Support creating new capability relocations against sections
  • [ELF][RISCV] Stop using CSub for capability subtraction

This exists to support __cap_relocs for preemptible symbols, but that
was always a bit broken and was replaced long ago even on CHERI-MIPS
with proper ELF relocations (though the option not to still exists).
CHERI-RISC-V never used this, and CheriBSD does not support it.
This was never on CHERI-RISC-V even when we used .captable, as we passed
R_CHERI_CAPABILITY_TABLE_INDEX to ensure the relocation was in .rela.dyn
and thus would also use cheriCapRel rather than cheriCapCallRel. Now the
normal .got is used instead there isn't even a path that could use this.
LLD is now using a normal GOT so all the captable-related names are a
misnomer, instead they should be the same as the normal GOT ones. We can
also drop various other gratuitously-different relocations and modifiers
whilst here. The idea was to make it possible to support mixing integer
and capability mode instructions when it comes to instructions that need
relocations, but that comes down to the same problem that R_RISCV_RELAX
faces when it comes to .option arch, so we shouldn't be doing something
special here that leads to a bunch of unnecessary divergence.

As far as I know we don't have any assembly in our software stack that
uses these modifiers, it all uses the pseudos that hide this detail.
We can just reuse R_RISCV_JUMP_SLOT when needed.
This has never actually been used (it only appeared to be used in LLD,
but never was in practice), nor is it supported by any run-time linker.
…ions

This will be needed to initialise .got.plt entries to refer to .plt[0].
The infrastructure is already mostly there, we just need to expose it
via the addCapabilityRelocation interface and remove some assumptions.
@resistor resistor changed the title Cherry-pick further changes from CTSRD main up to a913ff1527a8dc62c3fe2718a0efc8f9a5b9a05c Cherry-pick further changes from CTSRD main up to b20a2cbea5a8fbf1f4ec7c9a53e0fe03c96cc052 Nov 3, 2025
This code is currently dead since we emit an all-zeroes PLT header on
CHERI-RISC-V, but will soon be used.

Fixes: 05652b9 ("[CHERI-RISC-V] Remove CSub")
@resistor resistor merged commit 8dc739e into CHERIoT-Platform:cheriot Nov 3, 2025
7 checks passed
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.

2 participants