]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tracing: Fix unused tracepoints when module uses only exported ones
authorSteven Rostedt <rostedt@goodmis.org>
Wed, 10 Dec 2025 01:40:23 +0000 (20:40 -0500)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 10 Dec 2025 02:16:07 +0000 (21:16 -0500)
Building the KVM intel module failed to build with UT=1:

no __tracepoint_strings in file: arch/x86/kvm/kvm-intel.o
make[3]: *** [/work/git/test-linux.git/scripts/Makefile.modfinal:62: arch/x86/kvm/kvm-intel.ko] Error 1

The reason is that the module only uses the tracepoints defined and
exported by the main kvm module. The tracepoint-update.c code fails the
build if a tracepoint is used, but there's no tracepoints defined. But
this is acceptable in modules if the tracepoints are defined in the vmlinux
proper or another module and exported.

Do not fail to build if a tracepoint is used but no tracepoints are
defined if the code is a module. This should still never happen for the
vmlinux itself.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Link: https://patch.msgid.link/20251209204023.76941824@fedora
Fixes: e30f8e61e2518 ("tracing: Add a tracepoint verification check at build time")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
scripts/tracepoint-update.c

index 7f7d90df14ce3931dad0a6fb18f5e9034c1a6ed8..90046aedc97b97b0023fccba94971cf054f8087a 100644 (file)
@@ -210,6 +210,9 @@ static int process_tracepoints(bool mod, void *addr, const char *fname)
        }
 
        if (!tracepoint_data_sec) {
+               /* A module may reference only exported tracepoints */
+               if (mod)
+                       return 0;
                fprintf(stderr, "no __tracepoint_strings in file: %s\n", fname);
                return -1;
        }