The various ADD/SUB relocations work by reading the current value the
relocation points to, transforming it, and then writing it back to
memory. While the current implementation writes the value back to
working memory, it reads the current value from the execution address of
the relocation. This causes at least wrong results, but often crashes,
when the addresses of working memory are not equal to execution
addresses. This patch fixes this by reading the current value from
working memory.
The bug was noticed by applying the BOLT RISC-V port patch (D145687) on
top of the patch that moves BOLT to JITLink (D147544). In the case of
BOLT, working memory and execution addresses are not equal.