[PATCH] D154501: [JITLink][RISCV] Move relax to PostAllocationPasses

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 00:51:14 PDT 2023


jobnoorman added a comment.

In D154501#4474483 <https://reviews.llvm.org/D154501#4474483>, @lhames wrote:

> It'd be even better if we could catch this in an assert in LinkGraph itself. If we modified the `Section` class to have a pointer back to the `LinkGraph` and modified the `LinkGraph` to track the phase, then we could write checks like:
>
>   void Addressable::setAddress(ExecutorAddr Adds) {
>     assert(
>       (!isDefined() || static_cast<Block&>(*this).getSection().getGraph().getPhase() < PreFixupPass) &&
>       "Cannot change defined symbol address after symbol resolution");
>   }

This looks like an interesting approach but just a heads-up that if you were to implement this now, it might break BOLT. We currently reassign section addresses <https://github.com/llvm/llvm-project/blob/1e60ab0fbe1961074c3673070be0e3c2211c8084/bolt/lib/Rewrite/JITLinkLinker.cpp#L139-L142> within `notifyResolved`. I know this is not the correct approach and I have a local fix for it. This is part of a bigger patch though and it hasn't been submitted yet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154501



More information about the llvm-commits mailing list