Do not add non-existing -Bprebuilts/gcc/.../bin
* Only prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/bin
exists for x86_windows_host.
* Remove config.ToolPath;
add required -B flags into ToolchainCflags and ToolchainLdflags.
Bug: 218883919
Test: make droid tidy-soong_subset
Change-Id: I9a18bf8cc0cf84e091c7463b3bda316eaab53aa3
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 31d91b6..51a6a27 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -3943,7 +3943,6 @@
"${config.ArmGenericCflags}",
"-target",
"armv7a-linux-androideabi20",
- "-B${config.ArmGccRoot}/arm-linux-androideabi/bin",
}
expectedIncludes := []string{
diff --git a/cc/compiler.go b/cc/compiler.go
index 9dbf2d1..d9a6bcd 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -450,11 +450,9 @@
}
}
- gccPrefix := "-B" + config.ToolPath(tc)
-
- flags.Global.CFlags = append(flags.Global.CFlags, target, gccPrefix)
- flags.Global.AsFlags = append(flags.Global.AsFlags, target, gccPrefix)
- flags.Global.LdFlags = append(flags.Global.LdFlags, target, gccPrefix)
+ flags.Global.CFlags = append(flags.Global.CFlags, target)
+ flags.Global.AsFlags = append(flags.Global.AsFlags, target)
+ flags.Global.LdFlags = append(flags.Global.LdFlags, target)
hod := "Host"
if ctx.Os().Class == android.Device {
diff --git a/cc/config/darwin_host.go b/cc/config/darwin_host.go
index 206bec1..5e3f7c7 100644
--- a/cc/config/darwin_host.go
+++ b/cc/config/darwin_host.go
@@ -258,8 +258,12 @@
return darwinAvailableLibraries
}
-func (t *toolchainDarwin) ToolPath() string {
- return "${config.MacToolPath}"
+func (t *toolchainDarwin) ToolchainCflags() string {
+ return "-B${config.MacToolPath}"
+}
+
+func (t *toolchainDarwin) ToolchainLdflags() string {
+ return "-B${config.MacToolPath}"
}
var toolchainDarwinArmSingleton Toolchain = &toolchainDarwinArm{}
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 6320dbb..6cede11 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -16,7 +16,6 @@
import (
"fmt"
- "path/filepath"
"android/soong/android"
)
@@ -77,7 +76,6 @@
GccTriple() string
// GccVersion should return a real value, not a ninja reference
GccVersion() string
- ToolPath() string
IncludeFlags() string
@@ -198,10 +196,6 @@
return false
}
-func (t toolchainBase) ToolPath() string {
- return ""
-}
-
type toolchain64Bit struct {
toolchainBase
}
@@ -283,11 +277,4 @@
return LibclangRuntimeLibrary(t, "fuzzer")
}
-func ToolPath(t Toolchain) string {
- if p := t.ToolPath(); p != "" {
- return p
- }
- return filepath.Join(t.GccRoot(), t.GccTriple(), "bin")
-}
-
var inList = android.InList
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index 9daf40f..2c83211 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -15,6 +15,7 @@
package config
import (
+ "path/filepath"
"strings"
"android/soong/android"
@@ -180,6 +181,14 @@
return "${config.WindowsGccTriple}"
}
+func (t *toolchainWindows) ToolchainCflags() string {
+ return "-B" + filepath.Join(t.GccRoot(), t.GccTriple(), "bin")
+}
+
+func (t *toolchainWindows) ToolchainLdflags() string {
+ return "-B" + filepath.Join(t.GccRoot(), t.GccTriple(), "bin")
+}
+
func (t *toolchainWindows) GccVersion() string {
return windowsGccVersion
}
diff --git a/cc/makevars.go b/cc/makevars.go
index b7aaaad..1ad71ec 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -227,7 +227,6 @@
}
clangPrefix := secondPrefix + "CLANG_" + typePrefix
- clangExtras := "-B" + config.ToolPath(toolchain)
ctx.Strict(clangPrefix+"TRIPLE", toolchain.ClangTriple())
ctx.Strict(clangPrefix+"GLOBAL_CFLAGS", strings.Join([]string{
@@ -235,7 +234,6 @@
"${config.CommonGlobalCflags}",
fmt.Sprintf("${config.%sGlobalCflags}", hod),
toolchain.ToolchainCflags(),
- clangExtras,
productExtraCflags,
}, " "))
ctx.Strict(clangPrefix+"GLOBAL_CPPFLAGS", strings.Join([]string{
@@ -248,14 +246,12 @@
toolchain.Ldflags(),
toolchain.ToolchainLdflags(),
productExtraLdflags,
- clangExtras,
}, " "))
ctx.Strict(clangPrefix+"GLOBAL_LLDFLAGS", strings.Join([]string{
fmt.Sprintf("${config.%sGlobalLldflags}", hod),
toolchain.Lldflags(),
toolchain.ToolchainLdflags(),
productExtraLdflags,
- clangExtras,
}, " "))
if target.Os.Class == android.Device {