LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 001/001] scripts/mod/modpost.c: Allow additional Modules.symvers files during modpost stage 2
@ 2008-02-25 16:19 Richard Hacker
  0 siblings, 0 replies; only message in thread
From: Richard Hacker @ 2008-02-25 16:19 UTC (permalink / raw)
  To: kai, sam; +Cc: linux-kernel

From: Richard Hacker <lerichi@gmx.net>

This patch adds a new command line option -E to modpost, expecting a comma 
separated list of additional files as an argument whose symbols should be 
read before processing. Passing EXTRA_SYMBOLS on the make command line will 
then call modpost with this symbol list.

Signed-off-by: Richard Hacker <lerichi@gmx.net>

---
When building kernel modules that depend on other modules not in the main 
kernel tree, modpost complains about undefined symbols:
# make -C /path/to/linux/kernel M=/path/to/my/module
...
Building modules, stage 2.
....
WARNING: "rt_copy_buf" [/home/rich/osc_etl_rtw/osc_kmod.ko] undefined!
...etc

I have written this small patch allowing developers to supply a list of symbol 
files to make which modpost then reads before processing the current module, 
thus not generating these annoying warnings.

The patch adds a new command line option -E to modpost which expects a comma 
separated list of additional files whose symbols should be read. 

scripts/Makefile.modpost is also extended to accept the variable 
EXTRA_SYMBOLS, which in turn calls modpost with the -E argument. Therefore it 
is possible to supply the list during the make process
make -C /path/to/linux/kernel M=/path/to/my/module \ 
EXTRA_SYMBOLS=/extra/modules/Modules.symvers,/another/Modules.symvers

I was not successful in putting EXTRA_SYMBOLS living aside EXTRA_CFLAGS, etc. 
as a make variable into the Kbuild makefile. This is where it would fit best. 
Maybe someone can contribute this.

I hope this patch is useful and finds its way into the kernel.


diff -uprN linux-2.6.23-vanilla/scripts/Makefile.modpost 
linux-2.6.23/scripts/Makefile.modpost
--- linux-2.6.23-vanilla/scripts/Makefile.modpost	2008-01-18 
22:47:09.000000000 +0100
+++ linux-2.6.23/scripts/Makefile.modpost	2008-02-25 16:54:42.000000000 +0100
@@ -61,6 +61,7 @@ modpost = scripts/mod/modpost           
  $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,)       \
  $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile)   \
  $(if $(KBUILD_EXTMOD),-I $(modulesymfile))      \
+ $(if $(EXTRA_SYMBOLS),-E $(EXTRA_SYMBOLS))      \
  $(if $(KBUILD_EXTMOD),-o $(modulesymfile))      \
  $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
 
diff -uprN linux-2.6.23-vanilla/scripts/mod/modpost.c 
linux-2.6.23/scripts/mod/modpost.c
--- linux-2.6.23-vanilla/scripts/mod/modpost.c	2008-01-18 22:47:09.000000000 
+0100
+++ linux-2.6.23/scripts/mod/modpost.c	2008-02-25 16:53:58.000000000 +0100
@@ -1645,11 +1645,12 @@ int main(int argc, char **argv)
 	struct buffer buf = { };
 	char fname[SZ];
 	char *kernel_read = NULL, *module_read = NULL;
+	char *external_read = NULL, *comma;
 	char *dump_write = NULL;
 	int opt;
 	int err;
 
-	while ((opt = getopt(argc, argv, "i:I:mso:aw")) != -1) {
+	while ((opt = getopt(argc, argv, "i:I:E:mso:aw")) != -1) {
 		switch(opt) {
 			case 'i':
 				kernel_read = optarg;
@@ -1658,6 +1659,10 @@ int main(int argc, char **argv)
 				module_read = optarg;
 				external_module = 1;
 				break;
+			case 'E':
+				external_read = optarg;
+				external_module = 1;
+				break;
 			case 'm':
 				modversions = 1;
 				break;
@@ -1682,6 +1687,13 @@ int main(int argc, char **argv)
 		read_dump(kernel_read, 1);
 	if (module_read)
 		read_dump(module_read, 0);
+	while (external_read) {
+		comma = strchr(external_read, ',');
+		if (comma)
+			*comma = '\0';
+		read_dump(external_read, 0);
+		external_read = comma ? comma + 1 : NULL;
+	}
 
 	while (optind < argc) {
 		read_symbols(argv[optind++]);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-25 16:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-25 16:19 [PATCH 001/001] scripts/mod/modpost.c: Allow additional Modules.symvers files during modpost stage 2 Richard Hacker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).