[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250730090025.2402129-1-legion@kernel.org>
Date: Wed, 30 Jul 2025 11:00:25 +0200
From: Alexey Gladkov <legion@...nel.org>
To: Stephen Rothwell <sfr@...b.auug.org.au>,
Masahiro Yamada <masahiroy@...nel.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Next Mailing List <linux-next@...r.kernel.org>
Subject: [PATCH] kbuild: modpost: Fix the order of includes in .vmlinux.export.c
The linux/module.h cannot be used at the beginning of file because
linux/dynamic_debug.h adds linux/string.h and then string_32.h, where
some functions may be redefined as `__builtin_<name>` under certain
conditions.
This results in the following error (i386 defconfig):
ld: .vmlinux.export.o: in function `__ksymtab___builtin_memcmp':
.vmlinux.export.c:(___ksymtab+__builtin_memcmp+0x0): undefined reference to `__builtin_memcmp'
Link: https://lore.kernel.org/all/20250730161223.63783458@canb.auug.org.au/
Fixes: c4b487ddc51f ("modpost: Create modalias for builtin modules")
Signed-off-by: Alexey Gladkov <legion@...nel.org>
---
scripts/mod/modpost.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 67f9cd76bdd2..47c8aa2a6939 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2070,12 +2070,12 @@ static void write_vmlinux_export_c_file(struct module *mod)
struct module_alias *alias, *next;
buf_printf(&buf,
- "#include <linux/export-internal.h>\n"
- "#include <linux/module.h>\n");
+ "#include <linux/export-internal.h>\n");
add_exported_symbols(&buf, mod);
buf_printf(&buf,
+ "#include <linux/module.h>\n"
"#undef __MODULE_INFO_PREFIX\n"
"#define __MODULE_INFO_PREFIX\n");
--
2.50.1
Powered by blists - more mailing lists