Wednesday 26 December 2012

Updated linker script module-common.lds in kernel 3.0

    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.