Re: [PATCH v4 09/13] riscv: switch to relative alternative entries

From: Andrew Jones
Date: Fri Jan 20 2023 - 13:34:26 EST


On Sun, Jan 15, 2023 at 11:49:49PM +0800, Jisheng Zhang wrote:
...
> #define ALT_ENTRY(oldptr, newptr, vendor_id, errata_id, newlen) \
> - RISCV_PTR " " oldptr "\n" \
> - RISCV_PTR " " newptr "\n" \
> - REG_ASM " " vendor_id "\n" \
> - REG_ASM " " newlen "\n" \
> - ".word " errata_id "\n"
> + ".4byte ((" oldptr ") - .) \n" \
> + ".4byte ((" newptr ") - .) \n" \
> + ".2byte " vendor_id "\n" \
> + ".2byte " newlen "\n" \
> + ".4byte " errata_id "\n"
>

Hi Jisheng,

This patch breaks loading the KVM module for me. I got "kvm: Unknown
relocation type 34". My guess is that these 2 byte fields are inspiring
the compiler to emit 16-bit relocation types. The patch below fixes
things for me. If you agree with fixing it this way, rather than
changing something in alternatives, like not using 2 byte fields,
then please pick the below patch up in your series.

Thanks,
drew