Remove Fuchsia support from Soong

Bug: 194215932
Test: m checkbuild
Change-Id: Id7d3964d9417f8b0938af9b168bb4c00cebe9390
This commit is contained in:
Colin Cross 2021-07-20 13:17:15 -07:00
parent 34c32fabea
commit cb0ac95bde
18 changed files with 12 additions and 377 deletions

View file

@ -15,13 +15,14 @@
package android
import (
"android/soong/bazel"
"encoding"
"fmt"
"reflect"
"runtime"
"strings"
"android/soong/bazel"
"github.com/google/blueprint"
"github.com/google/blueprint/bootstrap"
"github.com/google/blueprint/proptools"
@ -314,8 +315,6 @@ var (
// Android is the OS for target devices that run all of Android, including the Linux kernel
// and the Bionic libc runtime.
Android = newOsType("android", Device, false, Arm, Arm64, X86, X86_64)
// Fuchsia is the OS for target devices that run Fuchsia.
Fuchsia = newOsType("fuchsia", Device, false, Arm64, X86_64)
// CommonOS is a pseudo OSType for a common OS variant, which is OsType agnostic and which
// has dependencies on all the OS variants.
@ -1502,13 +1501,8 @@ func decodeTargetProductVariables(config *config) (map[OsType][]Target, error) {
// Optional device targets
if variables.DeviceArch != nil && *variables.DeviceArch != "" {
var target = Android
if Bool(variables.Fuchsia) {
target = Fuchsia
}
// The primary device target.
addTarget(target, *variables.DeviceArch, variables.DeviceArchVariant,
addTarget(Android, *variables.DeviceArch, variables.DeviceArchVariant,
variables.DeviceCpuVariant, variables.DeviceAbi, NativeBridgeDisabled, nil, nil)
// An optional secondary device target.

View file

@ -332,21 +332,6 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
return Config{config}
}
func fuchsiaTargets(config Config) map[OsType][]Target {
return map[OsType][]Target{
Fuchsia: {
{Fuchsia, Arch{ArchType: Arm64, ArchVariant: "", Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", "", false},
},
config.BuildOS: {
{config.BuildOS, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", "", false},
},
}
}
var PrepareForTestSetDeviceToFuchsia = FixtureModifyConfig(func(config Config) {
config.Targets = fuchsiaTargets(config)
})
func modifyTestConfigToSupportArchMutator(testConfig Config) {
config := testConfig.config
@ -847,10 +832,6 @@ func (c *config) SkipBootJarsCheck() bool {
return Bool(c.productVariables.Skip_boot_jars_check)
}
func (c *config) Fuchsia() bool {
return Bool(c.productVariables.Fuchsia)
}
func (c *config) MinimizeJavaDebugInfo() bool {
return Bool(c.productVariables.MinimizeJavaDebugInfo) && !Bool(c.productVariables.Eng)
}

View file

@ -325,7 +325,6 @@ type BaseModuleContext interface {
Host() bool
Device() bool
Darwin() bool
Fuchsia() bool
Windows() bool
Debug() bool
PrimaryArch() bool
@ -2563,10 +2562,6 @@ func (b *baseModuleContext) Darwin() bool {
return b.os == Darwin
}
func (b *baseModuleContext) Fuchsia() bool {
return b.os == Fuchsia
}
func (b *baseModuleContext) Windows() bool {
return b.os == Windows
}

View file

@ -299,8 +299,6 @@ type productVariables struct {
Override_rs_driver *string `json:",omitempty"`
Fuchsia *bool `json:",omitempty"`
DeviceKernelHeaders []string `json:",omitempty"`
ExtraVndkVersions []string `json:",omitempty"`

View file

@ -29,7 +29,6 @@ const (
// OsType names in arch.go
osAndroid = "android"
osDarwin = "darwin"
osFuchsia = "fuchsia"
osLinux = "linux_glibc"
osLinuxBionic = "linux_bionic"
osWindows = "windows"
@ -40,8 +39,6 @@ const (
osArchAndroidX86 = "android_x86"
osArchAndroidX86_64 = "android_x86_64"
osArchDarwinX86_64 = "darwin_x86_64"
osArchFuchsiaArm64 = "fuchsia_arm64"
osArchFuchsiaX86_64 = "fuchsia_x86_64"
osArchLinuxX86 = "linux_glibc_x86"
osArchLinuxX86_64 = "linux_glibc_x86_64"
osArchLinuxBionicArm64 = "linux_bionic_arm64"
@ -84,7 +81,6 @@ var (
platformOsMap = map[string]string{
osAndroid: "//build/bazel/platforms/os:android",
osDarwin: "//build/bazel/platforms/os:darwin",
osFuchsia: "//build/bazel/platforms/os:fuchsia",
osLinux: "//build/bazel/platforms/os:linux",
osLinuxBionic: "//build/bazel/platforms/os:linux_bionic",
osWindows: "//build/bazel/platforms/os:windows",
@ -102,8 +98,6 @@ var (
osArchAndroidX86: "//build/bazel/platforms/os_arch:android_x86",
osArchAndroidX86_64: "//build/bazel/platforms/os_arch:android_x86_64",
osArchDarwinX86_64: "//build/bazel/platforms/os_arch:darwin_x86_64",
osArchFuchsiaArm64: "//build/bazel/platforms/os_arch:fuchsia_arm64",
osArchFuchsiaX86_64: "//build/bazel/platforms/os_arch:fuchsia_x86_64",
osArchLinuxX86: "//build/bazel/platforms/os_arch:linux_glibc_x86",
osArchLinuxX86_64: "//build/bazel/platforms/os_arch:linux_glibc_x86_64",
osArchLinuxBionicArm64: "//build/bazel/platforms/os_arch:linux_bionic_arm64",

View file

@ -187,7 +187,6 @@ func TestCcLibraryHeadersOSSpecificHeader(t *testing.T) {
cc_library_headers { name: "android-lib" }
cc_library_headers { name: "base-lib" }
cc_library_headers { name: "darwin-lib" }
cc_library_headers { name: "fuchsia-lib" }
cc_library_headers { name: "linux-lib" }
cc_library_headers { name: "linux_bionic-lib" }
cc_library_headers { name: "windows-lib" }
@ -197,7 +196,6 @@ cc_library_headers {
target: {
android: { header_libs: ["android-lib"] },
darwin: { header_libs: ["darwin-lib"] },
fuchsia: { header_libs: ["fuchsia-lib"] },
linux_bionic: { header_libs: ["linux_bionic-lib"] },
linux_glibc: { header_libs: ["linux-lib"] },
windows: { header_libs: ["windows-lib"] },
@ -231,18 +229,11 @@ cc_library_headers {
implementation_deps = [":base-lib"] + select({
"//build/bazel/platforms/os:android": [":android-lib"],
"//build/bazel/platforms/os:darwin": [":darwin-lib"],
"//build/bazel/platforms/os:fuchsia": [":fuchsia-lib"],
"//build/bazel/platforms/os:linux": [":linux-lib"],
"//build/bazel/platforms/os:linux_bionic": [":linux_bionic-lib"],
"//build/bazel/platforms/os:windows": [":windows-lib"],
"//conditions:default": [],
}),
)`, `cc_library_headers(
name = "fuchsia-lib",
copts = [
"-I.",
"-I$(BINDIR)/.",
],
)`, `cc_library_headers(
name = "linux-lib",
copts = [

View file

@ -215,7 +215,7 @@ func (binary *binaryDecorator) linkerInit(ctx BaseModuleContext) {
if binary.Properties.Static_executable == nil && ctx.Config().HostStaticBinaries() {
binary.Properties.Static_executable = BoolPtr(true)
}
} else if !ctx.Fuchsia() {
} else {
// Static executables are not supported on Darwin or Windows
binary.Properties.Static_executable = nil
}

View file

@ -152,71 +152,6 @@ func TestPrepareForTestWithCcDefaultModules(t *testing.T) {
).RunTest(t)
}
func TestFuchsiaDeps(t *testing.T) {
t.Helper()
bp := `
cc_library {
name: "libTest",
srcs: ["foo.c"],
target: {
fuchsia: {
srcs: ["bar.c"],
},
},
}`
result := android.GroupFixturePreparers(
prepareForCcTest,
PrepareForTestOnFuchsia,
).RunTestWithBp(t, bp)
rt := false
fb := false
ld := result.ModuleForTests("libTest", "fuchsia_arm64_shared").Rule("ld")
implicits := ld.Implicits
for _, lib := range implicits {
if strings.Contains(lib.Rel(), "libcompiler_rt") {
rt = true
}
if strings.Contains(lib.Rel(), "libbioniccompat") {
fb = true
}
}
if !rt || !fb {
t.Errorf("fuchsia libs must link libcompiler_rt and libbioniccompat")
}
}
func TestFuchsiaTargetDecl(t *testing.T) {
t.Helper()
bp := `
cc_library {
name: "libTest",
srcs: ["foo.c"],
target: {
fuchsia: {
srcs: ["bar.c"],
},
},
}`
result := android.GroupFixturePreparers(
prepareForCcTest,
PrepareForTestOnFuchsia,
).RunTestWithBp(t, bp)
ld := result.ModuleForTests("libTest", "fuchsia_arm64_shared").Rule("ld")
var objs []string
for _, o := range ld.Inputs {
objs = append(objs, o.Base())
}
android.AssertArrayString(t, "libTest inputs", []string{"foo.o", "bar.o"}, objs)
}
func TestVendorSrc(t *testing.T) {
ctx := testCc(t, `
cc_library {

View file

@ -21,10 +21,8 @@ bootstrap_go_package {
"arm_device.go",
"arm64_device.go",
"arm64_fuchsia_device.go",
"x86_device.go",
"x86_64_device.go",
"x86_64_fuchsia_device.go",
"x86_darwin_host.go",
"x86_linux_host.go",

View file

@ -1,81 +0,0 @@
// Copyright 2018 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (
"android/soong/android"
)
var fuchsiaArm64SysRoot string = "prebuilts/fuchsia_sdk/arch/arm64/sysroot"
var fuchsiaArm64PrebuiltLibsRoot string = "fuchsia/prebuilt_libs/"
type toolchainFuchsiaArm64 struct {
toolchain64Bit
toolchainFuchsia
}
func (t *toolchainFuchsiaArm64) Name() string {
return "arm64"
}
func (t *toolchainFuchsiaArm64) GccRoot() string {
return "${config.Arm64GccRoot}"
}
func (t *toolchainFuchsiaArm64) GccTriple() string {
return "aarch64-linux-android"
}
func (t *toolchainFuchsiaArm64) GccVersion() string {
return arm64GccVersion
}
func (t *toolchainFuchsiaArm64) IncludeFlags() string {
return ""
}
func (t *toolchainFuchsiaArm64) ClangTriple() string {
return "arm64-fuchsia-android"
}
func (t *toolchainFuchsiaArm64) Cppflags() string {
return "-Wno-error=deprecated-declarations"
}
func (t *toolchainFuchsiaArm64) Ldflags() string {
return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -L" + fuchsiaArm64PrebuiltLibsRoot + "/aarch64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/arm64/dist/"
}
func (t *toolchainFuchsiaArm64) Lldflags() string {
return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -L" + fuchsiaArm64PrebuiltLibsRoot + "/aarch64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/arm64/dist/"
}
func (t *toolchainFuchsiaArm64) Cflags() string {
return "--target=arm64-fuchsia --sysroot=" + fuchsiaArm64SysRoot + " -I" + fuchsiaArm64SysRoot + "/include"
}
func (t *toolchainFuchsiaArm64) ToolchainCflags() string {
return "-march=armv8-a"
}
var toolchainArm64FuchsiaSingleton Toolchain = &toolchainFuchsiaArm64{}
func arm64FuchsiaToolchainFactory(arch android.Arch) Toolchain {
return toolchainArm64FuchsiaSingleton
}
func init() {
registerToolchainFactory(android.Fuchsia, android.Arm64, arm64FuchsiaToolchainFactory)
}

View file

@ -1,90 +0,0 @@
// Copyright 2018 Google Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (
"android/soong/android"
)
var fuchsiaSysRoot string = "prebuilts/fuchsia_sdk/arch/x64/sysroot"
var fuchsiaPrebuiltLibsRoot string = "fuchsia/prebuilt_libs"
type toolchainFuchsia struct {
cFlags, ldFlags string
}
type toolchainFuchsiaX8664 struct {
toolchain64Bit
toolchainFuchsia
}
func (t *toolchainFuchsiaX8664) Name() string {
return "x86_64"
}
func (t *toolchainFuchsiaX8664) GccRoot() string {
return "${config.X86_64GccRoot}"
}
func (t *toolchainFuchsiaX8664) GccTriple() string {
return "x86_64-linux-android"
}
func (t *toolchainFuchsiaX8664) GccVersion() string {
return x86_64GccVersion
}
func (t *toolchainFuchsiaX8664) IncludeFlags() string {
return ""
}
func (t *toolchainFuchsiaX8664) ClangTriple() string {
return "x86_64-fuchsia-android"
}
func (t *toolchainFuchsiaX8664) Cppflags() string {
return "-Wno-error=deprecated-declarations"
}
func (t *toolchainFuchsiaX8664) Ldflags() string {
return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -L" + fuchsiaPrebuiltLibsRoot + "/x86_64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/x64/dist/"
}
func (t *toolchainFuchsiaX8664) Lldflags() string {
return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -L" + fuchsiaPrebuiltLibsRoot + "/x86_64-fuchsia/lib " + "-Lprebuilts/fuchsia_sdk/arch/x64/dist/"
}
func (t *toolchainFuchsiaX8664) Cflags() string {
return "--target=x86_64-fuchsia --sysroot=" + fuchsiaSysRoot + " -I" + fuchsiaSysRoot + "/include"
}
func (t *toolchainFuchsiaX8664) YasmFlags() string {
return "-f elf64 -m amd64"
}
func (t *toolchainFuchsiaX8664) ToolchainCflags() string {
return "-mssse3"
}
var toolchainFuchsiaSingleton Toolchain = &toolchainFuchsiaX8664{}
func fuchsiaToolchainFactory(arch android.Arch) Toolchain {
return toolchainFuchsiaSingleton
}
func init() {
registerToolchainFactory(android.Fuchsia, android.X86_64, fuchsiaToolchainFactory)
}

View file

@ -15,9 +15,10 @@
package cc
import (
"fmt"
"android/soong/android"
"android/soong/cc/config"
"fmt"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@ -389,18 +390,6 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
deps.LateSharedLibs = append(deps.LateSharedLibs, deps.SystemSharedLibs...)
if ctx.Fuchsia() {
if ctx.ModuleName() != "libbioniccompat" &&
ctx.ModuleName() != "libcompiler_rt-extras" &&
ctx.ModuleName() != "libcompiler_rt" {
deps.StaticLibs = append(deps.StaticLibs, "libbioniccompat")
}
if ctx.ModuleName() != "libcompiler_rt" && ctx.ModuleName() != "libcompiler_rt-extras" {
deps.LateStaticLibs = append(deps.LateStaticLibs, "libcompiler_rt")
}
}
if ctx.Windows() {
deps.LateStaticLibs = append(deps.LateStaticLibs, "libwinpthread")
}
@ -484,7 +473,7 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
flags.Global.LdFlags = append(flags.Global.LdFlags, toolchain.Ldflags())
}
if !ctx.toolchain().Bionic() && !ctx.Fuchsia() {
if !ctx.toolchain().Bionic() {
CheckBadHostLdlibs(ctx, "host_ldlibs", linker.Properties.Host_ldlibs)
flags.Local.LdFlags = append(flags.Local.LdFlags, linker.Properties.Host_ldlibs...)
@ -503,10 +492,6 @@ func (linker *baseLinker) linkerFlags(ctx ModuleContext, flags Flags) Flags {
}
}
if ctx.Fuchsia() {
flags.Global.LdFlags = append(flags.Global.LdFlags, "-lfdio", "-lzircon")
}
if ctx.toolchain().LibclangRuntimeLibraryArch() != "" {
flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--exclude-libs="+config.BuiltinsRuntimeLibrary(ctx.toolchain())+".a")
}

View file

@ -150,12 +150,6 @@ func (this *stubDecorator) stubsVersions(ctx android.BaseMutatorContext) []strin
if !ctx.Module().Enabled() {
return nil
}
if ctx.Os() != android.Android {
// These modules are always android.DeviceEnabled only, but
// those include Fuchsia devices, which we don't support.
ctx.Module().Disable()
return nil
}
if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
ctx.Module().Disable()
return nil

View file

@ -101,10 +101,6 @@ func classifySourceAbiDump(ctx android.BaseModuleContext) string {
// Called from sabiDepsMutator to check whether ABI dumps should be created for this module.
// ctx should be wrapping a native library type module.
func shouldCreateSourceAbiDumpForLibrary(ctx android.BaseModuleContext) bool {
if ctx.Fuchsia() {
return false
}
// Only generate ABI dump for device modules.
if !ctx.Device() {
return false

View file

@ -265,7 +265,6 @@ type SanitizeUserProps struct {
}
type SanitizeProperties struct {
// Sanitizers are not supported for Fuchsia.
Sanitize SanitizeUserProps `android:"arch_variant"`
SanitizerEnabled bool `blueprint:"mutated"`
SanitizeDep bool `blueprint:"mutated"`
@ -305,11 +304,6 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
s.Never = BoolPtr(true)
}
// Sanitizers do not work on Fuchsia yet.
if ctx.Fuchsia() {
s.Never = BoolPtr(true)
}
// Never always wins.
if Bool(s.Never) {
return

View file

@ -15,8 +15,9 @@
package cc
import (
"android/soong/android"
"fmt"
"android/soong/android"
)
func getNdkStlFamily(m LinkableInterface) string {
@ -92,26 +93,6 @@ func (stl *stl) begin(ctx BaseModuleContext) {
ctx.ModuleErrorf("stl: %q is not a supported STL for windows", s)
return ""
}
} else if ctx.Fuchsia() {
switch s {
case "c++_static":
return "libc++_static"
case "c++_shared":
return "libc++"
case "libc++", "libc++_static":
return s
case "none":
return ""
case "":
if ctx.static() {
return "libc++_static"
} else {
return "libc++"
}
default:
ctx.ModuleErrorf("stl: %q is not a supported STL on Fuchsia", s)
return ""
}
} else {
switch s {
case "libc++", "libc++_static":

View file

@ -44,9 +44,6 @@ func GatherRequiredDepsForTest(oses ...android.OsType) string {
supportLinuxBionic := false
for _, os := range oses {
if os == android.Fuchsia {
ret += withFuchsiaModules()
}
if os == android.Windows {
ret += withWindowsModules()
}
@ -471,19 +468,6 @@ func withWindowsModules() string {
`
}
func withFuchsiaModules() string {
return `
cc_library {
name: "libbioniccompat",
stl: "none",
}
cc_library {
name: "libcompiler_rt",
stl: "none",
}
`
}
func withLinuxBionic() string {
return `
cc_binary {
@ -625,14 +609,6 @@ var PrepareForTestOnLinuxBionic = android.GroupFixturePreparers(
android.FixtureOverrideTextFile(linuxBionicDefaultsPath, withLinuxBionic()),
)
// The preparer to include if running a cc related test for fuchsia.
var PrepareForTestOnFuchsia = android.GroupFixturePreparers(
// Place the default cc test modules for fuschia in a location that will not conflict with default
// test modules defined by other packages.
android.FixtureAddTextFile("defaults/cc/fuschia/Android.bp", withFuchsiaModules()),
android.PrepareForTestSetDeviceToFuchsia,
)
// This adds some additional modules and singletons which might negatively impact the performance
// of tests so they are not included in the PrepareForIntegrationTestWithCc.
var PrepareForTestWithCcIncludeVndk = android.GroupFixturePreparers(
@ -663,14 +639,7 @@ func TestConfig(buildDir string, os android.OsType, env map[string]string,
mockFS[k] = v
}
var config android.Config
if os == android.Fuchsia {
panic("Fuchsia not supported use test fixture instead")
} else {
config = android.TestArchConfig(buildDir, env, bp, mockFS)
}
return config
return android.TestArchConfig(buildDir, env, bp, mockFS)
}
// CreateTestContext is the legacy way of creating a TestContext for testing cc modules.

View file

@ -22,6 +22,7 @@ import (
"android/soong/apex"
"android/soong/cc"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@ -1774,7 +1775,7 @@ func (s *sdk) getPossibleOsTypes() []android.OsType {
var osTypes []android.OsType
for _, osType := range android.OsTypeList() {
if s.DeviceSupported() {
if osType.Class == android.Device && osType != android.Fuchsia {
if osType.Class == android.Device {
osTypes = append(osTypes, osType)
}
}