On Mon, 26 Jan 2026, LIU Hao wrote:
Yes and no. PE COFF object files do not support weak symbols; only weak
externals [1]. So by that definition, weak symbols are not supported by GNU
toolchains on Windows [2], and may produce unexpected behavior.
In this case you might want to try LLVM [3].
FWIW, LLVM/Clang in mingw mode does implement weak symbols in the same way
as the GNU toolchains do - except that there are a few bugs in that area
in the GNU toolchains, in my experience.
When implementing it in LLVM, I made a set of testcases for it, to
exercise all the relevant corner cases. With GNU toolchains, there are a
number of those tests that fail. I haven't filed bugs for those, but if
you want to dissect them and file bugs for the individual cases, I can
provide you my test project.
For the given testcase by the original poster here, it does link correctly
with Clang/LLD.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public