All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] LoongArch: Support new relocation types
@ 2022-07-27 16:24 Xi Ruoyao
  2022-07-27 16:26 ` [PATCH 1/5] LoongArch: Add section of GOT for kernel module Xi Ruoyao
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Xi Ruoyao @ 2022-07-27 16:24 UTC (permalink / raw)
  To: loongarch; +Cc: linux-kernel, WANG Xuerui, Huacai Chen

The version 2.00 of LoongArch ELF ABI specification introduced new
relocation types, and the development tree of Binutils and GCC has
started to use them.  If the kernel is built with the latest snapshot of
Binutils or GCC, it will fail to load the modules because of unrecognized
relocation types in modules.

Add support for GOT and new relocation types for the module loader, so
the kernel (with modules) can be built with the "normal" code model and
function properly.

Tested by building the kernel with Binutils & GCC master branch, and
running the kernel with 35 in-tree modules loaded.

Link: https://github.com/loongson/LoongArch-Documentation/pull/57
Link: https://gcc.gnu.org/r13-1834
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f09482a

Xi Ruoyao (5):
  LoongArch: Add section of GOT for kernel module
  LoongArch: Support R_LARCH_SOP_PUSH_GPREL relocation type in kernel
    module
  LoongArch: Support relocation against _GLOBAL_OFFSET_TABLE_
  LoongArch: Stop using undocumented assembler options
  LoongArch: Support modules with new relocation types

 arch/loongarch/Makefile                 |  5 +-
 arch/loongarch/include/asm/elf.h        | 37 ++++++++++
 arch/loongarch/include/asm/module.h     | 23 ++++++
 arch/loongarch/include/asm/module.lds.h |  1 +
 arch/loongarch/kernel/head.S            | 10 +--
 arch/loongarch/kernel/module-sections.c | 72 +++++++++++++++++--
 arch/loongarch/kernel/module.c          | 94 +++++++++++++++++++++++++
 7 files changed, 229 insertions(+), 13 deletions(-)

-- 
2.37.0



^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [PATCH 5/5] LoongArch: Support modules with new relocation types
@ 2022-07-28  6:21 kernel test robot
  0 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-07-28  6:21 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4262 bytes --]

:::::: 
:::::: Manual check reason: "low confidence static check warning: arch/loongarch/kernel/module-sections.c:92:17: sparse: sparse: statement expected after case label"
:::::: 

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <4007f3ef167f93ffd9fcae841e144a0fc89f0117.camel@xry111.site>
References: <4007f3ef167f93ffd9fcae841e144a0fc89f0117.camel@xry111.site>
TO: Xi Ruoyao <xry111@xry111.site>
TO: loongarch(a)lists.linux.dev
CC: linux-kernel(a)vger.kernel.org
CC: WANG Xuerui <kernel@xen0n.name>
CC: Huacai Chen <chenhuacai@kernel.org>

Hi Xi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kees/for-next/execve]
[also build test WARNING on linus/master v5.19-rc8 next-20220727]
[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/Xi-Ruoyao/LoongArch-Support-new-relocation-types/20220728-004805
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: loongarch-randconfig-s051-20220727 (https://download.01.org/0day-ci/archive/20220728/202207281410.U2YZjgJz-lkp(a)intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/befc276145cba2e7aaf88a302986cb3882f75aec
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Xi-Ruoyao/LoongArch-Support-new-relocation-types/20220728-004805
        git checkout befc276145cba2e7aaf88a302986cb3882f75aec
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kernel/module-sections.c:92:17: sparse: sparse: statement expected after case label

vim +92 arch/loongarch/kernel/module-sections.c

fcdfe9d22bed084 Huacai Chen 2022-05-31  71  
8e6c412c34a1a98 Xi Ruoyao   2022-07-28  72  static void count_max_entries(Elf_Rela *relas, int num,
8e6c412c34a1a98 Xi Ruoyao   2022-07-28  73  			      unsigned int *plts, unsigned int *gots)
fcdfe9d22bed084 Huacai Chen 2022-05-31  74  {
fcdfe9d22bed084 Huacai Chen 2022-05-31  75  	unsigned int i, type;
fcdfe9d22bed084 Huacai Chen 2022-05-31  76  
fcdfe9d22bed084 Huacai Chen 2022-05-31  77  	for (i = 0; i < num; i++) {
fcdfe9d22bed084 Huacai Chen 2022-05-31  78  		type = ELF_R_TYPE(relas[i].r_info);
befc276145cba2e Xi Ruoyao   2022-07-28  79  		switch (type) {
befc276145cba2e Xi Ruoyao   2022-07-28  80  		case R_LARCH_SOP_PUSH_PLT_PCREL:
befc276145cba2e Xi Ruoyao   2022-07-28  81  		case R_LARCH_B26:
fcdfe9d22bed084 Huacai Chen 2022-05-31  82  			if (!duplicate_rela(relas, i))
fcdfe9d22bed084 Huacai Chen 2022-05-31  83  				(*plts)++;
befc276145cba2e Xi Ruoyao   2022-07-28  84  			break;
befc276145cba2e Xi Ruoyao   2022-07-28  85  		case R_LARCH_SOP_PUSH_GPREL:
befc276145cba2e Xi Ruoyao   2022-07-28  86  		case R_LARCH_GOT_PC_HI20:
8e6c412c34a1a98 Xi Ruoyao   2022-07-28  87  			if (!duplicate_rela(relas, i))
8e6c412c34a1a98 Xi Ruoyao   2022-07-28  88  				(*gots)++;
befc276145cba2e Xi Ruoyao   2022-07-28  89  			break;
befc276145cba2e Xi Ruoyao   2022-07-28  90  		default:
befc276145cba2e Xi Ruoyao   2022-07-28  91  			/* Do nothing. */
befc276145cba2e Xi Ruoyao   2022-07-28 @92  		}
fcdfe9d22bed084 Huacai Chen 2022-05-31  93  	}
fcdfe9d22bed084 Huacai Chen 2022-05-31  94  }
fcdfe9d22bed084 Huacai Chen 2022-05-31  95  

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-07-28 11:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 16:24 [PATCH 0/5] LoongArch: Support new relocation types Xi Ruoyao
2022-07-27 16:26 ` [PATCH 1/5] LoongArch: Add section of GOT for kernel module Xi Ruoyao
     [not found]   ` <849f514e-f78a-72a2-b94e-6974074b75eb@loongson.cn>
2022-07-28  9:02     ` Xi Ruoyao
2022-07-28  9:21       ` Youling Tang
2022-07-28 10:53         ` Xi Ruoyao
2022-07-27 16:27 ` [PATCH 2/5] LoongArch: Support R_LARCH_SOP_PUSH_GPREL relocation type in " Xi Ruoyao
2022-07-27 16:28 ` [PATCH 3/5] LoongArch: Support relocation against _GLOBAL_OFFSET_TABLE_ Xi Ruoyao
2022-07-28  1:02   ` Jinyang He
2022-07-28  6:41     ` Xi Ruoyao
2022-07-28  9:14       ` Jinyang He
2022-07-28 10:57         ` Xi Ruoyao
2022-07-28 11:21           ` Jinyang He
2022-07-27 16:29 ` [PATCH 4/5] LoongArch: Stop using undocumented assembler options Xi Ruoyao
2022-07-28  9:46   ` Youling Tang
2022-07-28 10:58     ` Xi Ruoyao
2022-07-27 16:31 ` [PATCH 5/5] LoongArch: Support modules with new relocation types Xi Ruoyao
2022-07-27 16:46 ` [PATCH 0/5] LoongArch: Support " Xi Ruoyao
2022-07-28  6:21 [PATCH 5/5] LoongArch: Support modules with " kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.