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
DT_INIT, Initialization Function for a kernel module
-
- Posts: 23
- Joined: Tue Dec 12, 2017 6:51 am
- Libera.chat IRC: XtremeCoder
-
- Posts: 23
- Joined: Tue Dec 12, 2017 6:51 am
- Libera.chat IRC: XtremeCoder
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?