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

From: kernel test robot
Date: Sat Apr 01 2023 - 18:34:55 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 00c7b5f4ddc5b346df62b757ec73f9357bb452af
commit: ffe74a6dc9bc47c7c1bb8e9a3d017f6bd5496d76 m68knommu: fix ucsimm sparse warnings
date: 1 year, 1 month ago
config: powerpc-randconfig-r016-20230402 (https://download.01.org/0day-ci/archive/20230402/202304020631.WHiXIj5y-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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 powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ffe74a6dc9bc47c7c1bb8e9a3d017f6bd5496d76
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ffe74a6dc9bc47c7c1bb8e9a3d017f6bd5496d76
# 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=powerpc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304020631.WHiXIj5y-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> ld.lld: error: relocation R_PPC_ADDR16_HI cannot be used against symbol 'init_thread_union'; recompile with -fPIC
>>> referenced by arch/powerpc/kernel/head_44x.o:(.head.text+0x4E)
--
>> ld.lld: error: relocation R_PPC_ADDR16_LO cannot be used against symbol 'init_thread_union'; recompile with -fPIC
>>> referenced by arch/powerpc/kernel/head_44x.o:(.head.text+0x52)
--
>> ld.lld: error: relocation R_PPC_ADDR16_HI cannot be used against local symbol; recompile with -fPIC
>>> defined in arch/powerpc/kernel/head_44x.o
>>> referenced by arch/powerpc/kernel/head_44x.o:(.head.text+0x1676)
--
>> ld.lld: error: relocation R_PPC_ADDR16_HI cannot be used against local symbol; recompile with -fPIC
>>> defined in arch/powerpc/kernel/head_44x.o
>>> referenced by arch/powerpc/kernel/head_44x.o:(.head.text+0x1686)
--
>> ld.lld: error: relocation R_PPC_ADDR16_HI cannot be used against local symbol; recompile with -fPIC
>>> defined in arch/powerpc/kernel/head_44x.o
>>> referenced by arch/powerpc/kernel/head_44x.o:(.head.text+0x17DA)

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