On Fri, Jul 24, 2015 at 11:19 AM, Navy <navych@126.com> wrote:
Hi To my understanding, EXPORT_SYMBOL() is used to export a symbol in kernel/modules. The the address of the all sysbols is in /proc/kallsyms. Only symbols exported by EXPORT_SYMBOL() is listed its CRC information in Module.symvers. So I think the CRC is the key to export a symbol. I do an experiment:
---mdir | |---Mod1 | |---mod1.c | |---Makefile | |---Mod2 |---mod2.c |---Makefile
mod1.c define function *void myfunc(void)* and exported by EXPORT_SYMBOL() and the CRC info is showed in Module.symvers. mod2.c reference *myfunc* and compiled successfully. BUT when mod2.ko is insmoded, "unknown symbol" is complained. mod2.ko CAN'T BE INSMOD.
Your Mod1 must be live before you load Mod2. When you load your module, the exported symbols would be present in a separate section in the elf file, you can see that using readelf, something like __ksymtab_. When the module is loaded these symbols are noted so that find_symbol can locate these. When you load a module dependent on those symbols, the load_module function would use the find_symbol to get that symbol. CRC would be checked in check_version after the symbol has been found, even then only if you have CONFIG_MODVERSIONS set in your config.
I solve this problem by the method in Documentation/kbuild/modules.txt and heard this is a bug from kernel 2.6.
Why this bug is not be fixed?
It's a long way from 2.6 now. can you send something about this "bug"?
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- ---P.K.S