[llvm-dev] Preparing BOLT for LLVM monorepo
Martin Storsjö via llvm-dev
llvm-dev at lists.llvm.org
Wed Nov 3 01:28:09 PDT 2021
On Wed, 3 Nov 2021, Maksim Panchenko via llvm-dev wrote:
> The Windows build was disabled due to the usage of threads, IIRC.
> Although, we don't use them directly, only via the C++11 standard
> library. I don't have access to a windows box to test it myself.
C++11 threads should be usable on Windows too, in general.
If building with GCC/libstdc++, there's two compiler configurations, the
"win32 thread model" which doesn't provide the full C++11 thread support,
and the "posix thread model" which is configured to run libgcc and
libstdc++ on top of libwinpthread, which does support C++11 threads. I
suspect this is what you've run into.
The mingw cross compilers in debian/ubuntu ship both configurations, but
default to the "win32 thread model" without libwinpthread. There, you can
choose the other one by invoking e.g. "x86_64-w64-mingw32-g++-posix", i.e.
there are compiler frontends with -win32 and -posix suffixes in addition
to the default.
I think the LLVM codebase also uses some bits of C++11 threads/mutexes
somewhere, because I remember that cross compiling LLVM with the
debian/ubuntu provided mingw compilers requires using the -posix suffixed
tools. So with that in mind, this shouldn't be any additional limitation
compared with what LLVM requires already.
Also, if building for Windows with a toolchain that uses libc++ (which is
also usable in mingw configurations) or MSVC STL, then there's no
ambiguity, C++11 threads are always available.
// Martin
More information about the llvm-dev
mailing list