aboutsummaryrefslogtreecommitdiff
path: root/tcg
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-11-29 09:03:23 -0800
committerRichard Henderson <richard.henderson@linaro.org>2023-01-23 16:00:13 -1000
commit21199bfbef8b69305cf419e22a455e7a1923c4ba (patch)
tree57dc4a8b8a36cbd80369d4d8516e079eef756204 /tcg
parent7bc76a4c2e996add45291ed75ab417314a87427c (diff)
downloadqemu-21199bfbef8b69305cf419e22a455e7a1923c4ba.zip
qemu-21199bfbef8b69305cf419e22a455e7a1923c4ba.tar.gz
qemu-21199bfbef8b69305cf419e22a455e7a1923c4ba.tar.bz2
tcg/loongarch64: Use tcg_pcrel_diff in tcg_out_ldst
Take the w^x split into account when computing the pc-relative distance to an absolute pointer. Reviewed-by: WANG Xuerui <git@xen0n.name> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r--tcg/loongarch64/tcg-target.c.inc2
1 files changed, 1 insertions, 1 deletions
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc
index 29d75c8..d6926bd 100644
--- a/tcg/loongarch64/tcg-target.c.inc
+++ b/tcg/loongarch64/tcg-target.c.inc
@@ -702,7 +702,7 @@ static void tcg_out_ldst(TCGContext *s, LoongArchInsn opc, TCGReg data,
intptr_t imm12 = sextreg(offset, 0, 12);
if (offset != imm12) {
- intptr_t diff = offset - (uintptr_t)s->code_ptr;
+ intptr_t diff = tcg_pcrel_diff(s, (void *)offset);
if (addr == TCG_REG_ZERO && diff == (int32_t)diff) {
imm12 = sextreg(diff, 0, 12);