Change STL for Windows to libc++.
- Stop including libstdc++ headers.
- '-pthread' and 'static-libgcc' are unused when we pass -nodefaultlibs.
We didn't pass -nodefaultlibs for libstdc++.
- Use SjLj exceptions for 32-bit. libgcc_eh implements SjLj exception
model for 32-bit.
- Disable visibility annotations for libcxx and libcxxabi since we are
only going to support these as static libraries.
- Use Win32 threads. MinGW pthreads throws an error when building
libcxx since it's pthread_mutex_initializer is not constant (needs a
cast).
- Link libgcc_eh, which needs pthread, which in turn depends on
kernel32. Wrap the libraries with --start-group and --end-group and
remove duplicates.
Test: Build and test Windows binaries under Wine.
Change-Id: I8be51b004585e11ef51b7d5012f2a51330d1260f
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index 988ba03..8bbda31 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -47,18 +47,11 @@
"-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include",
}
- windowsClangCppflags = []string{
- "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3",
- "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3/backward",
- }
+ windowsClangCppflags = []string{}
- windowsX86ClangCppflags = []string{
- "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3/${WindowsGccTriple}/32",
- }
+ windowsX86ClangCppflags = []string{}
- windowsX8664ClangCppflags = []string{
- "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include/c++/4.8.3/${WindowsGccTriple}",
- }
+ windowsX8664ClangCppflags = []string{}
windowsLdflags = []string{
"--enable-stdcall-fixup",
@@ -80,14 +73,13 @@
"-m32",
"-Wl,--large-address-aware",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib32",
- "-static-libgcc",
}
windowsX86ClangLdflags = append(ClangFilterUnknownCflags(windowsX86Ldflags), []string{
"-B${WindowsGccRoot}/${WindowsGccTriple}/bin",
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/32",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib32",
- "-pthread",
+
// Bug: http://b/109759970 - WAR until issue with ld.bfd's
// inability to handle Clang-generated section names is fixed.
"-Wl,--allow-multiple-definition",
@@ -97,7 +89,6 @@
windowsX8664Ldflags = []string{
"-m64",
"-L${WindowsGccRoot}/${WindowsGccTriple}/lib64",
- "-static-libgcc",
"-Wl,--high-entropy-va",
}
windowsX8664ClangLdflags = append(ClangFilterUnknownCflags(windowsX8664Ldflags), []string{
@@ -105,7 +96,6 @@
"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
"-B${WindowsGccRoot}/${WindowsGccTriple}/lib64",
- "-pthread",
}...)
windowsX8664ClangLldflags = ClangFilterUnknownLldflags(windowsX8664ClangLdflags)