On Tuesday 06 May 2025 19:58:15 Martin Storsjö wrote:
> 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

I was thinking about it. But somehow for me it was cleaner and easier to
understand order of the executed functions after "inlining" that code.
That was just my opinion about this. Also same thing I have already done
for crtdll.c startup code and those changes were already merged.

I'm still targeting to fix the security issue related to cmdline
processing and for this work I first wanted to do cleanups which allows
me to better understand the code and sequence when which thing happens
and so what is the correct stage to fix the cmdline processing.


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

Reply via email to