<div dir="ltr"><br class="gmail-Apple-interchange-newline"><span style="font-family:arial,sans-serif;white-space:pre-wrap;background-color:rgb(248,249,250)">Good day</span> <br><br> I have been doing a little kernel following some repositories of GitHub, videos and wikis, and I have found a topic that leaves me with doubts, the theme is the global constructors.<br><br>Suppose I write a program in c, for the user space, for my code to run I must have the main function<br>int main() { /*Code*/}<div><span style="background-color:rgb(248,249,250);font-family:inherit;white-space:pre-wrap"><br></span></div><div><span style="background-color:rgb(248,249,250);font-family:inherit;white-space:pre-wrap">The gcc compiler searches for this function to run my program, but before that happens, I can use the global constructors and write a code that runs before the main function, but in the case of writing a kernel, why do I need to run lines of code before the kernel is executed ?, I understand that when writing a kernel there is no main function and that it is disabled to indicate it to the compiler.

</span>In the Linux kernel are there global constructors? If so, what things are executed before starting the kernel?<br><span style="background-color:rgb(248,249,250);font-family:inherit;white-space:pre-wrap">
att: cristian vargas. </span></div></div>