diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2023-01-17 13:04:15 -1000 |
---|---|---|
committer | Alistair Francis <alistair.francis@wdc.com> | 2023-01-20 10:14:14 +1000 |
commit | 9d9db41373a256c5ae011c1428d26d2597a77484 (patch) | |
tree | 5c4571ed3c4f5436cf26f8fbec88c6f6c4649267 /tcg/riscv | |
parent | e471a8c9850f1af0c1bc5768ca28285348cdd6c5 (diff) | |
download | qemu-9d9db41373a256c5ae011c1428d26d2597a77484.zip qemu-9d9db41373a256c5ae011c1428d26d2597a77484.tar.gz qemu-9d9db41373a256c5ae011c1428d26d2597a77484.tar.bz2 |
tcg/riscv: Use tcg_pcrel_diff in tcg_out_ldst
We failed to update this with the w^x split, so misses the fact
that true pc-relative offsets are usually small.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20230117230415.354239-1-richard.henderson@linaro.org>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'tcg/riscv')
-rw-r--r-- | tcg/riscv/tcg-target.c.inc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index fc0edd8..01cb67e 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -599,7 +599,7 @@ static void tcg_out_ldst(TCGContext *s, RISCVInsn 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); |