How to get rid of modpost "undefined" warning ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm getting hit by a problem that was discussed here last january (thread
starts at http://mail.nl.linux.org/kernelnewbies/2006-01/msg00460.html).

Basically, I'm working with multiple out-of tree kernel modules which export
symbols used by one another.  At compile time, modpost warns about undefined
symbols, which are defined in one of those modules and used in another one.
Note however that modules work fine.

Question is:  when multiple out-of tree modules depend on one another, how
is it possible to tell modpost to look for symbols in directories other than
where it looks by default.

The full test source follows, the warning I'm trying to get rid of is the
following line:
*** Warning: "sharedFunction" [/root/k/b/b.ko] undefined!

Thanks,

Jean-Marc Ranger


----------



debian:~# 
debian:~# dmesg -c > /dev/null
debian:~# uname -a
Linux debian 2.6.8-3-686 #1 Thu May 25 02:27:57 UTC 2006 i686 GNU/Linux
debian:~# gcc --version
gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

debian:~# cd k
debian:~/k# find .
.
./a
./a/Makefile
./a/a.c
./b
./b/b.c
./b/Makefile
debian:~/k# cat a/Makefile 
ifeq ($(KERNELRELEASE),)

	KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
	PWD := $(shell pwd)

modules:
	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules

modules_install:
	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) INSTALL_MOD_PATH=$(MODULES_DIR)
modules_install

clean:
	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

.PHONY: modules modules_install clean

else
   	obj-m := a.o
endif


debian:~/k# cat a/a.c
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

MODULE_LICENSE  ("GPL");

void sharedFunction(const char* string)
{
	printk(KERN_WARNING "sharedFunction reports: %s\n", string);
}

int __init A_init(void)
{
	sharedFunction("DriverA");
	return 0;
}

void __exit A_exit(void)
{
}

module_init(A_init);
module_exit(A_exit);

EXPORT_SYMBOL(sharedFunction);
debian:~/k# cat b/Makefile 
ifeq ($(KERNELRELEASE),)

	KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
	PWD := $(shell pwd)

modules:
	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules

modules_install:
	$(MAKE) -C $(KERNEL_DIR) M=$(PWD) INSTALL_MOD_PATH=$(MODULES_DIR)
modules_install

clean:
	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

.PHONY: modules modules_install clean

else
   	obj-m := b.o
endif


debian:~/k# cat b/b.c
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

MODULE_LICENSE  ("GPL");

void sharedFunction(const char* string);

int __init B_init(void)
{
	sharedFunction("DriverB");
	return 0;
}

void __exit B_exit(void)
{
}

module_init(B_init);
module_exit(B_exit);
debian:~/k# make -C a
make: Entering directory `/root/k/a'
make -C /lib/modules/2.6.8-3-686/build M=/root/k/a modules
make[1]: Entering directory `/usr/src/kernel-headers-2.6.8-3-686'
  CC [M]  /root/k/a/a.o
  Building modules, stage 2.
  MODPOST
  CC      /root/k/a/a.mod.o
  LD [M]  /root/k/a/a.ko
make[1]: Leaving directory `/usr/src/kernel-headers-2.6.8-3-686'
make: Leaving directory `/root/k/a'
debian:~/k# make -C b
make: Entering directory `/root/k/b'
make -C /lib/modules/2.6.8-3-686/build M=/root/k/b modules
make[1]: Entering directory `/usr/src/kernel-headers-2.6.8-3-686'
  CC [M]  /root/k/b/b.o
  Building modules, stage 2.
  MODPOST
*** Warning: "sharedFunction" [/root/k/b/b.ko] undefined!
  CC      /root/k/b/b.mod.o
  LD [M]  /root/k/b/b.ko
make[1]: Leaving directory `/usr/src/kernel-headers-2.6.8-3-686'
make: Leaving directory `/root/k/b'
debian:~/k# insmod a/a.ko
debian:~/k# insmod b/b.ko
debian:~/k# dmesg -c
sharedFunction reports: DriverA
sharedFunction reports: DriverB
debian:~/k# logout

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux