Re: [rust:rust-next 2/24] ld.lld: error: kernel/built-in.a(kallsyms.o):(function get_symbol_offset: .text+0x5f0): relocation R_RISCV_PCREL_HI20 out of range: -524435 is not in [-524288, 524287]; references kallsyms_names

From: Yujie Liu
Date: Sat Jun 04 2022 - 06:14:45 EST


On 6/3/2022 19:01, Miguel Ojeda wrote:
On Fri, Jun 3, 2022 at 12:32 PM kernel test robot <yujie.liu@xxxxxxxxx> wrote:

>> ld.lld: error: kernel/built-in.a(kallsyms.o):(function get_symbol_offset: .text+0x5f0): relocation R_RISCV_PCREL_HI20 out of range: -524435 is not in [-524288, 524287]; references kallsyms_names
>>> referenced by kallsyms.c
>>> defined in kernel/built-in.a(kallsyms.o)

There are similar reports for the same relocation type in trees
without Rust support merged, so this might not be being triggered by
Rust itself, e.g.:

https://lore.kernel.org/llvm/202206010956.rOpdU4dr-lkp@xxxxxxxxx/
https://lore.kernel.org/llvm/202205280837.PPVZBhXr-lkp@xxxxxxxxx/

Thanks for the info, it looks like an existing relocation issue in
kallsyms under riscv arch.

commit 2087d6ac3567b (kallsyms: support "big" kernel symbols) changed
some code of kallsyms to support long Rust symbols, so it exposed that
relocation issue and triggered this report.

We'll do more checks next time to ensure the reported issue is indeed
Rust related.

Thanks,
Yujie


Cheers,
Miguel