在 2020/6/24 12:13, 朱一帆 写道:
> Hello,
> I am working on debug a mingw-w64 problem of snmalloc. 
> https://github.com/microsoft/snmalloc/pull/217. it turns out that MinGW GCC 
> runs no dtor at all for my example provided in the above issue list (but the 
> process seems to quit normally).
> 

This seems to be an issue in winpthreads. The TLS callback function 
`__dyn_tls_pthread` is not invoked at all (tested on
`i686-w64-mingw32`; not sure about x86_64).

The `win32` thread model should not suffer from this problem.


> In a later discussion, someone found that when compiling the object with LLVM 
> compiler-rt, the dtors are invoked but then the process quit abnormally.
> 
> I got some time tracing the TLS destruction procedure. It seems that those 
> `tls_callback` and `__mingw_cxa_thread_atexit` functions are invoked 
> currently; but there is one thing strange that `tls_dtors` appear to be 
> optimized out in the distributed binary from MSYS2. Considering the later 
> behavior of the callback functions, I think this `optimized-out` global 
> variable may lead to some problems here.  Indeed, when I step into 
> `run_dtor_list`. I see GDB jump to some strange address (0x00000000000) and 
> leave a SIGFAULT to me. However, since I do not have a powerful windows PC, I 
> do not have the conditions to test whether it is the true problem to blame.
> 

This looks like a bug in the linker, or the compiler generated erroneous 
attributes for the symbol in question (for example,
`weak`). That's beyond my ken, apologies.


-- 
Best regards,
LH_Mouse

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to