[PATCH] [PATCH] riscv: Fix jal immediate encoding for constant offsets
Jan Beulich
jbeulich@suse.com
Mon Jun 16 15:18:28 GMT 2025
On 16.06.2025 17:03, Mingzhu Yan wrote:
> This patch corrects an issue in the riscv gas where
> JMP instructions with constant, non-symbolic PC-relative
> offsets were incorrectly assembled with a zero immediate.
>
> Previously, an instruction like j 4 would incorrectly assemble to
> 0 0000006f j 0 <.text>
>
> But now, it is
> 0: 0040006f j 4 <.text+0x4>
Which isn't correct, imo. If you want to express the latter, the source
ought to be "j .+4". Whereas "j 4" means a jump to absolute address 4.
Unless there's anything in the RISC-V assembler spec that makes it
different in this regard from any other target I know of.
Jan
More information about the Binutils
mailing list