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

From: kernel test robot
Date: Mon Aug 19 2024 - 09:55:54 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 47ac09b91befbb6a235ab620c32af719f8208399
commit: f0c83a23fcbb424fdff5b38fbcdda3c04003a210 Bluetooth: btmtk: Fix btmtk.c undefined reference build error
date: 3 weeks ago
config: riscv-randconfig-001-20240819 (https://download.01.org/0day-ci/archive/20240819/202408192115.CLzfNikL-lkp@xxxxxxxxx/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 26670e7fa4f032a019d23d56c6a02926e854e8af)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240819/202408192115.CLzfNikL-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/202408192115.CLzfNikL-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> ld.lld: error: relocation R_RISCV_HI20 cannot be used against symbol 'errata_list'; recompile with -fPIC
>>> defined in vmlinux.a(arch/riscv/errata/sifive/errata.o)
>>> referenced by errata.c:0 (arch/riscv/errata/sifive/errata.c:0)
>>> arch/riscv/errata/sifive/errata.o:(sifive_errata_patch_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_LO12_I cannot be used against symbol 'errata_list'; recompile with -fPIC
>>> defined in vmlinux.a(arch/riscv/errata/sifive/errata.o)
>>> referenced by errata.c:0 (arch/riscv/errata/sifive/errata.c:0)
>>> arch/riscv/errata/sifive/errata.o:(sifive_errata_patch_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_HI20 cannot be used against symbol '.L.str.4'; 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:(sifive_errata_patch_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_LO12_I cannot be used against symbol '.L.str.4'; 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:(sifive_errata_patch_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_HI20 cannot be used against symbol 'riscv_cbom_block_size'; recompile with -fPIC
>>> defined in vmlinux.a(arch/riscv/mm/cacheflush.o)
>>> referenced by errata.c:113 (arch/riscv/errata/thead/errata.c:113)
>>> arch/riscv/errata/thead/errata.o:(thead_errata_patch_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_LO12_S cannot be used against symbol 'riscv_cbom_block_size'; recompile with -fPIC
>>> defined in vmlinux.a(arch/riscv/mm/cacheflush.o)
>>> referenced by errata.c:120 (arch/riscv/errata/thead/errata.c:120)
>>> arch/riscv/errata/thead/errata.o:(thead_errata_patch_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_HI20 cannot be used against symbol 'text_mutex'; recompile with -fPIC
>>> defined in vmlinux.a(kernel/extable.o)
>>> referenced by errata.c:71 (arch/riscv/errata/sifive/errata.c:71)
>>> arch/riscv/errata/sifive/errata.o:(sifive_errata_patch_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_LO12_I cannot be used against symbol 'text_mutex'; recompile with -fPIC
>>> defined in vmlinux.a(kernel/extable.o)
>>> referenced by errata.c:71 (arch/riscv/errata/sifive/errata.c:71)
>>> arch/riscv/errata/sifive/errata.o:(sifive_errata_patch_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_HI20 cannot be used against symbol '.L.str'; 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:(sifive_errata_patch_func) in archive vmlinux.a
--
>> ld.lld: error: relocation R_RISCV_LO12_I cannot be used against symbol '.L.str'; 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:(sifive_errata_patch_func) in archive vmlinux.a

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