2022-06-03 13:23:08

by Yujie Liu

[permalink] [raw]
Subject: [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

tree: https://github.com/Rust-for-Linux/linux rust-next
head: 9a5fe747d99e1d562dde1f39259bbe2d098262ae
commit: 2087d6ac3567b38f2cddfa8fa445e595af87a04a [2/24] kallsyms: support "big" kernel symbols
config: riscv-buildonly-randconfig-r002-20220523 (attached as .config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 10c9ecce9f6096e18222a331c5e7d085bd813f75)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/Rust-for-Linux/linux/commit/2087d6ac3567b38f2cddfa8fa445e595af87a04a
git remote add rust https://github.com/Rust-for-Linux/linux
git fetch --no-tags rust rust-next
git checkout 2087d6ac3567b38f2cddfa8fa445e595af87a04a
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

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

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
.config.gz (30.13 kB)

2022-06-06 04:32:44

by Yujie Liu

[permalink] [raw]
Subject: 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

On 6/3/2022 19:01, Miguel Ojeda wrote:
> On Fri, Jun 3, 2022 at 12:32 PM kernel test robot <[email protected]> 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/[email protected]/
> https://lore.kernel.org/llvm/[email protected]/

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

2022-06-06 04:37:08

by Miguel Ojeda

[permalink] [raw]
Subject: 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

On Fri, Jun 3, 2022 at 12:32 PM kernel test robot <[email protected]> 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/[email protected]/
https://lore.kernel.org/llvm/[email protected]/

Cheers,
Miguel