What happens before the main function, from the _start point to the main function?

Introduction For most programmers, the entry point of a C or C++ program is the main function. However, they may be unaware of the complex steps that occur before main is executed. Depending on the program and the compiler used, various functions may run before main. These functions are automatically included in the final executable binary by the compiler and linker, but they remain hidden from the programmer. This post discusses the execution process and events from _start to the main function, with future posts covering the next steps. ...

January 25, 2025 · 21 min · 4327 words · Mahdi Davoudabadi