Re: [PATCH v7 6/8] modpost: Add modname to mod_device_table alias

From
Nicolas Schier <nsc@kernel.org>
Date
2025-09-15 17:30:51
Also in
linux-kbuild, lkml, rust-for-linux
Reply to
Alexey Gladkov, 2025-08-18
On Mon, Aug 18, 2025 at 06:55:00PM +0200, Alexey Gladkov wrote:
At this point, if a symbol is compiled as part of the kernel,
information about which module the symbol belongs to is lost.

To save this it is possible to add the module name to the alias name.
It's not very pretty, but it's possible for now.

Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Andreas Hindborg <a.hindborg@kernel.org>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Alex Gaynor <redacted>
Cc: <redacted>
Signed-off-by: Alexey Gladkov <legion@kernel.org>
Acked-by: Danilo Krummrich <dakr@kernel.org>
---
 include/linux/module.h   | 14 +++++++++++++-
 rust/kernel/device_id.rs |  8 ++++----
 scripts/mod/file2alias.c | 18 ++++++++++++++----
 3 files changed, 31 insertions(+), 9 deletions(-)
...
quoted hunk ↗ jump to hunk
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 00586119a25b7..13021266a18f8 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1476,8 +1476,8 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 {
 	void *symval;
 	char *zeros = NULL;
-	const char *type, *name;
-	size_t typelen;
+	const char *type, *name, *modname;
+	size_t typelen, modnamelen;
when applying the patch-set onto kbuild-next, gcc refuses to build this patch
(this possibly killing future bisecting):

../scripts/mod/file2alias.c: In function ‘handle_moddevtable’:
../scripts/mod/file2alias.c:1480:25: error: variable ‘modnamelen’ set but not used [-Werror=unused-but-set-variable]
 1480 |         size_t typelen, modnamelen;
      |                         ^~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [../scripts/Makefile.host:131: scripts/mod/file2alias.o] Error 

(-Werror is on for userprogs, since commit
27758d8c2583d10472b745a43ff86fef96c11ef7)

Introduction of modnamelen has to be moved to the next patch.

Kind regards
Nicolas
Thread (25 messages) 25 messages, 4 authors, last reply 2025-10-02
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help