ld.lld: error: relocation R_RISCV_HI20 cannot be used against symbol '__sancov_gen_cov_switch_values'; recompile with -fPIC

From: kernel test robot
Date: Sun Sep 08 2024 - 04:44:38 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d1f2d51b711a3b7f1ae1b46701c769c1d580fa7f
commit: f79dc03fe68c79d388908182e68d702f7f1786bc kconfig: refactor choice value calculation
date: 8 weeks ago
config: riscv-randconfig-001-20240908 (https://download.01.org/0day-ci/archive/20240908/202409081658.d1dItwXr-lkp@xxxxxxxxx/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 05f5a91d00b02f4369f46d076411c700755ae041)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240908/202409081658.d1dItwXr-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409081658.d1dItwXr-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> ld.lld: error: relocation R_RISCV_HI20 cannot be used against symbol '__sancov_gen_cov_switch_values'; recompile with -fPIC
>>> defined in vmlinux.a(arch/riscv/errata/sifive/errata.o)
>>> referenced by errata.c:71 (arch/riscv/errata/sifive/errata.c:71)
>>> arch/riscv/errata/sifive/errata.o:(errata_cip_1200_check_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_LO12_I cannot be used against symbol '__sancov_gen_cov_switch_values'; recompile with -fPIC
>>> defined in vmlinux.a(arch/riscv/errata/sifive/errata.o)
>>> referenced by errata.c:71 (arch/riscv/errata/sifive/errata.c:71)
>>> arch/riscv/errata/sifive/errata.o:(errata_cip_1200_check_func) in archive vmlinux.a

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