Merge "Do not add non-existing -Bprebuilts/gcc/.../bin"

This commit is contained in:
Chih-hung Hsieh 2022-02-17 18:25:38 +00:00 committed by Gerrit Code Review
commit 70387c5d03
6 changed files with 18 additions and 25 deletions

View file

@ -3943,7 +3943,6 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
"${config.ArmGenericCflags}", "${config.ArmGenericCflags}",
"-target", "-target",
"armv7a-linux-androideabi20", "armv7a-linux-androideabi20",
"-B${config.ArmGccRoot}/arm-linux-androideabi/bin",
} }
expectedIncludes := []string{ 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)
flags.Global.AsFlags = append(flags.Global.AsFlags, target)
flags.Global.CFlags = append(flags.Global.CFlags, target, gccPrefix) flags.Global.LdFlags = append(flags.Global.LdFlags, target)
flags.Global.AsFlags = append(flags.Global.AsFlags, target, gccPrefix)
flags.Global.LdFlags = append(flags.Global.LdFlags, target, gccPrefix)
hod := "Host" hod := "Host"
if ctx.Os().Class == android.Device { if ctx.Os().Class == android.Device {

View file

@ -258,8 +258,12 @@ func (t *toolchainDarwin) AvailableLibraries() []string {
return darwinAvailableLibraries return darwinAvailableLibraries
} }
func (t *toolchainDarwin) ToolPath() string { func (t *toolchainDarwin) ToolchainCflags() string {
return "${config.MacToolPath}" return "-B${config.MacToolPath}"
}
func (t *toolchainDarwin) ToolchainLdflags() string {
return "-B${config.MacToolPath}"
} }
var toolchainDarwinArmSingleton Toolchain = &toolchainDarwinArm{} var toolchainDarwinArmSingleton Toolchain = &toolchainDarwinArm{}

View file

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

View file

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

View file

@ -227,7 +227,6 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
} }
clangPrefix := secondPrefix + "CLANG_" + typePrefix clangPrefix := secondPrefix + "CLANG_" + typePrefix
clangExtras := "-B" + config.ToolPath(toolchain)
ctx.Strict(clangPrefix+"TRIPLE", toolchain.ClangTriple()) ctx.Strict(clangPrefix+"TRIPLE", toolchain.ClangTriple())
ctx.Strict(clangPrefix+"GLOBAL_CFLAGS", strings.Join([]string{ ctx.Strict(clangPrefix+"GLOBAL_CFLAGS", strings.Join([]string{
@ -235,7 +234,6 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
"${config.CommonGlobalCflags}", "${config.CommonGlobalCflags}",
fmt.Sprintf("${config.%sGlobalCflags}", hod), fmt.Sprintf("${config.%sGlobalCflags}", hod),
toolchain.ToolchainCflags(), toolchain.ToolchainCflags(),
clangExtras,
productExtraCflags, productExtraCflags,
}, " ")) }, " "))
ctx.Strict(clangPrefix+"GLOBAL_CPPFLAGS", strings.Join([]string{ ctx.Strict(clangPrefix+"GLOBAL_CPPFLAGS", strings.Join([]string{
@ -248,14 +246,12 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
toolchain.Ldflags(), toolchain.Ldflags(),
toolchain.ToolchainLdflags(), toolchain.ToolchainLdflags(),
productExtraLdflags, productExtraLdflags,
clangExtras,
}, " ")) }, " "))
ctx.Strict(clangPrefix+"GLOBAL_LLDFLAGS", strings.Join([]string{ ctx.Strict(clangPrefix+"GLOBAL_LLDFLAGS", strings.Join([]string{
fmt.Sprintf("${config.%sGlobalLldflags}", hod), fmt.Sprintf("${config.%sGlobalLldflags}", hod),
toolchain.Lldflags(), toolchain.Lldflags(),
toolchain.ToolchainLdflags(), toolchain.ToolchainLdflags(),
productExtraLdflags, productExtraLdflags,
clangExtras,
}, " ")) }, " "))
if target.Os.Class == android.Device { if target.Os.Class == android.Device {