The key change is to never return STATUS_TIMEOUT, and to instead return the result of
NtYieldExecution() if zero timeout was passed, or STATUS_SUCCESS otherwise.
An overview of the correct values for each combination, copied from the test commit:
- Non-alertable, zero timeout: STATUS_SUCCESS or STATUS_NO_YIELD_PERFORMED
- Non-alertable, non-zero timeout: STATUS_SUCCESS
- Alertable, zero timeout: STATUS_SUCCESS, STATUS_NO_YIELD_PERFORMED, or STATUS_USER_APC
- Alertable, non-zero timeout: STATUS_SUCCESS or STATUS_USER_APC
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7169
These changes are enough to allow building the entirety of the native (ELF) side with `-flto`.
--
v2: loader: Mark thread_ldt, thread_data, wld_start "used".
ntdll: Mark call_init_thunk "used".
https://gitlab.winehq.org/wine/wine/-/merge_requests/7119