Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4ecf76b authored by Pirama Arumuga Nainar's avatar Pirama Arumuga Nainar Committed by Gerrit Code Review
Browse files

Merge changes from topic "windows-libcxx"

* changes:
  Remove --allow-multiple-definitions for 32-bit Windows
  Change STL for Windows to libc++.
parents 3558470d 8fd5a969
Loading
Loading
Loading
Loading
+3 −17
Original line number Diff line number Diff line
@@ -47,18 +47,11 @@ var (
		"-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,24 +73,18 @@ var (
		"-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",
	}...)
	windowsX86ClangLldflags = ClangFilterUnknownLldflags(windowsX86ClangLdflags)

	windowsX8664Ldflags = []string{
		"-m64",
		"-L${WindowsGccRoot}/${WindowsGccTriple}/lib64",
		"-static-libgcc",
		"-Wl,--high-entropy-va",
	}
	windowsX8664ClangLdflags = append(ClangFilterUnknownCflags(windowsX8664Ldflags), []string{
@@ -105,7 +92,6 @@ var (
		"-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
		"-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3",
		"-B${WindowsGccRoot}/${WindowsGccTriple}/lib64",
		"-pthread",
	}...)
	windowsX8664ClangLldflags = ClangFilterUnknownLldflags(windowsX8664ClangLdflags)

+21 −6
Original line number Diff line number Diff line
@@ -81,9 +81,9 @@ func (stl *stl) begin(ctx BaseModuleContext) {
			}
		} else if ctx.Windows() {
			switch s {
			case "libc++", "libc++_static", "libstdc++", "":
				// libc++ is not supported on mingw
				return "libstdc++"
			case "libc++", "libc++_static", "":
				// Only use static libc++ for Windows.
				return "libc++_static"
			case "none":
				return ""
			default:
@@ -177,6 +177,20 @@ func (stl *stl) flags(ctx ModuleContext, flags Flags) Flags {
			} else {
				flags.LdFlags = append(flags.LdFlags, hostDynamicGccLibs[ctx.Os()]...)
			}
			if ctx.Windows() {
				// Use SjLj exceptions for 32-bit.  libgcc_eh implements SjLj
				// exception model for 32-bit.
				if ctx.Arch().ArchType == android.X86 {
					flags.CppFlags = append(flags.CppFlags, "-fsjlj-exceptions")
				}
				flags.CppFlags = append(flags.CppFlags,
					// Disable visiblity annotations since we're using static
					// libc++.
					"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
					"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
					// Use Win32 threads in libc++.
					"-D_LIBCPP_HAS_THREAD_API_WIN32")
			}
		} else {
			if ctx.Arch().ArchType == android.Arm {
				flags.LdFlags = append(flags.LdFlags, "-Wl,--exclude-libs,libunwind_llvm.a")
@@ -213,9 +227,10 @@ func init() {
	hostDynamicGccLibs = map[android.OsType][]string{
		android.Linux:  []string{"-lgcc_s", "-lgcc", "-lc", "-lgcc_s", "-lgcc"},
		android.Darwin: []string{"-lc", "-lSystem"},
		android.Windows: []string{"-lmingw32", "-lgcc", "-lmoldname", "-lmingwex", "-lmsvcr110",
			"-lmsvcrt", "-ladvapi32", "-lshell32", "-luser32", "-lkernel32", "-lmingw32",
			"-lgcc", "-lmoldname", "-lmingwex", "-lmsvcrt"},
		android.Windows: []string{"-Wl,--start-group", "-lmingw32", "-lgcc", "-lgcc_eh",
			"-lmoldname", "-lmingwex", "-lmsvcr110", "-lmsvcrt", "-lpthread",
			"-ladvapi32", "-lshell32", "-luser32", "-lkernel32", "-lpsapi",
			"-Wl,--end-group"},
	}
	hostStaticGccLibs = map[android.OsType][]string{
		android.Linux:   []string{"-Wl,--start-group", "-lgcc", "-lgcc_eh", "-lc", "-Wl,--end-group"},