Merge "Do not add non-existing -Bprebuilts/gcc/.../bin" am: 70387c5d03 am: 1918a6120a

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1987029

Change-Id: I6ff3f893d95fe46de7d4420bce20d807e4a07804
This commit is contained in:
Chih-hung Hsieh 2022-02-18 10:15:42 +00:00 committed by Automerger Merge Worker
commit a59f62bfdf
6 changed files with 18 additions and 25 deletions

View file

@ -3943,7 +3943,6 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
"${config.ArmGenericCflags}",
"-target",
"armv7a-linux-androideabi20",
"-B${config.ArmGccRoot}/arm-linux-androideabi/bin",
}
expectedIncludes := []string{

View file

@ -450,11 +450,9 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
}
}
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 {

View file

@ -258,8 +258,12 @@ func (t *toolchainDarwin) AvailableLibraries() []string {
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{}

View file

@ -16,7 +16,6 @@ package config
import (
"fmt"
"path/filepath"
"android/soong/android"
)
@ -77,7 +76,6 @@ type Toolchain interface {
GccTriple() string
// GccVersion should return a real value, not a ninja reference
GccVersion() string
ToolPath() string
IncludeFlags() string
@ -198,10 +196,6 @@ func (toolchainBase) Musl() bool {
return false
}
func (t toolchainBase) ToolPath() string {
return ""
}
type toolchain64Bit struct {
toolchainBase
}
@ -283,11 +277,4 @@ func LibFuzzerRuntimeLibrary(t Toolchain) string {
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

View file

@ -15,6 +15,7 @@
package config
import (
"path/filepath"
"strings"
"android/soong/android"
@ -180,6 +181,14 @@ func (t *toolchainWindows) GccTriple() string {
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
}

View file

@ -227,7 +227,6 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
}
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 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
"${config.CommonGlobalCflags}",
fmt.Sprintf("${config.%sGlobalCflags}", hod),
toolchain.ToolchainCflags(),
clangExtras,
productExtraCflags,
}, " "))
ctx.Strict(clangPrefix+"GLOBAL_CPPFLAGS", strings.Join([]string{
@ -248,14 +246,12 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
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 {