Messages in this thread | | | Date | Tue, 14 Sep 1999 07:47:41 +0100 (BST) | From | Tigran Aivazian <> | Subject | Re: [q] how is ELF binfmt registered? |
| |
Hello brethren,
Thank you for all the replies I received. However, since all of them were incorrect, I feel it is my duty to clarify the situation and answer my own question as I have figured it out at home where I examined the source more closely.
The trick here is done via module_init()/module_exit() macros which for a module (if MODULE defined) evaluates to the init_module()/cleanup_module(), i.e. init_elf_binfmt()/exit_elf_binfmt() become init_module()/cleanup_module().
If the module (i.e. compilation unit) is compiled into the kernel statically, then module_init() generates some static variable which is initialized with the return value of the function. And module_exit(), of course, generates /* Nothing */ :)
Very impressive but not immediately obvious.
Regards, ------ Tigran A. Aivazian | http://www.sco.com Escalations Research Group | tel: +44-(0)1923-813796 Santa Cruz Operation Ltd | http://www.ocston.org/~tigran
On Mon, 13 Sep 1999, Tigran Aivazian wrote:
> Hi, > > If binfmt_elf is a module then register_binfmt() called from > init_elf_binfmt does the job. But if it is not a module how is elf_format > linked to formats? > > I grepped for it and couldn't find it. The formats is initialized to NULL > so it can't be done the way it is done for default_exec_domain (i.e. > initializaing a variable instead of calling register_exec_domain()). And > elf_formats is static to binfmt_elf.c so I am a bit lost... > > Regards, > Tigran. > > >
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |