2022-05-29 00:24:36

by kernel test robot

[permalink] [raw]
Subject: <instantiation>:2:2: error: out of range pc-relative fixup value

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9d004b2f4fea97cde123e7f1939b80e77bf2e695
commit: 508074607c7b95b24f0adf633fdf606761bb7824 ARM: 9195/1: entry: avoid explicit literal loads
date: 9 days ago
config: arm-randconfig-r005-20220529 (https://download.01.org/0day-ci/archive/20220529/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0fbe3f3f486e01448121f7931a4ca29fac1504ab)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=508074607c7b95b24f0adf633fdf606761bb7824
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 508074607c7b95b24f0adf633fdf606761bb7824
# 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=arm 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 >>):

>> <instantiation>:2:2: error: out of range pc-relative fixup value
ldr tsk, =__current
^

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


2022-05-30 13:48:17

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: <instantiation>:2:2: error: out of range pc-relative fixup value

(cc Nathan and Nick)

On Sun, 29 May 2022 at 02:22, kernel test robot <[email protected]> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 9d004b2f4fea97cde123e7f1939b80e77bf2e695
> commit: 508074607c7b95b24f0adf633fdf606761bb7824 ARM: 9195/1: entry: avoid explicit literal loads
> date: 9 days ago
> config: arm-randconfig-r005-20220529 (https://download.01.org/0day-ci/archive/20220529/[email protected]/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0fbe3f3f486e01448121f7931a4ca29fac1504ab)
> 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 arm cross compiling tool for clang build
> # apt-get install binutils-arm-linux-gnueabi
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=508074607c7b95b24f0adf633fdf606761bb7824
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 508074607c7b95b24f0adf633fdf606761bb7824
> # 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=arm 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 >>):
>
> >> <instantiation>:2:2: error: out of range pc-relative fixup value
> ldr tsk, =__current
> ^
>

This log snippet is a bit terse. I managed to narrow this down to
arch/arm/kernel/entry-common.S but having a bit more context from the
build log would be useful here.

The commit in question reorganizes some variable loads from asm code
by switching to the ldr_va macro, which avoids literals in most cases,
but not when CONFIG_COMPILE_TEST=y as is the case here. (This is due
to the fact that allyesconfig produces a vmlinux image whose size
exceeds the 256 MB range of ARM group relocations used by ldr_va, and
so group relocations are not used in this case)

This means that those ldr_va macros evaluate to literal loads such as
the 'ldr tsk, =__current' reported above, and the literal pool entry
carrying the address of __current can no longer be emitted close
enough to the LDR instruction itself, due to the way those literal
loads have been slightly reshuffled by that commit.

This is easily fixed by putting a .ltorg directive in the appropriate
location (I'll send out the patch right away) but it does beg the
question whether or not we need to keep allyesconfig building, given
that it cannot actually boot on a real (or emulated) system.