From 4fa894d366533605063b28e10b7063e364a6ef92 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 30 Sep 2022 15:44:45 -0700 Subject: [PATCH] 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 --- cc/builder.go | 4 --- cc/config/arm64_device.go | 25 ++--------------- cc/config/arm_device.go | 45 ++++++++++-------------------- cc/config/darwin_host.go | 34 ---------------------- cc/config/toolchain.go | 5 ---- cc/config/x86_64_device.go | 24 +--------------- cc/config/x86_device.go | 21 -------------- cc/config/x86_linux_bionic_host.go | 21 ++++++-------- cc/config/x86_linux_host.go | 12 -------- cc/config/x86_windows_host.go | 16 ++--------- cc/makevars.go | 2 -- 11 files changed, 27 insertions(+), 182 deletions(-) diff --git a/cc/builder.go b/cc/builder.go index cb21b1ff4..0bea9da49 100644 --- a/cc/builder.go +++ b/cc/builder.go @@ -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) -} diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go index 66087e6f0..d7f96183a 100644 --- a/cc/config/arm64_device.go +++ b/cc/config/arm64_device.go @@ -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 { diff --git a/cc/config/arm_device.go b/cc/config/arm_device.go index d702c6145..b53a09782 100644 --- a/cc/config/arm_device.go +++ b/cc/config/arm_device.go @@ -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 { diff --git a/cc/config/darwin_host.go b/cc/config/darwin_host.go index 01b1e635c..2cabdc8ac 100644 --- a/cc/config/darwin_host.go +++ b/cc/config/darwin_host.go @@ -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 "" } diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go index d9eaf533f..eb71aa1e8 100644 --- a/cc/config/toolchain.go +++ b/cc/config/toolchain.go @@ -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 diff --git a/cc/config/x86_64_device.go b/cc/config/x86_64_device.go index aebda0b51..e2b0f062a 100644 --- a/cc/config/x86_64_device.go +++ b/cc/config/x86_64_device.go @@ -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 { diff --git a/cc/config/x86_device.go b/cc/config/x86_device.go index 421b08354..3001ab405 100644 --- a/cc/config/x86_device.go +++ b/cc/config/x86_device.go @@ -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 "" } diff --git a/cc/config/x86_linux_bionic_host.go b/cc/config/x86_linux_bionic_host.go index 976cc25be..96a53bff3 100644 --- a/cc/config/x86_linux_bionic_host.go +++ b/cc/config/x86_linux_bionic_host.go @@ -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 "" } diff --git a/cc/config/x86_linux_host.go b/cc/config/x86_linux_host.go index 07b95e112..740405eb9 100644 --- a/cc/config/x86_linux_host.go +++ b/cc/config/x86_linux_host.go @@ -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 "" } diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go index a33606f99..561c50099 100644 --- a/cc/config/x86_windows_host.go +++ b/cc/config/x86_windows_host.go @@ -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 { diff --git a/cc/makevars.go b/cc/makevars.go index de8a8f21c..c70d4a6ff 100644 --- a/cc/makevars.go +++ b/cc/makevars.go @@ -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 {