Windows: enable gold threading, copy libwinpthread-1.dll
Copy libwinpthread-1.dll alongside the binutils executables on Windows.
The install_winpthreads function is copied from llvm_android:
https://android.googlesource.com/toolchain/llvm_android/+/bd22d9779676661ae9571972dcd744c42c70ffd0/build.py#1063
Most C++ MinGW programs need libpthread, because even libstdc++'s
"operator new" pulls in EH code, which calls into libpthread. Currently,
the ld.gold.exe and dwp.exe binaries need libwinpthread-1.dll, which is
not generally in the PATH, so the binaries don't run.
Previously, the Android GCC build of binutils linked ld.gold.exe and
dwp.exe with -static, which selected the static libpthread.a. Packaging
libwinpthread-1.dll alongside the binaries ensures that ld.gold.exe and
the LLVMgold plugin use the same copy of the winpthreads runtime, which
might be important.
Test: ./toolchain/binutils/build.py --arch arm64 --host win64
Test: ./toolchain/binutils/build.py --arch arm64 --host win
Test: ./toolchain/binutils/build.py --arch arm64 --host linux
Test: ./toolchain/binutils/build.py --arch x86 --host win64
Bug: none
Change-Id: I5fc2d38b67c72fa4760be1c2688ef88479759160
1 file changed