Message ID | 20241111220805.708889-1-ojeda@kernel.org (mailing list archive) |
---|---|
State | Queued |
Commit | 22193c586b43ee88d66954395885742a6e4a49a9 |
Headers | show |
Series | [v2] samples: rust: fix `rust_print` build making it a combined module | expand |
diff --git a/samples/rust/Makefile b/samples/rust/Makefile index f29280ec4820..c1a5c1655395 100644 --- a/samples/rust/Makefile +++ b/samples/rust/Makefile @@ -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 diff --git a/samples/rust/rust_print.rs b/samples/rust/rust_print_main.rs similarity index 100% rename from samples/rust/rust_print.rs rename to samples/rust/rust_print_main.rs
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. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Closes: https://lore.kernel.org/all/20241108152149.28459a72@canb.auug.org.au/ Fixes: 91d39024e1b0 ("rust: samples: add tracepoint to Rust sample") Signed-off-by: Miguel Ojeda <ojeda@kernel.org> --- 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/20241109165520.1461400-1-ojeda@kernel.org/ 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%) base-commit: 91d39024e1b02914cc5e2dbc137908e29b269ce4 -- 2.47.0