[clang] [MinGW] MinGW pthread (PR #74981)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 11 04:28:34 PST 2023


mstorsjo wrote:

This breaks bootstrapping llvm-mingw.

Not all mingw environments use or require pthreads; llvm-mingw is one such environment, and the clang64 environment in msys2 is another one.

While llvm-mingw does contain winpthreads, it is built later in the build process, and if this patch is applied, the setup procedure is broken; one would need to reorder how these libraries are linked, or create a dummy empty `libpthread.a` to make sure that linking works until the read winpthreads library is built.

Note that within msys2, they do apply a patch that does exactly what this patch does, for the mingw64 environment, where the system libstdc++ and similar does require winpthreads.

The fact that this is patched for the GCC environments isn't ideal, but any attempt to modify this needs to first acknowledge the current state of things and not just blindly barge ahead with a breaking change like this.

Also do note that the upcoming GCC 14 will have the win32 thread model supporting C++11, so it is quite possible for GCC based environments to stop relying so much on winpthreads, which would reduce the need for this patch.

CC @mati865 @lazka @jeremyd2019


https://github.com/llvm/llvm-project/pull/74981


More information about the cfe-commits mailing list