2024-02-06 05:22:40

by kernel test robot

[permalink] [raw]
Subject: ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names

Hi Zhen,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478
commit: 60443c88f3a89fd303a9e8c0e84895910675c316 kallsyms: Improve the performance of kallsyms_lookup_name()
date: 1 year, 3 months ago
config: riscv-randconfig-r064-20240120 (https://download.01.org/0day-ci/archive/20240206/[email protected]/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240206/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names
>>> referenced by kallsyms.c
>>> defined in vmlinux.a(kernel/kallsyms.o)

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


2024-02-18 02:08:44

by Leizhen (ThunderTown)

[permalink] [raw]
Subject: Re: ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names



On 2024/2/6 13:19, kernel test robot wrote:
> Hi Zhen,
>
> FYI, the error/warning still remains.

I'm trying to reproduce it. But I'm having a little trouble getting
the environment ready.

>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478
> commit: 60443c88f3a89fd303a9e8c0e84895910675c316 kallsyms: Improve the performance of kallsyms_lookup_name()
> date: 1 year, 3 months ago
> config: riscv-randconfig-r064-20240120 (https://download.01.org/0day-ci/archive/20240206/[email protected]/config)
> compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240206/[email protected]/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>
> All errors (new ones prefixed by >>):
>
>>> ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names
> >>> referenced by kallsyms.c
> >>> defined in vmlinux.a(kernel/kallsyms.o)
>

--
Regards,
Zhen Lei


2024-02-20 12:27:41

by Leizhen (ThunderTown)

[permalink] [raw]
Subject: Re: ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names



On 2024/2/18 10:08, Leizhen (ThunderTown) wrote:
>
>
> On 2024/2/6 13:19, kernel test robot wrote:
>> Hi Zhen,
>>
>> FYI, the error/warning still remains.
>
> I'm trying to reproduce it. But I'm having a little trouble getting
> the environment ready.

Sorry, I tried but it was not reproduced. I made the following two changes
to the steps in the 'reproduce' link:
1. Put linux and lkp-tests in two directories of the same level. Because:
$ git fetch --no-tags linus master
error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403
fatal: error reading section header 'acknowledgments'
2. Compiler was specified by following the prompts.
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang-17 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=riscv olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang-17 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Image is finally generated, so there should be no problem with the above steps being adjusted:
$ ls build_dir/arch/riscv/boot/
dts Image loader loader.bin loader.lds loader.o

By the way, all the symbols to be reported "relocation R_RISCV_PCREL_HI20 out of range" is
generated by the tool kallsyms (scripts/kallsyms.c). So, it seems that the tool kallsyms
have not been executed. And this error is not caused by my patches.

>
>>
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: 54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478
>> commit: 60443c88f3a89fd303a9e8c0e84895910675c316 kallsyms: Improve the performance of kallsyms_lookup_name()
>> date: 1 year, 3 months ago
>> config: riscv-randconfig-r064-20240120 (https://download.01.org/0day-ci/archive/20240206/[email protected]/config)
>> compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240206/[email protected]/reproduce)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot <[email protected]>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>>
>> All errors (new ones prefixed by >>):
>>
>>>> ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names
>> >>> referenced by kallsyms.c
>> >>> defined in vmlinux.a(kernel/kallsyms.o)
>>
>

--
Regards,
Zhen Lei


2024-03-12 06:00:47

by kernel test robot

[permalink] [raw]
Subject: Re: ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names

Hi Zhen,

On Tue, Feb 20, 2024 at 08:27:15PM +0800, Leizhen (ThunderTown) wrote:
> > On 2024/2/6 13:19, kernel test robot wrote:
> >> Hi Zhen,
> >>
> >> FYI, the error/warning still remains.
> >
> > I'm trying to reproduce it. But I'm having a little trouble getting
> > the environment ready.
>
> Sorry, I tried but it was not reproduced. I made the following two changes
> to the steps in the 'reproduce' link:
> 1. Put linux and lkp-tests in two directories of the same level. Because:
> $ git fetch --no-tags linus master
> error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403
> fatal: error reading section header 'acknowledgments'
> 2. Compiler was specified by following the prompts.
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang-17 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=riscv olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang-17 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sorry for our late reply. We rechecked this case and noticed that this
issue can be reproduced by clang-15, but can't be reproduced by newer
version of clang. Not sure if this is a flaw in old version of LLVM
toolchain, just for your information.

$ COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang-15 ~/lkp-tests/kbuild/make.cross W=1 ARCH=riscv
..
LD .tmp_vmlinux.kallsyms1
ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x70): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_num_syms
>>> referenced by kallsyms.c
>>> defined in vmlinux.a(kernel/kallsyms.o)

ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names
>>> referenced by kallsyms.c
>>> defined in vmlinux.a(kernel/kallsyms.o)
..

Thanks,
Yujie

>
> Image is finally generated, so there should be no problem with the above steps being adjusted:
> $ ls build_dir/arch/riscv/boot/
> dts Image loader loader.bin loader.lds loader.o
>
> By the way, all the symbols to be reported "relocation R_RISCV_PCREL_HI20 out of range" is
> generated by the tool kallsyms (scripts/kallsyms.c). So, it seems that the tool kallsyms
> have not been executed. And this error is not caused by my patches.
>
> >
> >>
> >> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> >> head: 54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478
> >> commit: 60443c88f3a89fd303a9e8c0e84895910675c316 kallsyms: Improve the performance of kallsyms_lookup_name()
> >> date: 1 year, 3 months ago
> >> config: riscv-randconfig-r064-20240120 (https://download.01.org/0day-ci/archive/20240206/[email protected]/config)
> >> compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
> >> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240206/[email protected]/reproduce)
> >>
> >> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> >> the same patch/commit), kindly add following tags
> >> | Reported-by: kernel test robot <[email protected]>
> >> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> >>
> >> All errors (new ones prefixed by >>):
> >>
> >>>> ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names
> >> >>> referenced by kallsyms.c
> >> >>> defined in vmlinux.a(kernel/kallsyms.o)
> >>
> >

