Re: [PATCH v4 4/5] LoongArch: Add support for kernel relocation

From: kernel test robot
Date: Fri Feb 10 2023 - 13:02:59 EST


Hi Youling,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.2-rc7 next-20230210]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Youling-Tang/LoongArch-Use-la-pcrel-instead-of-la-abs-when-it-s-trivially-possible/20230210-165022
patch link: https://lore.kernel.org/r/1676018856-26520-5-git-send-email-tangyouling%40loongson.cn
patch subject: [PATCH v4 4/5] LoongArch: Add support for kernel relocation
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20230211/202302110150.tIuRIiTp-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
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
# https://github.com/intel-lab-lkp/linux/commit/26dc7750408c7f232632db44fab905df7b48d83c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Youling-Tang/LoongArch-Use-la-pcrel-instead-of-la-abs-when-it-s-trivially-possible/20230210-165022
git checkout 26dc7750408c7f232632db44fab905df7b48d83c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch SHELL=/bin/bash arch/loongarch/kernel/

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/202302110150.tIuRIiTp-lkp@xxxxxxxxx/

Note: functions only called from assembly code should be annotated with the asmlinkage attribute
All warnings (new ones prefixed by >>):

>> arch/loongarch/kernel/relocate.c:21:13: warning: no previous prototype for 'relocate_kernel' [-Wmissing-prototypes]
21 | void __init relocate_kernel(void)
| ^~~~~~~~~~~~~~~


vim +/relocate_kernel +21 arch/loongarch/kernel/relocate.c

20
> 21 void __init relocate_kernel(void)
22 {
23 reloc_offset = (unsigned long)_text - VMLINUX_LOAD_ADDRESS;
24
25 if (reloc_offset) {
26 Elf64_Rela *rela, *rela_end;
27 rela = (Elf64_Rela *)&__rela_dyn_start;
28 rela_end = (Elf64_Rela *)&__rela_dyn_end;
29
30 for ( ; rela < rela_end; rela++) {
31 Elf64_Addr addr = rela->r_offset;
32 Elf64_Addr relocated_addr = rela->r_addend;
33
34 if (rela->r_info != R_LARCH_RELATIVE)
35 continue;
36
37 if (relocated_addr >= VMLINUX_LOAD_ADDRESS)
38 relocated_addr =
39 (Elf64_Addr)RELOCATED(relocated_addr);
40
41 *(Elf64_Addr *)RELOCATED(addr) = relocated_addr;
42 }
43 }
44 }
45

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