On Thu, 17 Apr 2025, Pali Rohár wrote:

This allows to remove the whole pre_c_init() and pre_cpp_init() functions
and registration of __mingw_pcinit and __mingw_pcppinit hooks.

Inlining the code allows to easily figure out in which order is
initialization code called.

Also merge code which is protected by __native_startup_lock into one
if-branch for better code readability.

Function pre_c_init() was the first callback in .CRT$XI section, so now
call its code before the _initterm_e(__xi_a, __xi_z) (which executes all
remaining .CRT$XI callbacks).

Function pre_cpp_init() was the first callback in .CRT$XC section, so now
call its code before the _initterm (__xc_a, __xc_z) (which executes all
remaining .CRT$XC callbacks).
---
mingw-w64-crt/crt/crtexe.c | 98 +++++++++++++++-----------------------
1 file changed, 38 insertions(+), 60 deletions(-)

I'm not fully convinced about this one; we could also leave the pre_c_init and pre_cpp_init functions as they were, but just call them directly instead of registering them in the .CRT$.. sections; that makes it clearer exactly where/when they are called - without moving code around without any apparent purpose. I guess it depends on the overall final direction of this patchset if that makes things any better in any tangible way?

// Martin

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to