diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2018-06-19 20:07:54 -0700 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2018-06-25 18:36:50 -0700 |
commit | 8a852e769490b87c1a6f84f78365ed706d41b516 (patch) | |
tree | 395b20a971041f9734820f41b63fe458c4c285ca /cc | |
parent | abf1b31a201acf4218b9ff63a51a66b50a9108bb (diff) | |
download | build_soong-8a852e769490b87c1a6f84f78365ed706d41b516.tar.gz build_soong-8a852e769490b87c1a6f84f78365ed706d41b516.tar.bz2 build_soong-8a852e769490b87c1a6f84f78365ed706d41b516.zip |
Use clang for windows host modules
Bug: http://b/69933068
- Remove GCC's intrinsic header path so Clang's headers get included.
- Add '-B' with GCC's binary directory so Clang detects the linker.
- Bug: http://b/109759970 - Pass '--allow-multiple-definition' linker
flag to deal with ld.bfd's inability to handle Clang-generated section
names is fixed.
- Bug: http://b/110800681 - lld cannot link Android's Windows modules
yet
Test: m native-host-cross and run adb_test.exe under wine.
Change-Id: I9be9cfc34a47cbeee04024438dea214305112eaa
Diffstat (limited to 'cc')
-rw-r--r-- | cc/config/x86_windows_host.go | 13 | ||||
-rw-r--r-- | cc/linker.go | 4 |
2 files changed, 15 insertions, 2 deletions
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go index 4e13230b..4cb8fa47 100644 --- a/cc/config/x86_windows_host.go +++ b/cc/config/x86_windows_host.go @@ -45,7 +45,6 @@ var ( windowsIncludeFlags = []string{ "-isystem ${WindowsGccRoot}/${WindowsGccTriple}/include", - "-isystem ${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3/include", } windowsClangCppflags = []string{ @@ -82,9 +81,14 @@ var ( "-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) @@ -94,9 +98,14 @@ var ( "-static-libgcc", } windowsX8664ClangLdflags = append(ClangFilterUnknownCflags(windowsX8664Ldflags), []string{ + "-B${WindowsGccRoot}/${WindowsGccTriple}/bin", "-B${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3", "-L${WindowsGccRoot}/lib/gcc/${WindowsGccTriple}/4.8.3", "-B${WindowsGccRoot}/${WindowsGccTriple}/lib64", + "-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", }...) windowsX8664ClangLldflags = ClangFilterUnknownLldflags(windowsX8664ClangLdflags) @@ -222,7 +231,7 @@ func (t *toolchainWindowsX8664) WindresFlags() string { } func (t *toolchainWindows) ClangSupported() bool { - return false + return true } func (t *toolchainWindowsX86) ClangTriple() string { diff --git a/cc/linker.go b/cc/linker.go index f6223a77..6bbf0154 100644 --- a/cc/linker.go +++ b/cc/linker.go @@ -246,6 +246,10 @@ func (linker *baseLinker) useClangLld(ctx ModuleContext) bool { if ctx.Darwin() { return false } + // http://b/110800681 - lld cannot link Android's Windows modules yet. + if ctx.Windows() { + return false + } if linker.Properties.Use_clang_lld != nil { return Bool(linker.Properties.Use_clang_lld) } |