Skip to content

modpost: fix RISC-V randconfig section mismatch false positives

Jia Wang b4-sent linux-kbuild linux-riscv lkml 1 version New

Get series with b4
b4 am [email protected] change-id 20260716-modpost-30d5d28d9d64

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2modpost: ignore generated GCOV and RISC-V local relocsscripts/mod/modpost.c+71 -70 replies
2/2modpost: handle RISC-V relative extable relocationsscripts/mod/modpost.c+79 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] modpost: fix RISC-V randconfig section mismatch false positives

This series fixes two modpost false-positive section mismatch cases seen with RISC-V randconfig builds.

The first patch filters compiler-generated GCOV symbols and RISC-V local branch/PC-relative relocations when they point at init or exit sections. These references can come from instrumentation or local compiler/linker details rather than from real kernel section lifetime dependencies.

The second patch handles RISC-V relative exception table entries as R_RISCV_ADD32/R_RISCV_SUB32 relocation pairs. modpost already skipped the SUB32 half, but still checked the ADD32 symbol directly. After a relocatable link, that symbol can name an unrelated local debug symbol and trigger false .debug* section mismatch diagnostics from these __ex_table relocation pairs.

The issues are reproducible with both GCC 14 and GCC 15. They were reproduced or validated with:

- rv32 randconfig, KCONFIG_SEED=277518, CONFIG_GCOV_PROFILE_ALL=y, CONFIG_KCOV_INSTRUMENT_ALL=y, CONFIG_DEBUG_INFO_BTF=y

- rv32 randconfig, KCONFIG_SEED=4721,
CONFIG_MMU=y, CONFIG_DEBUG_INFO=y

With the fixes applied, the corresponding RISC-V randconfig builds complete successfully. Other unrelated modpost warnings may still remain.

---
Jia Wang (2):
modpost: ignore generated GCOV and RISC-V local relocs
modpost: handle RISC-V relative extable relocations

 scripts/mod/modpost.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 150 insertions(+), 7 deletions(-)

---
base-commit: 58717b2a1365d06c8c64b72aa948541b53fe31eb
change-id: 20260716-modpost-30d5d28d9d64

Best regards,

Signature · 1 line
Jia Wang <[email protected]>