views:

29

answers:

1

I have a loadable module that is throwing a warning about phys_mem_access_prot when built under Ubuntu 9.10 (Linux 2.6.31-22-server).

[664] make -C /lib/modules/`uname -r`/build M=`pwd` 
make: Entering directory `/usr/src/linux-headers-2.6.31-22-server'
  LD      /home/chuck/dev/svd/built-in.o
  CC [M]  /home/chuck/dev/svd/svd.o
  LD [M]  /home/chuck/dev/svd/svd_drv.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "phys_mem_access_prot" [/home/chuck/dev/svd/svd_drv.ko] undefined!
  CC      /home/chuck/dev/svd/svd_drv.mod.o
  LD [M]  /home/chuck/dev/svd/svd_drv.ko
make: Leaving directory `/usr/src/linux-headers-2.6.31-22-server'

The function does show up in the System.map-2.6.31-22-server file

[667] grep phys_mem_access_prot /boot/System.map-2.6.31-22-server 
ffffffff8103fb40 T phys_mem_access_prot
ffffffff8103fb50 T phys_mem_access_prot_allowed

and the driver loads, so I'm confused as to why modpost is unhappy. Is this a problem because the kernel doesn't export the function with EXPORT_SYMBOL()?

+1  A: 

You've answered you own question! Any kernel function used by a module needs to be exported by one of the various EXPORT_SYMBOL() macros.

You'll also see problems if non-GPL modules need to use functions exported by EXPORT_SYMBOL_GPL.

stsquad
Thanks for the confirmation! The way LDD explained EXPORT_SYMBOL, I wasn't sure if it only applied module -> kernel or if it applied both ways.
ctuffli