[JITLink][RISCV] Move relax to PostAllocationPasses
authorJob Noorman <jnoorman@igalia.com>
Thu, 6 Jul 2023 07:28:13 +0000 (09:28 +0200)
committerJob Noorman <jnoorman@igalia.com>
Thu, 6 Jul 2023 07:35:17 +0000 (09:35 +0200)
commit1e60ab0fbe1961074c3673070be0e3c2211c8084
tree90fe700ed48c836611d05a80c33c72c76fcb106a
parent2712b2805b47f10b3864ab19a4016ea306126ad7
[JITLink][RISCV] Move relax to PostAllocationPasses

`JITLinkContext` is notified (using `notifyResolved`) of the final
symbol addresses after allocating memory and running the post-allocation
passes. However, linker relaxation, which can cause symbol addresses to
change, was run during the pre-fixup passes. This causes users of
JITLink (e.g., ORC) to pick-up wrong symbol addresses when linker
relaxation was enabled.

This patch fixes this by running relaxation during the post-allocation
passes.

Fixes #63671

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D154501
llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h
llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp