[PATCH] D157802: [JITLink][EHFrameSupport] Accept multiple relocations

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 00:16:46 PDT 2023


jobnoorman added a comment.

In D157802#4645560 <https://reviews.llvm.org/D157802#4645560>, @lhames wrote:

> Regarding the edge design: I think the aim for the medium term should be to define whether there can be multiple edges at one location or not, and if so what the expected behavior is. The ultimate goal is to allow plugins to effectively modify fixups, so we'll need either (1) some sort of pattern matching to deal with multiple edges, or (2) a more elaborate edge type and more edge kinds.

On RISC-V, there are two distinct situations where multiple relocations share an offset:

- `R_RISCV_RELAX` together with some relaxable relocation. This is already handled by combining them into a single edge kind (e.g., `CallRelaxable`). This is possible since `R_RISCV_RELAX` doesn't contain any interesting data.
- `R_RISCV_ADD*` (or `R_RISCV_SET*`) together with `R_RISCV_SUB*`. Used to calculate the difference between two arbitrary symbols. It's currently not possible (afaict) to combine these into a single edge because we'd need to store two symbols.

So it seems to me that in order to support all cases, we either need to allow multiple edges at the same offset or to allow edges to store up to two symbols.

> For now we can kick the can down the road a bit by taking the `AddFDEToCIEEdges` approach. Did you get a chance to look at that?

If I understand correctly, `AddFDEToCIEEdges` would implement a subset of what `EHFrameEdgeFixer` does, correct? If so, wouldn't it be easier (and duplicate less code) to ensure `EHFrameEdgeFixer` doesn't err on relocations it doesn't need anyway?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157802/new/

https://reviews.llvm.org/D157802



More information about the llvm-commits mailing list