2024-03-13 02:22:44

by Leizhen (ThunderTown)

[permalink] [raw]
Subject: Re: ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names



On 2024/3/12 13:53, Yujie Liu wrote:
> Hi Zhen,
>
> On Tue, Feb 20, 2024 at 08:27:15PM +0800, Leizhen (ThunderTown) wrote:
>>> On 2024/2/6 13:19, kernel test robot wrote:
>>>> Hi Zhen,
>>>>
>>>> FYI, the error/warning still remains.
>>>
>>> I'm trying to reproduce it. But I'm having a little trouble getting
>>> the environment ready.
>>
>> Sorry, I tried but it was not reproduced. I made the following two changes
>> to the steps in the 'reproduce' link:
>> 1. Put linux and lkp-tests in two directories of the same level. Because:
>> $ git fetch --no-tags linus master
>> error: RPC failed; HTTP 403 curl 22 The requested URL returned error: 403
>> fatal: error reading section header 'acknowledgments'
>> 2. Compiler was specified by following the prompts.
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang-17 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=riscv olddefconfig
>> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang-17 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Sorry for our late reply. We rechecked this case and noticed that this
> issue can be reproduced by clang-15, but can't be reproduced by newer
> version of clang. Not sure if this is a flaw in old version of LLVM
> toolchain, just for your information.

Well, I was able to reproduce it, too, after changing to clang-15.
It should be a problem with the LLVM toolchain. After all, the Linux
source code has not changed. The problem occurs in the linking phase
of Linux, not in the execution phase of Linux. In addition to the few
symbols I added that failed to relocate, the original ones also failed
to relocate. I am not familiar with the source code of the compiler,
so I cannot further analyze the root cause.

Here is a brief description of how kallsyms works. This may help you
understand the problem.
1. Build Linux source code, generate a symbol table.
2. Run tool kallsyms to read above symbol table, rearranges symbol
information as needed for lookup by name and lookup by address. Record
these new information into kallsyms_seqs_of_names[], etc. Insert the new
variables into a new C file.
3. Rebuild Linux with the new C file. The problem is at this stage, for
those symbols added by tool kallsyms, the relocation fails.

>
> $ COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang-15 ~/lkp-tests/kbuild/make.cross W=1 ARCH=riscv
> ..
> LD .tmp_vmlinux.kallsyms1
> ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x70): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_num_syms
>>>> referenced by kallsyms.c
>>>> defined in vmlinux.a(kernel/kallsyms.o)
>
> ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names
>>>> referenced by kallsyms.c
>>>> defined in vmlinux.a(kernel/kallsyms.o)
> ..
>
> Thanks,
> Yujie
>
>>
>> Image is finally generated, so there should be no problem with the above steps being adjusted:
>> $ ls build_dir/arch/riscv/boot/
>> dts Image loader loader.bin loader.lds loader.o
>>
>> By the way, all the symbols to be reported "relocation R_RISCV_PCREL_HI20 out of range" is
>> generated by the tool kallsyms (scripts/kallsyms.c). So, it seems that the tool kallsyms
>> have not been executed. And this error is not caused by my patches.
>>
>>>
>>>>
>>>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>>>> head: 54be6c6c5ae8e0d93a6c4641cb7528eb0b6ba478
>>>> commit: 60443c88f3a89fd303a9e8c0e84895910675c316 kallsyms: Improve the performance of kallsyms_lookup_name()
>>>> date: 1 year, 3 months ago
>>>> config: riscv-randconfig-r064-20240120 (https://download.01.org/0day-ci/archive/20240206/[email protected]/config)
>>>> compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
>>>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240206/[email protected]/reproduce)
>>>>
>>>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>>>> the same patch/commit), kindly add following tags
>>>> | Reported-by: kernel test robot <[email protected]>
>>>> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
>>>>
>>>> All errors (new ones prefixed by >>):
>>>>
>>>>>> ld.lld: error: vmlinux.a(kernel/kallsyms.o):(function kallsyms_lookup_name: .text+0x90): relocation R_RISCV_PCREL_HI20 out of range: -524416 is not in [-524288, 524287]; references kallsyms_seqs_of_names
>>>> >>> referenced by kallsyms.c
>>>> >>> defined in vmlinux.a(kernel/kallsyms.o)
>>>>
>>>
>
> .
>

--
Regards,
Zhen Lei