[PATCH] D146546: [BOLT][RFC] Implement composed relocations

Denis Revunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 04:21:09 PDT 2023

treapster added a comment.

In D146546#4212632 <https://reviews.llvm.org/D146546#4212632>, @jobnoorman wrote:

> I do think there is some information loss, though: since the relocation type is replaced by a "bogus" one, we won't know what the original type was. For composed relocations, the type of the last one determines how the value is written. Since we lost that type, this could be an issue. Now, for the relocations on RISC-V that are used in a composed way (ADD32/SUB32), this doesn't matter since their size corresponds to the "bogus" ones so this might just be a mere theoretical issue.
> In any case, since this heavily changes one of the core data structures in BOLT, I'll leave it for others to decide which approach is preferable :)

We do lose the original type, but on the other hand MCStreamer doesn't get original type anyway since it only knows about expressions and size(which we save in type), and it's just a matter of whether we convert to MCExpr in Relocation::emit or earlier when creating the relocation instance. But since i mix Relocation with MCExpr and explicitly delegate handling of composed relocations to external code, i'd also wait for others to decide whether they like it.

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list