[PATCH] RISC-V: fix JAL aliases ordering in opcode table

Aurelien Jarno aurelien@aurel32.net
Thu Jan 5 07:56:04 GMT 2023


On 2023-01-04 08:50, Jan Beulich via Binutils wrote:
> On 04.01.2023 06:59, Aurelien Jarno wrote:
> > Commit 839189bc932e ("RISC-V: re-arrange opcode table for consistent
> > alias handling") reorder the instructions in the opcode tables,
> > including the various JAL aliases. In particular they are not ordered
> > anymore from the most specific to the less specific one. This causes the
> > form "JAL reg, imm" to emit a relocation with the register name. This
> > breaks various things like building Linux kernel modules.
> > 
> > This patch fixes the issue by restoring the original ordering of the JAL
> > aliases.
> 
> I'm afraid reverting the "offending" hunk is only a workaround, as it
> would re-introduce the disassembler side issue that the patch tried to
> deal with (and which sadly looks to not be covered by anything in the
> testsuite, or else you would have noticed breakage when testing your
> change). Since I expect that in the course of table lookup it is still
> the correct entry (in particular one with two rather than just one
> operands) which is used, my suspicion is that something somewhere makes
> a silent assumption upon the (original) ordering of table entries. It
> would be that place which needs fixing then; I'll try to find time soon
> to see if I can spot where that is.

Thanks for the analysis. Do you think you have time to get a patch with
that fix before the 2.40 release?

Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net


More information about the Binutils mailing list