If your two kernel modules are dependent on each other means one modules is exporting some symbols and other module is using them then you have to make sure your .ko is linked by scripts/module-common.lds.
Starting from Linux 3.0.0 kernel, we are working with updated version of module.lds. If you don't use this script loading of modules may fail with
"Unknown symbol"
error.
Starting from kernel 3.0.0 each __kcrctab __ksymtab symbol has been assigned separate section in .ko If you see such .ko with nm, all symbols would have virtual address 0x00000000 These symbols should be in one separate sections, __ksymtab for all ___ksymtab+* symbols and __kcrctab for all ___kcrctab+* symbols.
linker script in scripts/module-common.lds produces exactly what we need. This all behaviour is due to symbol resolution process changes in kernel >= 3.0.0 This patch has been added to speed up the symbols resolution process. Kernel will actually sort this symbols and apply binary search instead of linear to speed up process.
Standard kernel modules automatically gets compiled and linked with module-common.lds but if you are working on any third party kernel modules then make sure you use module-common.lds to link object file of your module.
Starting from Linux 3.0.0 kernel, we are working with updated version of module.lds. If you don't use this script loading of modules may fail with
"Unknown symbol"
error.
Starting from kernel 3.0.0 each __kcrctab __ksymtab symbol has been assigned separate section in .ko If you see such .ko with nm, all symbols would have virtual address 0x00000000 These symbols should be in one separate sections, __ksymtab for all ___ksymtab+* symbols and __kcrctab for all ___kcrctab+* symbols.
linker script in scripts/module-common.lds produces exactly what we need. This all behaviour is due to symbol resolution process changes in kernel >= 3.0.0 This patch has been added to speed up the symbols resolution process. Kernel will actually sort this symbols and apply binary search instead of linear to speed up process.
Standard kernel modules automatically gets compiled and linked with module-common.lds but if you are working on any third party kernel modules then make sure you use module-common.lds to link object file of your module.
Hi,
ReplyDeleteCan you provide module-common.lds script to include third party modules with example.
Thanks
You don't need to edit module-common.lds script. Just pass your object file to ld using option -T path_to_module-common.lds. I don't remember exact command but it would be something like this
ReplyDeleteld -r -o hello.ko -T path_to_module-common.lds
Anyways can you explain little more what is your exact issue?
Ran into this issue. Thansk !
ReplyDelete