Message ID | 20221206044051.322543-8-richard.henderson@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | tcg/loongarch64: Reorg goto_tb and cleanups | expand |
On 6/12/22 05:40, Richard Henderson wrote: > Take the w^x split into account when computing the > pc-relative distance to an absolute pointer. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > tcg/loongarch64/tcg-target.c.inc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On 6/12/22 05:40, Richard Henderson wrote: > Take the w^x split into account when computing the > pc-relative distance to an absolute pointer. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > tcg/loongarch64/tcg-target.c.inc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc > index 2044897e36..47465b8c20 100644 > --- a/tcg/loongarch64/tcg-target.c.inc > +++ b/tcg/loongarch64/tcg-target.c.inc > @@ -701,7 +701,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); Nitpicking? const void *. > > if (addr == TCG_REG_ZERO && diff == (int32_t)diff) { > imm12 = sextreg(diff, 0, 12);
diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 2044897e36..47465b8c20 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -701,7 +701,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);
Take the w^x split into account when computing the pc-relative distance to an absolute pointer. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- tcg/loongarch64/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)