On Wed Jan 14 00:49:46 2026 +0000, Yuxuan Shui wrote:
Oh, I need to add `__ASM_GLOBAL_IMPORT` to data.c as well? But why does that fix the duplicate symbol problem? Hmm, I think I understand now. `crt_dllmain.o` is pulling in the `__imp__initterm` symbol, not the `_initterm` symbol itself. So I need to provide that to prevent `initerm.o` from being linked. Yes, that’s the reason. Whenever a function is pulled in as dllimport, the compiler accesses it via the `__imp_` symbol, which caused it to be pulled from winecrtend when building the crt DLLs, even though those DLLs also provide the implementation.
I misremembered your original version, so the comment about separate object files does not apply to it; it applied to my intermediate local version I had while experimenting. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9265#note_126883