Skip to contentSkip to conversation

samples: rust: fix `rust_print` build making it a combined module

PATCH New Miguel Ojeda 1 participant 1 message Nov 11, 2024

Subsystems (3)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH v2 1/1 samples: rust: fix `rust_print` build making it a combined module

The rust_print module, when built as a module, fails to build with:

ERROR: modpost: missing MODULE_LICENSE() in samples/rust/rust_print_events.o
ERROR: modpost: "__tracepoint_rust_sample_loaded" [samples/rust/rust_print.ko] undefined!
ERROR: modpost: "rust_do_trace_rust_sample_loaded" [samples/rust/rust_print.ko] undefined!

Fix it by building it as a combined one.

Fixes 91d39024e1b0 ("rust: samples: add tracepoint to Rust sample")

---
v2:
- Instead of renaming the module name, rename the main source file. This avoids changing other places (e.g. Kconfig) and, most importantly, minimizes the impact to developers/users (e.g. CIs out there).

v1: https://lore.kernel.org/rust-for-linux/[email protected]/

 samples/rust/Makefile                              | 4 +++-
 samples/rust/{rust_print.rs => rust_print_main.rs} | 0
 2 files changed, 3 insertions(+), 1 deletion(-)
 rename samples/rust/{rust_print.rs => rust_print_main.rs} (100%)
samples/rust/Makefile +3 -1
index f29280ec4820..c1a5c1655395 100644
@@ -2,6 +2,8 @@
 ccflags-y += -I$(src)				# needed for trace events
 
 obj-$(CONFIG_SAMPLE_RUST_MINIMAL)		+= rust_minimal.o
-obj-$(CONFIG_SAMPLE_RUST_PRINT)			+= rust_print.o rust_print_events.o
+obj-$(CONFIG_SAMPLE_RUST_PRINT)			+= rust_print.o
+
+rust_print-y := rust_print_main.o rust_print_events.o
 
 subdir-$(CONFIG_SAMPLE_RUST_HOSTPROGS)		+= hostprogs
samples/rust/rust_print_main.rs renamed from samples/rust/rust_print.rs +0 -0
similarity index 100%
rename from samples/rust/rust_print.rs
rename to samples/rust/rust_print_main.rs

base-commit: 91d39024e1b02914cc5e2dbc137908e29b269ce4 --
2.47.0