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

Jia Wang via B4 Relay posted 2 patches 1 week, 2 days ago
scripts/mod/modpost.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 150 insertions(+), 7 deletions(-)
[PATCH 0/2] modpost: fix RISC-V randconfig section mismatch false positives
Posted by Jia Wang via B4 Relay 1 week, 2 days ago
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.

Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
---
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,
--  
Jia Wang <wangjia@ultrarisc.com>