OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 12:18 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: DT_INIT, Initialization Function for a kernel module
PostPosted: Tue Dec 12, 2017 6:55 am 
Offline

Joined: Tue Dec 12, 2017 6:51 am
Posts: 23
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


Top
 Profile  
 
 Post subject: Re: DT_INIT, Initialization Function for a kernel module
PostPosted: Mon Feb 26, 2018 10:35 am 
Offline

Joined: Tue Dec 12, 2017 6:51 am
Posts: 23
Just found out the answer on my own while developing the C++ runtime features for my kernel :D . 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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], rdos and 97 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group