OSDev.org https://forum.osdev.org/ |
|
DT_INIT, Initialization Function for a kernel module https://forum.osdev.org/viewtopic.php?f=1&t=32633 |
Page 1 of 1 |
Author: | ShukantPal [ Tue Dec 12, 2017 6:55 am ] |
Post subject: | DT_INIT, Initialization Function for a kernel module |
I am creating a modular kernel, and for that I have a ModuleLoader. I have read that for freestanding compilation the build system (ld) does not creating any DT_INIT dynamic entry in the table (dynamic section). Before creating threads for each module's KModuleMain function, I need a mechanism to call their internal initialization function especially to call the global object constructors. Does anyone know how to set a DT_INIT function in the linker-script for ld & how to call all global object constructors in the shared library (kernel modules are implemented as dynamic shared libraries in the CircuitKernel)? Kernel-link: https://github.com/SukantPal/CircuitKernel |
Author: | ShukantPal [ Mon Feb 26, 2018 10:35 am ] |
Post subject: | Re: DT_INIT, Initialization Function for a kernel module |
Just found out the answer on my own while developing the C++ runtime features for my kernel . One linking the infamous crti.o and crtn.o object files, the DT_INIT and DT_FINI tags are automatically emitted by the compiler/linker toolchain. I don't think there is any other way to do so, right? |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |