mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 18:00:17 +02:00
FEX Relocations now live at an offset from the `CodeData.BlockBegin` of the code. Regardless of where the relocation moves to, it should always be relative to that address. This is what makes it PIC compatible. We were preemptively offsetting the relocation location to be relative to the memory base in the buffer, which is unnecessary and causes code caching to basically relocate twice to get the real location. So in JIT.cpp, stop relocating the offsets, they're already relative to `BlockBegin`, which is offset 0. Then when storing the relocation, stop relocating offsets AGAIN because it's already relative to the code being serialized. Then when loading the relocations in `CodeCache::ApplyCodeRelocations` stop relocating offsets YET ANOTHER TIME. All this is to say that relocation offsets are already PIC and relative to offset 0, so we don't need to do it three times.