[llvm-dev] Preparing BOLT for LLVM monorepo

Maksim Panchenko via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 3 13:55:39 PDT 2021


Thank you for the detailed background on threads on windows!
We will give it a shot to get BOLT available on the platform.

Maksim

On 11/3/21, 1:28 AM, "Martin Storsjö" <martin at martin.st> wrote:


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211103/10c7aa40/attachment.html>


More information about the llvm-dev mailing list