4 ms·
> By letting the linker run arbitrary code before main As I know C++ allows running arbitrary code before main too - for constructors of global variables. Does
by Panzerschrek 6mo ago
> By letting the linker run arbitrary code before main
As I know C++ allows running arbitrary code before main too - for constructors of global variables. Does it bring security risks too?
- bonzini 6mo agoIt does not, it's actually arbitrary code running during the dynamic loading process, i.e. before _start.
- Panzerschrek 6mo agoBut what if I have a C++ dynamic library? Does it call constructors for global variables before _start function in the main program starts?
- bonzini 6mo ago_start takes care of calling the global initializers and register the atexit callback for the finalizers. (In practice _start calls __libc_start_main, a libc function that handles all of that).