Re: Compile warning when using exported symbols located in other loadable module

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

 



On Tue, Apr 19, 2005 at 12:22:46PM -0500, Tony Asleson wrote:
> Timur Tabi wrote:
> 
> >Before compiling usesexport.ko, try loading providesexport.ko.  The 
> >warning should go away.
> 
> Looks like loading the providesexport.ko before the compile does not 
> remove the warning.

insmod to provide symbols to a compile? I don't think so.
> 
> When I load the module providesexport.ko I see this in /var/log/messages
> 
> Apr 19 11:08:39 amd kernel: Provider loaded, exported symbol available.
> 
> When I cat /proc/kallsyms I get
> 
> ffffffff8824b080 r __ksymtab_some_exported_symbol       [providesexport]
> ffffffff8824b090 r __kstrtab_some_exported_symbol       [providesexport]
> ffffffff8824b0a8 r __kcrctab_some_exported_symbol       [providesexport]
> ffffffff8824b030 t some_exported_symbol [providesexport]
> 000000006fd120ab a __crc_some_exported_symbol   [providesexport]

OK, so the some_exported_symbol is defined and loaded.  The compiler
doesn't care about this.
> 
> So the symbol is available, but with the module loaded I still get the 
> same warning when
> compiling the module that depends on the exported symbol.
> 
> make -C /lib/modules/2.6.11-1.14_FC3/build M=/home/tony/learnexport/user 
> modules
> make[1]: Entering directory `/lib/modules/2.6.11-1.14_FC3/build'
>  CC [M]  /home/tony/learnexport/user/user.o
>  LD [M]  /home/tony/learnexport/user/usesexport.o
>  Building modules, stage 2.
>  MODPOST
> *** Warning: "some_exported_symbol" 
> [/home/tony/learnexport/user/usesexport.ko] undefined!
>  CC      /home/tony/learnexport/user/usesexport.mod.o
>  LD [M]  /home/tony/learnexport/user/usesexport.ko
> make[1]: Leaving directory `/lib/modules/2.6.11-1.14_FC3/build'

As someone said earlier in this thread, it appears that you need
something like this in usesexport.c:

extern int some_exported_symbol;

When you insmod providesexport.ko and then usesexport.ko, the
appropriate linkages should be made.
> 
> Any other ideas?  The 3rd edition of Linux Device Drivers does not cover 
> this as
> does the other 2 other kernel books I have.  At least as I haven't found 
> it in the
> books anyway.

Do you:
EXPORT_SYMBOL (some_exported_symbol);
 
in providesexport.c?

As recommended in LDD, read through other modules in
/usr/src/linux/drivers.  Trying grepping on EXPORT_SYMBOL:

 grep -r EXPORT /usr/src/linux/drivers

Good luck,
-- 
Mike

--
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