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",
},
"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",
},
"exynos-m1": []string{
@ -86,16 +86,7 @@ var (
}
)
const (
arm64GccVersion = "4.9"
)
func init() {
pctx.StaticVariable("arm64GccVersion", arm64GccVersion)
pctx.SourcePathVariable("Arm64GccRoot",
"prebuilts/gcc/${HostPrebuiltTag}/aarch64/aarch64-linux-android-${arm64GccVersion}")
exportedVars.ExportStringListStaticVariable("Arm64Ldflags", arm64Ldflags)
exportedVars.ExportStringListStaticVariable("Arm64Lldflags", arm64Lldflags)
@ -164,24 +155,12 @@ func (t *toolchainArm64) Name() string {
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 {
return ""
}
func (t *toolchainArm64) ClangTriple() string {
return t.GccTriple()
return "aarch64-linux-android"
}
func (t *toolchainArm64) Cflags() string {

View file

@ -79,7 +79,7 @@ var (
"cortex-a7": []string{
"-mcpu=cortex-a7",
"-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.
// 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
@ -91,7 +91,7 @@ var (
"cortex-a15": []string{
"-mcpu=cortex-a15",
"-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.
// 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
@ -100,7 +100,7 @@ var (
"cortex-a53": []string{
"-mcpu=cortex-a53",
"-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.
// 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
@ -109,7 +109,7 @@ var (
"cortex-a55": []string{
"-mcpu=cortex-a55",
"-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.
// 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
@ -118,7 +118,7 @@ var (
"cortex-a75": []string{
"-mcpu=cortex-a55",
"-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.
// 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
@ -127,7 +127,7 @@ var (
"cortex-a76": []string{
"-mcpu=cortex-a55",
"-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.
// 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
@ -136,7 +136,7 @@ var (
"krait": []string{
"-mcpu=krait",
"-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.
// 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
@ -147,16 +147,16 @@ var (
// even though clang does.
"-mcpu=cortex-a53",
"-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.
// 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
"-D__ARM_FEATURE_LPAE=1",
},
"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",
// 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.
// 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
@ -166,17 +166,12 @@ var (
)
const (
name = "arm"
armGccVersion = "4.9"
gccTriple = "arm-linux-androideabi"
clangTriple = "armv7a-linux-androideabi"
name = "arm"
ndkTriple = "arm-linux-androideabi"
clangTriple = "armv7a-linux-androideabi"
)
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.
exportedVars.ExportString("ArmClangTriple", clangTriple)
@ -255,18 +250,6 @@ func (t *toolchainArm) Name() string {
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 {
return ""
}
@ -278,7 +261,7 @@ func (t *toolchainArm) ClangTriple() string {
func (t *toolchainArm) ndkTriple() string {
// Use current NDK include path, while ClangTriple is changed.
return t.GccTriple()
return ndkTriple
}
func (t *toolchainArm) ToolchainCflags() string {

View file

@ -75,10 +75,6 @@ var (
)
)
const (
darwinGccVersion = "4.2.1"
)
func init() {
pctx.VariableFunc("macSdkRoot", func(ctx android.PackageVarContext) string {
return getMacTools(ctx).sdkRoot
@ -100,12 +96,6 @@ func init() {
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("DarwinLdflags", strings.Join(darwinLdflags, " "))
pctx.StaticVariable("DarwinLldflags", strings.Join(darwinLdflags, " "))
@ -196,30 +186,6 @@ func (t *toolchainDarwinX86) Name() string {
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 {
return ""
}

View file

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

View file

@ -80,17 +80,7 @@ var (
}
)
const (
x86_64GccVersion = "4.9"
)
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_64ToolchainLdflags", []string{"-m64"})
@ -128,24 +118,12 @@ func (t *toolchainX86_64) Name() string {
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 {
return ""
}
func (t *toolchainX86_64) ClangTriple() string {
return t.GccTriple()
return "x86_64-linux-android"
}
func (t *toolchainX86_64) ToolchainLdflags() string {

View file

@ -88,16 +88,7 @@ var (
}
)
const (
x86GccVersion = "4.9"
)
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("X86ToolchainLdflags", []string{"-m32"})
@ -134,18 +125,6 @@ func (t *toolchainX86) Name() string {
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 {
return ""
}

View file

@ -66,13 +66,20 @@ var (
"host_bionic_linker_script")
)
const (
x86_64GccVersion = "4.9"
)
func init() {
pctx.StaticVariable("LinuxBionicCflags", strings.Join(linuxBionicCflags, " "))
pctx.StaticVariable("LinuxBionicLdflags", strings.Join(linuxBionicLdflags, " "))
pctx.StaticVariable("LinuxBionicLldflags", strings.Join(linuxBionicLdflags, " "))
// 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 {
@ -84,18 +91,6 @@ func (t *toolchainLinuxBionic) Name() string {
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 {
return ""
}

View file

@ -180,18 +180,6 @@ func (t *toolchainLinuxX8664) Name() string {
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 {
return ""
}

View file

@ -175,24 +175,12 @@ func (t *toolchainWindowsX8664) Name() string {
return "x86_64"
}
func (t *toolchainWindows) GccRoot() string {
return "${config.WindowsGccRoot}"
}
func (t *toolchainWindows) GccTriple() string {
return "${config.WindowsGccTriple}"
}
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 {
return "-B" + filepath.Join(t.GccRoot(), t.GccTriple(), "bin")
}
func (t *toolchainWindows) GccVersion() string {
return windowsGccVersion
return "-B" + filepath.Join("${config.WindowsGccRoot}", "${config.WindowsGccTriple}", "bin")
}
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+"NDK_TRIPLE", config.NDKTriple(toolchain))
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 {