Removed unused GCC references

Remove Toolchain.GccRoot, Toolchain.GccVersion, and Toolchain.GccTriple
that were only used by an unused function.  This removes most of the
references to GCC, although there are still some left in the host
toolchains.

Test: No change to build.ninja for aosp_cf_x86_64_phone-userdebug or aosp_raven-userdebug
Change-Id: I72b8af1f9aa83e6e15c9e00ed1e817b6cc3a031a
This commit is contained in:
Colin Cross 2022-09-30 15:44:45 -07:00
parent a0124bb13d
commit 4fa894d366
11 changed files with 27 additions and 182 deletions

View file

@ -1135,7 +1135,3 @@ func transformArchiveRepack(ctx android.ModuleContext, inputFile android.Path,
}, },
}) })
} }
func mingwCmd(toolchain config.Toolchain, cmd string) string {
return filepath.Join(toolchain.GccRoot(), "bin", toolchain.GccTriple()+"-"+cmd)
}

View file

@ -74,7 +74,7 @@ var (
"-mcpu=kryo", "-mcpu=kryo",
}, },
"kryo385": []string{ "kryo385": []string{
// Use cortex-a53 because kryo385 is not supported in GCC/clang. // Use cortex-a53 because kryo385 is not supported in clang.
"-mcpu=cortex-a53", "-mcpu=cortex-a53",
}, },
"exynos-m1": []string{ "exynos-m1": []string{
@ -86,16 +86,7 @@ var (
} }
) )
const (
arm64GccVersion = "4.9"
)
func init() { func init() {
pctx.StaticVariable("arm64GccVersion", arm64GccVersion)
pctx.SourcePathVariable("Arm64GccRoot",
"prebuilts/gcc/${HostPrebuiltTag}/aarch64/aarch64-linux-android-${arm64GccVersion}")
exportedVars.ExportStringListStaticVariable("Arm64Ldflags", arm64Ldflags) exportedVars.ExportStringListStaticVariable("Arm64Ldflags", arm64Ldflags)
exportedVars.ExportStringListStaticVariable("Arm64Lldflags", arm64Lldflags) exportedVars.ExportStringListStaticVariable("Arm64Lldflags", arm64Lldflags)
@ -164,24 +155,12 @@ func (t *toolchainArm64) Name() string {
return "arm64" return "arm64"
} }
func (t *toolchainArm64) GccRoot() string {
return "${config.Arm64GccRoot}"
}
func (t *toolchainArm64) GccTriple() string {
return "aarch64-linux-android"
}
func (t *toolchainArm64) GccVersion() string {
return arm64GccVersion
}
func (t *toolchainArm64) IncludeFlags() string { func (t *toolchainArm64) IncludeFlags() string {
return "" return ""
} }
func (t *toolchainArm64) ClangTriple() string { func (t *toolchainArm64) ClangTriple() string {
return t.GccTriple() return "aarch64-linux-android"
} }
func (t *toolchainArm64) Cflags() string { func (t *toolchainArm64) Cflags() string {

View file

@ -79,7 +79,7 @@ var (
"cortex-a7": []string{ "cortex-a7": []string{
"-mcpu=cortex-a7", "-mcpu=cortex-a7",
"-mfpu=neon-vfpv4", "-mfpu=neon-vfpv4",
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang // Fake an ARM compiler flag as these processors support LPAE which clang
// don't advertise. // don't advertise.
// TODO This is a hack and we need to add it for each processor that supports LPAE until some // TODO This is a hack and we need to add it for each processor that supports LPAE until some
// better solution comes around. See Bug 27340895 // better solution comes around. See Bug 27340895
@ -91,7 +91,7 @@ var (
"cortex-a15": []string{ "cortex-a15": []string{
"-mcpu=cortex-a15", "-mcpu=cortex-a15",
"-mfpu=neon-vfpv4", "-mfpu=neon-vfpv4",
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang // Fake an ARM compiler flag as these processors support LPAE which clang
// don't advertise. // don't advertise.
// TODO This is a hack and we need to add it for each processor that supports LPAE until some // TODO This is a hack and we need to add it for each processor that supports LPAE until some
// better solution comes around. See Bug 27340895 // better solution comes around. See Bug 27340895
@ -100,7 +100,7 @@ var (
"cortex-a53": []string{ "cortex-a53": []string{
"-mcpu=cortex-a53", "-mcpu=cortex-a53",
"-mfpu=neon-fp-armv8", "-mfpu=neon-fp-armv8",
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang // Fake an ARM compiler flag as these processors support LPAE which clang
// don't advertise. // don't advertise.
// TODO This is a hack and we need to add it for each processor that supports LPAE until some // TODO This is a hack and we need to add it for each processor that supports LPAE until some
// better solution comes around. See Bug 27340895 // better solution comes around. See Bug 27340895
@ -109,7 +109,7 @@ var (
"cortex-a55": []string{ "cortex-a55": []string{
"-mcpu=cortex-a55", "-mcpu=cortex-a55",
"-mfpu=neon-fp-armv8", "-mfpu=neon-fp-armv8",
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang // Fake an ARM compiler flag as these processors support LPAE which clang
// don't advertise. // don't advertise.
// TODO This is a hack and we need to add it for each processor that supports LPAE until some // TODO This is a hack and we need to add it for each processor that supports LPAE until some
// better solution comes around. See Bug 27340895 // better solution comes around. See Bug 27340895
@ -118,7 +118,7 @@ var (
"cortex-a75": []string{ "cortex-a75": []string{
"-mcpu=cortex-a55", "-mcpu=cortex-a55",
"-mfpu=neon-fp-armv8", "-mfpu=neon-fp-armv8",
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang // Fake an ARM compiler flag as these processors support LPAE which clang
// don't advertise. // don't advertise.
// TODO This is a hack and we need to add it for each processor that supports LPAE until some // TODO This is a hack and we need to add it for each processor that supports LPAE until some
// better solution comes around. See Bug 27340895 // better solution comes around. See Bug 27340895
@ -127,7 +127,7 @@ var (
"cortex-a76": []string{ "cortex-a76": []string{
"-mcpu=cortex-a55", "-mcpu=cortex-a55",
"-mfpu=neon-fp-armv8", "-mfpu=neon-fp-armv8",
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang // Fake an ARM compiler flag as these processors support LPAE which clang
// don't advertise. // don't advertise.
// TODO This is a hack and we need to add it for each processor that supports LPAE until some // TODO This is a hack and we need to add it for each processor that supports LPAE until some
// better solution comes around. See Bug 27340895 // better solution comes around. See Bug 27340895
@ -136,7 +136,7 @@ var (
"krait": []string{ "krait": []string{
"-mcpu=krait", "-mcpu=krait",
"-mfpu=neon-vfpv4", "-mfpu=neon-vfpv4",
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang // Fake an ARM compiler flag as these processors support LPAE which clang
// don't advertise. // don't advertise.
// TODO This is a hack and we need to add it for each processor that supports LPAE until some // TODO This is a hack and we need to add it for each processor that supports LPAE until some
// better solution comes around. See Bug 27340895 // better solution comes around. See Bug 27340895
@ -147,16 +147,16 @@ var (
// even though clang does. // even though clang does.
"-mcpu=cortex-a53", "-mcpu=cortex-a53",
"-mfpu=neon-fp-armv8", "-mfpu=neon-fp-armv8",
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang // Fake an ARM compiler flag as these processors support LPAE which clang
// don't advertise. // don't advertise.
// TODO This is a hack and we need to add it for each processor that supports LPAE until some // TODO This is a hack and we need to add it for each processor that supports LPAE until some
// better solution comes around. See Bug 27340895 // better solution comes around. See Bug 27340895
"-D__ARM_FEATURE_LPAE=1", "-D__ARM_FEATURE_LPAE=1",
}, },
"kryo385": []string{ "kryo385": []string{
// Use cortex-a53 because kryo385 is not supported in GCC/clang. // Use cortex-a53 because kryo385 is not supported in clang.
"-mcpu=cortex-a53", "-mcpu=cortex-a53",
// Fake an ARM compiler flag as these processors support LPAE which GCC/clang // Fake an ARM compiler flag as these processors support LPAE which clang
// don't advertise. // don't advertise.
// TODO This is a hack and we need to add it for each processor that supports LPAE until some // TODO This is a hack and we need to add it for each processor that supports LPAE until some
// better solution comes around. See Bug 27340895 // better solution comes around. See Bug 27340895
@ -166,17 +166,12 @@ var (
) )
const ( const (
name = "arm" name = "arm"
armGccVersion = "4.9" ndkTriple = "arm-linux-androideabi"
gccTriple = "arm-linux-androideabi" clangTriple = "armv7a-linux-androideabi"
clangTriple = "armv7a-linux-androideabi"
) )
func init() { func init() {
pctx.StaticVariable("armGccVersion", armGccVersion)
pctx.SourcePathVariable("ArmGccRoot", "prebuilts/gcc/${HostPrebuiltTag}/arm/arm-linux-androideabi-${armGccVersion}")
// Just exported. Not created as a Ninja static variable. // Just exported. Not created as a Ninja static variable.
exportedVars.ExportString("ArmClangTriple", clangTriple) exportedVars.ExportString("ArmClangTriple", clangTriple)
@ -255,18 +250,6 @@ func (t *toolchainArm) Name() string {
return name return name
} }
func (t *toolchainArm) GccRoot() string {
return "${config.ArmGccRoot}"
}
func (t *toolchainArm) GccTriple() string {
return gccTriple
}
func (t *toolchainArm) GccVersion() string {
return armGccVersion
}
func (t *toolchainArm) IncludeFlags() string { func (t *toolchainArm) IncludeFlags() string {
return "" return ""
} }
@ -278,7 +261,7 @@ func (t *toolchainArm) ClangTriple() string {
func (t *toolchainArm) ndkTriple() string { func (t *toolchainArm) ndkTriple() string {
// Use current NDK include path, while ClangTriple is changed. // Use current NDK include path, while ClangTriple is changed.
return t.GccTriple() return ndkTriple
} }
func (t *toolchainArm) ToolchainCflags() string { func (t *toolchainArm) ToolchainCflags() string {

View file

@ -75,10 +75,6 @@ var (
) )
) )
const (
darwinGccVersion = "4.2.1"
)
func init() { func init() {
pctx.VariableFunc("macSdkRoot", func(ctx android.PackageVarContext) string { pctx.VariableFunc("macSdkRoot", func(ctx android.PackageVarContext) string {
return getMacTools(ctx).sdkRoot return getMacTools(ctx).sdkRoot
@ -100,12 +96,6 @@ func init() {
return getMacTools(ctx).toolPath return getMacTools(ctx).toolPath
}) })
pctx.StaticVariable("DarwinGccVersion", darwinGccVersion)
pctx.SourcePathVariable("DarwinGccRoot",
"prebuilts/gcc/${HostPrebuiltTag}/host/i686-apple-darwin-${DarwinGccVersion}")
pctx.StaticVariable("DarwinGccTriple", "i686-apple-darwin11")
pctx.StaticVariable("DarwinCflags", strings.Join(darwinCflags, " ")) pctx.StaticVariable("DarwinCflags", strings.Join(darwinCflags, " "))
pctx.StaticVariable("DarwinLdflags", strings.Join(darwinLdflags, " ")) pctx.StaticVariable("DarwinLdflags", strings.Join(darwinLdflags, " "))
pctx.StaticVariable("DarwinLldflags", strings.Join(darwinLdflags, " ")) pctx.StaticVariable("DarwinLldflags", strings.Join(darwinLdflags, " "))
@ -196,30 +186,6 @@ func (t *toolchainDarwinX86) Name() string {
return "x86_64" return "x86_64"
} }
func (t *toolchainDarwinArm) GccRoot() string {
panic("unimplemented")
}
func (t *toolchainDarwinArm) GccTriple() string {
panic("unimplemented")
}
func (t *toolchainDarwinArm) GccVersion() string {
panic("unimplemented")
}
func (t *toolchainDarwinX86) GccRoot() string {
return "${config.DarwinGccRoot}"
}
func (t *toolchainDarwinX86) GccTriple() string {
return "${config.DarwinGccTriple}"
}
func (t *toolchainDarwinX86) GccVersion() string {
return darwinGccVersion
}
func (t *toolchainDarwin) IncludeFlags() string { func (t *toolchainDarwin) IncludeFlags() string {
return "" return ""
} }

View file

@ -63,11 +63,6 @@ func findToolchain(os android.OsType, arch android.Arch) (Toolchain, error) {
type Toolchain interface { type Toolchain interface {
Name() string Name() string
GccRoot() string
GccTriple() string
// GccVersion should return a real value, not a ninja reference
GccVersion() string
IncludeFlags() string IncludeFlags() string
ClangTriple() string ClangTriple() string

View file

@ -80,17 +80,7 @@ var (
} }
) )
const (
x86_64GccVersion = "4.9"
)
func init() { func init() {
pctx.StaticVariable("x86_64GccVersion", x86_64GccVersion)
pctx.SourcePathVariable("X86_64GccRoot",
"prebuilts/gcc/${HostPrebuiltTag}/x86/x86_64-linux-android-${x86_64GccVersion}")
exportedVars.ExportStringListStaticVariable("X86_64ToolchainCflags", []string{"-m64"}) exportedVars.ExportStringListStaticVariable("X86_64ToolchainCflags", []string{"-m64"})
exportedVars.ExportStringListStaticVariable("X86_64ToolchainLdflags", []string{"-m64"}) exportedVars.ExportStringListStaticVariable("X86_64ToolchainLdflags", []string{"-m64"})
@ -128,24 +118,12 @@ func (t *toolchainX86_64) Name() string {
return "x86_64" return "x86_64"
} }
func (t *toolchainX86_64) GccRoot() string {
return "${config.X86_64GccRoot}"
}
func (t *toolchainX86_64) GccTriple() string {
return "x86_64-linux-android"
}
func (t *toolchainX86_64) GccVersion() string {
return x86_64GccVersion
}
func (t *toolchainX86_64) IncludeFlags() string { func (t *toolchainX86_64) IncludeFlags() string {
return "" return ""
} }
func (t *toolchainX86_64) ClangTriple() string { func (t *toolchainX86_64) ClangTriple() string {
return t.GccTriple() return "x86_64-linux-android"
} }
func (t *toolchainX86_64) ToolchainLdflags() string { func (t *toolchainX86_64) ToolchainLdflags() string {

View file

@ -88,16 +88,7 @@ var (
} }
) )
const (
x86GccVersion = "4.9"
)
func init() { func init() {
pctx.StaticVariable("x86GccVersion", x86GccVersion)
pctx.SourcePathVariable("X86GccRoot",
"prebuilts/gcc/${HostPrebuiltTag}/x86/x86_64-linux-android-${x86GccVersion}")
exportedVars.ExportStringListStaticVariable("X86ToolchainCflags", []string{"-m32"}) exportedVars.ExportStringListStaticVariable("X86ToolchainCflags", []string{"-m32"})
exportedVars.ExportStringListStaticVariable("X86ToolchainLdflags", []string{"-m32"}) exportedVars.ExportStringListStaticVariable("X86ToolchainLdflags", []string{"-m32"})
@ -134,18 +125,6 @@ func (t *toolchainX86) Name() string {
return "x86" return "x86"
} }
func (t *toolchainX86) GccRoot() string {
return "${config.X86GccRoot}"
}
func (t *toolchainX86) GccTriple() string {
return "x86_64-linux-android"
}
func (t *toolchainX86) GccVersion() string {
return x86GccVersion
}
func (t *toolchainX86) IncludeFlags() string { func (t *toolchainX86) IncludeFlags() string {
return "" return ""
} }

View file

@ -66,13 +66,20 @@ var (
"host_bionic_linker_script") "host_bionic_linker_script")
) )
const (
x86_64GccVersion = "4.9"
)
func init() { func init() {
pctx.StaticVariable("LinuxBionicCflags", strings.Join(linuxBionicCflags, " ")) pctx.StaticVariable("LinuxBionicCflags", strings.Join(linuxBionicCflags, " "))
pctx.StaticVariable("LinuxBionicLdflags", strings.Join(linuxBionicLdflags, " ")) pctx.StaticVariable("LinuxBionicLdflags", strings.Join(linuxBionicLdflags, " "))
pctx.StaticVariable("LinuxBionicLldflags", strings.Join(linuxBionicLdflags, " ")) pctx.StaticVariable("LinuxBionicLldflags", strings.Join(linuxBionicLdflags, " "))
// Use the device gcc toolchain for now // Use the device gcc toolchain for now
pctx.StaticVariable("LinuxBionicGccRoot", "${X86_64GccRoot}") pctx.StaticVariable("LinuxBionicGccVersion", x86_64GccVersion)
pctx.SourcePathVariable("LinuxBionicGccRoot",
"prebuilts/gcc/${HostPrebuiltTag}/x86/x86_64-linux-android-${LinuxBionicGccVersion}")
} }
type toolchainLinuxBionic struct { type toolchainLinuxBionic struct {
@ -84,18 +91,6 @@ func (t *toolchainLinuxBionic) Name() string {
return "x86_64" return "x86_64"
} }
func (t *toolchainLinuxBionic) GccRoot() string {
return "${config.LinuxBionicGccRoot}"
}
func (t *toolchainLinuxBionic) GccTriple() string {
return "x86_64-linux-android"
}
func (t *toolchainLinuxBionic) GccVersion() string {
return "4.9"
}
func (t *toolchainLinuxBionic) IncludeFlags() string { func (t *toolchainLinuxBionic) IncludeFlags() string {
return "" return ""
} }

View file

@ -180,18 +180,6 @@ func (t *toolchainLinuxX8664) Name() string {
return "x86_64" return "x86_64"
} }
func (t *toolchainLinux) GccRoot() string {
return "${config.LinuxGccRoot}"
}
func (t *toolchainLinux) GccTriple() string {
return "${config.LinuxGccTriple}"
}
func (t *toolchainLinux) GccVersion() string {
return linuxGccVersion
}
func (t *toolchainLinux) IncludeFlags() string { func (t *toolchainLinux) IncludeFlags() string {
return "" return ""
} }

View file

@ -175,24 +175,12 @@ func (t *toolchainWindowsX8664) Name() string {
return "x86_64" return "x86_64"
} }
func (t *toolchainWindows) GccRoot() string {
return "${config.WindowsGccRoot}"
}
func (t *toolchainWindows) GccTriple() string {
return "${config.WindowsGccTriple}"
}
func (t *toolchainWindows) ToolchainCflags() string { func (t *toolchainWindows) ToolchainCflags() string {
return "-B" + filepath.Join(t.GccRoot(), t.GccTriple(), "bin") return "-B" + filepath.Join("${config.WindowsGccRoot}", "${config.WindowsGccTriple}", "bin")
} }
func (t *toolchainWindows) ToolchainLdflags() string { func (t *toolchainWindows) ToolchainLdflags() string {
return "-B" + filepath.Join(t.GccRoot(), t.GccTriple(), "bin") return "-B" + filepath.Join("${config.WindowsGccRoot}", "${config.WindowsGccTriple}", "bin")
}
func (t *toolchainWindows) GccVersion() string {
return windowsGccVersion
} }
func (t *toolchainWindows) IncludeFlags() string { func (t *toolchainWindows) IncludeFlags() string {

View file

@ -314,8 +314,6 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
ctx.Strict(makePrefix+"LD", "${config.ClangBin}/lld") ctx.Strict(makePrefix+"LD", "${config.ClangBin}/lld")
ctx.Strict(makePrefix+"NDK_TRIPLE", config.NDKTriple(toolchain)) ctx.Strict(makePrefix+"NDK_TRIPLE", config.NDKTriple(toolchain))
ctx.Strict(makePrefix+"TOOLS_PREFIX", "${config.ClangBin}/llvm-") ctx.Strict(makePrefix+"TOOLS_PREFIX", "${config.ClangBin}/llvm-")
// TODO: GCC version is obsolete now that GCC has been removed.
ctx.Strict(makePrefix+"GCC_VERSION", toolchain.GccVersion())
} }
if target.Os.Class == android.Host { if target.Os.Class == android.Host {