foss-for-synopsys-dwc-arc-processors/linux

kernel modules can't be loaded if build with 2019.03-rc1 toolchain

evgeniy-paltsev opened this issue · 5 comments

If we build kernel with 2019.03-rc1 toolchain we get errors on modules loading.

I.E:

insmod ./lib/modules/4.19.9/kernel/net/ipv6/ipv6.ko
ipv6: unknown relocation: 82
insmod: ERROR: could not insert module ./lib/modules/4.19.9/kernel/net/ipv6/ipv6.ko: Invalid module format

Everything works fine with previous toolchain (2018.09).
This issue can be reproduced on different versions of kernel (I've tried 4.19.9, 4.20)

BTW, it's enough to build only modules with 2019.03-rc1 toolchain to reproduce this issue.
(I.E. build modules with 2019.03-rc1, build the rest of the kernel with 2018.09)

Ok, it's new R_ARC_S8H_PCREL type of relocation.
We need to add support of this relocation type to the our module.c

No need to do such an operation for the time being. The following relocs have being introduced to support linker-time relaxation:

Enum ELF Reloc Type Description Details
80 R_ARC_S9H_PCREL PC-relative bits9 = ME ( ( ( ( S + A ) - P ) >> 1 ) ) )
81 R_ARC_S7H_PCREL PC-relative bits7 = (( S + A ) - P ) >> 1
82 R_ARC_S8H_PCREL PC-relative disp8h = (( S + A ) - P ) >> 1
83 R_ARC_S10H_PCREL PC-relative bits10 = (( S + A ) - P ) >> 1
84 R_ARC_S13H_PCREL PC-relative bits13 = ME ( ( ( ( S + A ) - P ) >> 1 ) ) )
85 R_ARC_ALIGN Alignment statement
86 R_ARC_ADD8 8-bit label addition word8 = S + A
87 R_ARC_ADD16 16-bit label addition word16 = S + A
88 R_ARC_SUB8 8-bit label subtraction word8 = S - A
89 R_ARC_SUB16 16-bit label subtraction word16 = S - A
90 R_ARC_SUB32 32-bit label subtraction word32 = S - A

A binutils patch will be added to make the tools to behave as "before" when the linker relaxation is not required.

Kernel nodules loading works fine if we build modules with 2019.03-rc2 toolchain.