The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] modpost: Add __llvm_covfun and __llvm_covmap to section_white_list
@ 2026-06-04  6:03 James Lee
  2026-06-09 23:51 ` Nathan Chancellor
  0 siblings, 1 reply; 2+ messages in thread
From: James Lee @ 2026-06-04  6:03 UTC (permalink / raw)
  To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
	Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: linux-kbuild, linux-kernel, llvm, James Lee

Modpost emits hundreds of warnings when using Clang to build for ARCH=um
and CONFIG_GCOV=y. e.g.:
    vmlinux (__llvm_covfun): unexpected non-allocatable section.
    Did you forget to use "ax"/"aw" in a .S file?
    Note that for example <linux/init.h> contains
    section definitions for use in .S files.

For example, when we use LLVM for a kunit user mode build with coverage:
    python3 tools/testing/kunit/kunit.py build --make_options LLVM=1 \
        --kunitconfig=tools/testing/kunit/configs/default.config \
        --kunitconfig=tools/testing/kunit/configs/coverage_uml.config

The behaviour occurs when building the kernel for ARCH=um with code
coverage enabled. The warnings come from modpost's check_sec_ref
function, which ensures no sections reference others that will be
discarded. covfun and covmap sections must reference __init and __exit
sections to collect coverage data, triggering the modpost warning.

To suppress these warnings, these section names have been added to
modpost's whitelist. This is unlikely to suppress legitimate warnings as
Clang will only insert these sections when building with coverage, and
can be assumed to manage these references safely.

Signed-off-by: James Lee <james@codeconstruct.com.au>
---
Unsure if there are Clang options that might better suppress this.
Certainly open to other options if they're available.
---
 scripts/mod/modpost.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index be89921d60b61d1db0398313aeb00bc1888843b1..287b7d67747dfe215640a4f8ec615519e9699921 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -749,6 +749,8 @@ static const char *const section_white_list[] =
 	".gnu.lto*",
 	".discard.*",
 	".llvm.call-graph-profile",	/* call graph */
+	"__llvm_covfun",
+	"__llvm_covmap",
 	NULL
 };
 

---
base-commit: d76bb1ebb5587f66b0f8b8099bfbb44722bc08b3
change-id: 20260604-dev-coverage-patch-b7234012f11d

Best regards,
-- 
James Lee <james@codeconstruct.com.au>


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

* Re: [PATCH] modpost: Add __llvm_covfun and __llvm_covmap to section_white_list
  2026-06-04  6:03 [PATCH] modpost: Add __llvm_covfun and __llvm_covmap to section_white_list James Lee
@ 2026-06-09 23:51 ` Nathan Chancellor
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2026-06-09 23:51 UTC (permalink / raw)
  To: Masahiro Yamada, Nicolas Schier, Nick Desaulniers, Bill Wendling,
	Justin Stitt, James Lee
  Cc: linux-kbuild, linux-kernel, llvm

On Thu, 04 Jun 2026 14:03:00 +0800, James Lee wrote:
> modpost: Add __llvm_covfun and __llvm_covmap to section_white_list

Applied to

  https://git.kernel.org/pub/scm/linux/kernel/git/kbuild/linux.git kbuild-next

Thanks!

[1/1] modpost: Add __llvm_covfun and __llvm_covmap to section_white_list
      https://git.kernel.org/kbuild/c/29c52907334a8

Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped or
reverted. Patches applied to an "unstable" branch are accepted pending
wider testing in -next and any post-commit review; they will generally
be moved to the main branch in a week if no issues are found.

Best regards,
-- 
Cheers,
Nathan



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

end of thread, other threads:[~2026-06-09 23:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04  6:03 [PATCH] modpost: Add __llvm_covfun and __llvm_covmap to section_white_list James Lee
2026-06-09 23:51 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox