On 2026-09-13 14:08, Richard Henderson wrote: > From: Max Chou <[email protected]> > > reloc_call splits a PC-relative offset into a signed 12-bit low > immediate and an AUIPC contribution. When the low immediate carries > into bit 31, the existing 32-bit arithmetic can accept an unencodable > positive 0x80000000 AUIPC contribution. > > Keep the split in pointer-width arithmetic and reject it unless the > rounded upper contribution is representable as signed 32-bit. Factor > this validation into split_auipc_offset so reloc_call retains its > existing failure contract. > > Fixes: dfa8e74f9463 ("tcg/riscv: Add the relocation functions") > Reviewed-by: Philippe Mathieu-Daudé <[email protected]> > Signed-off-by: Max Chou <[email protected]> > [rth: Pass target as intptr_t to split_auipc_offset.] > Signed-off-by: Richard Henderson <[email protected]> > --- > tcg/riscv64/tcg-target.c.inc | 24 +++++++++++++++++++----- > 1 file changed, 19 insertions(+), 5 deletions(-) >
Reviewed-by: Max Chou <[email protected]> Thanks, rnax
