[PATCH v3] Cygwin: autoload: fix ws2_32 chained init on AArch64

Chandru Kumaresan <[email protected]> Fri, 3 Jul 2026 12:12:44 +0000
Newsgroups gmane.os.cygwin.patches
Message-ID <PN0P287MB02951D01A967275601A56B3092F42@PN0P287MB0295.INDP287.PROD.OUTLOOK.COM>
Hi Jon,

>Hmmm. Are you sure? It looks to me like it's non-zero in all the
>existing winmm uses.

You're right, I misstated that. winmm does pass 1 (all 20 waveIn/waveOut entries).
The correct argument for removal isn't that it's always 0, but that the value
is never read anywhere, whether 0 or 1. The flag was only ever consumed
by the DONT_RESOLVE_DLL_REFERENCES reload branch in dll_load()
(added in a16b0549d for winmm's FreeLibrary-in-DllMain problem). Corinna
removed that branch in 105f79b48 ("Drop use_dont_resolve_hack flag", 2016).
Since then the value seeded into the handle slot is inert: std_dll_init's
(uintptr_t) dll->handle <= 1 check treats both 0 and 1 as "not loaded," so
winmm's 1 and everyone else's 0 follow the identical load path. Removing the
 plumbing and simplifying  = 1 to !handle is therefore behavior-preserving.
This is why the comment explaining the flag disappeared (in 2016) while the
plumbing lingered - the functionality it described was already gone.

>Anyhow, the "fix ws2_32 chained init on AArch64" part of this looks
>reasonable and doesn't seem to be connected. Can you submit that as a
>separate patch?

Sure, I will submit a separate patch for  no_resolve_on_fork and ws2_32.

Thanks ,
K Chandru