This requires adding Delta{32,64} and NegDelta32 edge kinds that cannot be mapped to existing relocations.
Details
Diff Detail
Event Timeline
FWIW I thought we could reuse the ADD* relocations here, but it turns out the documentation had a sign error in the fixup expressions; I corrected that in rGf9d55410e242761d6d8697def28a86342560a60c.
It seems I created a PR implementing essentially the same thing :) Since both patches are equivalent, I don't mind which one gets merged.
My PR has one extra test case that checks if the values for CIE_pointer, address_range, and DW_CFA_advance_loc are patched correctly. It might be worth adding that test case to this patch.
llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp | ||
---|---|---|
462 | This is the same as R_RISCV_32_PCREL so maybe just reuse that one? At some point, R_RISCV_32_PCREL should be renamed to Delta32 though. | |
473 | Add range check? |
llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp | ||
---|---|---|
462 | Actually the (positive) Delta edges are not needed at all; the hypothetical AddFDEToCIEEdges discussed in https://reviews.llvm.org/D157802 only needs NegDelta32. That's another reason why I think it's the way to go. |
llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp | ||
---|---|---|
462 | Ah yes, you're right. I see the point about AddFDEToCIEEdges but I worry a bit about the (non-trivial) code duplication it would introduce. The documentation of EHFrameEdgeFixer mentions that it should be fine to provide Edge::Invalid for unsupported edge kinds but the implementation doesn't seem to check for that. Maybe this could be a way to configure it to not do more than necessary on RISC-V? |
Superseded by https://github.com/llvm/llvm-project/pull/68253 which implements only one newly needed edge kind.
This is the same as R_RISCV_32_PCREL so maybe just reuse that one? At some point, R_RISCV_32_PCREL should be renamed to Delta32 though.