crt: test: Check that __mingw_register_thread_local_exe_atexit_callback_ptr is non-NULL in in t_tls_exe_dtor test Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-crt/testcases/t_tls_exe_dtor.c b/mingw-w64-crt/testcases/t_tls_exe_dtor.c index 5ced214..3befaf4 100644 --- a/mingw-w64-crt/testcases/t_tls_exe_dtor.c +++ b/mingw-w64-crt/testcases/t_tls_exe_dtor.c
@@ -13,6 +13,12 @@ extern int __cdecl __tlregdtor(void (__cdecl*func)(void)); +/* Tentative symbol __mingw_register_thread_local_exe_atexit_callback_ptr is + * mingw-w64 internal symbol only for EXE applications. It is non-NULL if the + * EXE application is using __tlregdtor. + */ +void (__cdecl *const __mingw_register_thread_local_exe_atexit_callback_ptr)(void) __attribute__((common)); /* tentative */ + static int thread_dtor_counter = 0; static int process_dtor_counter = 0; @@ -69,6 +75,11 @@ printf("PE TLS section is present\n"); } + if (!__mingw_register_thread_local_exe_atexit_callback_ptr) { + printf("Error: __mingw_register_thread_local_exe_atexit_callback_ptr is NULL\n"); + ret = 1; + } + if (_osplatform == VER_PLATFORM_WIN32_WINDOWS) { printf("PE TLS callbacks are not supported on Win9x\n"); if (ret)