PseudoTail should be a software guarded branch in Ziciflp, since its branch
target is known in link time. JALR/C.JR/C.JALR with rs1 as t2 is termed a
software guarded branch. Such branches do not need to land on a lpad instruction.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
60,030 ms | x64 debian > MLIR.Examples/standalone::test.toy |
Event Timeline
https://github.com/riscv-non-isa/riscv-asm-manual/blob/master/riscv-asm.md#-a-listing-of-standard-risc-v-pseudoinstructions very clearly states that x6 is the register used. What's wrong with t1? x1 and x5 are special as the registers for microarchitectural push/pop hints and, with Zicfilp, repurposed for shadow stack push/pop (somewhat ew), but neither x6 nor x7 are mentioned in the CFI spec that I can see.
Oh I see, https://github.com/riscv/riscv-cfi/blob/main/cfi_forward.adoc does. Why on earth did they pick x7 for tail when x6 is the register defined for tail?
Is it because x7 is the landing pad label? So if the call used x7 as the address then its clearly does not contain a landing pad label? I'm just guessing.
So why not make x6 the landing pad label if they want everything to be in one register...
Software guarded branches changed to x6 here https://github.com/riscv/riscv-cfi/commit/aaea3077bc4256dd56b07403cd1b88ca46b83c27 but then changed back https://github.com/riscv/riscv-cfi/commit/afbc2d5544f8ceda4a69d4c1ba17efc7c2c639d3
I found as much, but not any justification for these changes anywhere, just unhelpful commits that don't document any rationale.
https://github.com/riscv/riscv-cfi/issues/125#issuecomment-1686258580
In this comment, Ved says that x6/t1 plays an ABI role in passing information between the PLT header and the dynamic linker.