Kernel Modules using one another even though not using any symbols
I am trying to load two modules in the kernel(v 2.6.9).
Module1 and Module2. Both have simple init and exit functions with a simple printk in both the functions.
Say I have inserted Module1 first.
Even though Module2 does not make a reference to (or call) any symbols in Module1, when I do lsmod it says Module2 using Module1. Also I can't unload Module1 while Module2 still inserted.
i.e. when I do
I get "Module1 is in use by Module2"
Does insmod (or load_module function in kernel/module.c) optimize the text section of the modules? If yes, based on what criteria, kernel does this optimization?
Is there anyway I can avoid this optimization?