Delete toolchain_library

Test: m && ci
Change-Id: Iab5267e02e3559431d980c70a58b49c2b8b4e6de
This commit is contained in:
Liz Kammer 2022-01-07 10:53:37 -05:00
parent 0bda815c2e
commit 718eb27f5b
12 changed files with 76 additions and 289 deletions

View file

@ -46,25 +46,6 @@ cc_defaults {
// C static libraries extracted from the gcc toolchain
//
toolchain_library {
name: "libwinpthread",
host_supported: true,
enabled: false,
target: {
windows: {
enabled: true,
},
windows_x86: {
src: "prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib32/libwinpthread.a",
},
windows_x86_64: {
src: "prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib/libwinpthread.a",
},
},
notice: ":mingw-libwinpthread-notice",
licenses: ["winpthreads_license"],
}
kernel_headers {
name: "device_kernel_headers",
vendor: true,

View file

@ -27,17 +27,6 @@ const (
soongCcLibraryPreamble = `
cc_defaults {
name: "linux_bionic_supported",
}
toolchain_library {
name: "libclang_rt.builtins-x86_64-android",
defaults: ["linux_bionic_supported"],
vendor_available: true,
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
native_bridge_supported: true,
src: "",
}`
soongCcProtoLibraries = `
@ -64,7 +53,6 @@ func registerCcLibraryModuleTypes(ctx android.RegistrationContext) {
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
ctx.RegisterModuleType("cc_prebuilt_library_static", cc.PrebuiltStaticLibraryFactory)
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
}
@ -1264,7 +1252,7 @@ cc_library {
include_build_directory: false,
}
`,
expectedErr: fmt.Errorf("Android.bp:16:1: module \"foo-lib\": nocrt is not supported for arch variants"),
expectedErr: fmt.Errorf("module \"foo-lib\": nocrt is not supported for arch variants"),
})
}

View file

@ -26,17 +26,6 @@ const (
soongCcLibraryHeadersPreamble = `
cc_defaults {
name: "linux_bionic_supported",
}
toolchain_library {
name: "libclang_rt.builtins-x86_64-android",
defaults: ["linux_bionic_supported"],
vendor_available: true,
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
native_bridge_supported: true,
src: "",
}`
)
@ -68,7 +57,6 @@ func TestCcLibraryHeadersLoadStatement(t *testing.T) {
func registerCcLibraryHeadersModuleTypes(ctx android.RegistrationContext) {
cc.RegisterCCBuildComponents(ctx)
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
}
func runCcLibraryHeadersTestCase(t *testing.T, tc bp2buildTestCase) {

View file

@ -30,7 +30,6 @@ const (
func registerCcLibrarySharedModuleTypes(ctx android.RegistrationContext) {
cc.RegisterCCBuildComponents(ctx)
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
ctx.RegisterModuleType("cc_library", cc.LibraryFactory)
@ -422,7 +421,7 @@ cc_library_shared {
include_build_directory: false,
}
`,
expectedErr: fmt.Errorf("Android.bp:16:1: module \"foo_shared\": nocrt is not supported for arch variants"),
expectedErr: fmt.Errorf("module \"foo_shared\": nocrt is not supported for arch variants"),
})
}

View file

@ -27,17 +27,6 @@ const (
soongCcLibraryStaticPreamble = `
cc_defaults {
name: "linux_bionic_supported",
}
toolchain_library {
name: "libclang_rt.builtins-x86_64-android",
defaults: ["linux_bionic_supported"],
vendor_available: true,
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
native_bridge_supported: true,
src: "",
}`
)
@ -69,7 +58,6 @@ func TestCcLibraryStaticLoadStatement(t *testing.T) {
func registerCcLibraryStaticModuleTypes(ctx android.RegistrationContext) {
cc.RegisterCCBuildComponents(ctx)
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
ctx.RegisterModuleType("genrule", genrule.GenRuleFactory)
// Required for system_shared_libs dependencies.

View file

@ -68,7 +68,6 @@ bootstrap_go_package {
"native_bridge_sdk_trait.go",
"object.go",
"test.go",
"toolchain_library.go",
"ndk_abi.go",
"ndk_headers.go",

View file

@ -439,14 +439,6 @@ func (test *testLibrary) AndroidMkEntries(ctx AndroidMkContext, entries *android
ctx.subAndroidMk(entries, test.libraryDecorator)
}
func (library *toolchainLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
entries.Class = "STATIC_LIBRARIES"
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
_, suffix, _ := android.SplitFileExt(entries.OutputFile.Path().Base())
entries.SetString("LOCAL_MODULE_SUFFIX", suffix)
})
}
func (installer *baseInstaller) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
if installer.path == (android.InstallPath{}) {
return

View file

@ -548,8 +548,7 @@ type feature interface {
}
// compiler is the interface for a compiler helper object. Different module decorators may implement
// this helper differently. For example, compiling a `cc_library` may use a different build
// statement than building a `toolchain_library`.
// this helper differently.
type compiler interface {
compilerInit(ctx BaseModuleContext)
compilerDeps(ctx DepsContext, deps Deps) Deps
@ -979,13 +978,6 @@ func (c *Module) SelectedStl() string {
return ""
}
func (c *Module) ToolchainLibrary() bool {
if _, ok := c.linker.(*toolchainLibraryDecorator); ok {
return true
}
return false
}
func (c *Module) NdkPrebuiltStl() bool {
if _, ok := c.linker.(*ndkPrebuiltStlLinker); ok {
return true
@ -2450,10 +2442,6 @@ func checkLinkType(ctx android.BaseModuleContext, from LinkableInterface, to Lin
return
}
if c, ok := to.(*Module); ok {
if c.ToolchainLibrary() {
// These are always allowed
return
}
if c.NdkPrebuiltStl() {
// These are allowed, but they don't set sdk_version
return
@ -3439,10 +3427,6 @@ func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
if strings.HasPrefix(ctx.OtherModuleName(c), "libclang_rt") {
return nil
}
// b/154569636: set min_sdk_version correctly for toolchain_libraries
if c.ToolchainLibrary() {
return nil
}
// We don't check for prebuilt modules
if _, ok := c.linker.(prebuiltLinkerInterface); ok {
return nil

View file

@ -427,7 +427,7 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
deps.LateSharedLibs = append(deps.LateSharedLibs, deps.SystemSharedLibs...)
if ctx.Windows() {
if ctx.Windows() && ctx.ModuleName() != "libwinpthread" {
deps.LateStaticLibs = append(deps.LateStaticLibs, "libwinpthread")
}

View file

@ -30,7 +30,6 @@ func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
RegisterLibraryBuildComponents(ctx)
RegisterLibraryHeadersBuildComponents(ctx)
ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
ctx.RegisterModuleType("cc_benchmark", BenchmarkFactory)
ctx.RegisterModuleType("cc_object", ObjectFactory)
ctx.RegisterModuleType("cc_genrule", GenRuleFactory)
@ -63,41 +62,14 @@ func GatherRequiredDepsForTest(oses ...android.OsType) string {
func commonDefaultModules() string {
return `
toolchain_library {
name: "libcompiler_rt-extras",
cc_defaults {
name: "toolchain_libs_defaults",
vendor_available: true,
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
src: "",
}
toolchain_library {
name: "libclang_rt.builtins-arm-android",
vendor_available: true,
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
native_bridge_supported: true,
src: "",
}
toolchain_library {
name: "libclang_rt.builtins-aarch64-android",
vendor_available: true,
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
native_bridge_supported: true,
src: "",
}
cc_prebuilt_library_shared {
name: "libclang_rt.hwasan-aarch64-android",
no_libcrt: true,
sdk_version: "minimum",
nocrt: true,
vendor_available: true,
product_available: true,
recovery_available: true,
system_shared_libs: [],
stl: "none",
srcs: [""],
@ -107,87 +79,93 @@ func commonDefaultModules() string {
},
}
toolchain_library {
cc_prebuilt_library_static {
name: "libcompiler_rt-extras",
defaults: ["toolchain_libs_defaults"],
vendor_ramdisk_available: true,
}
cc_prebuilt_library_static {
name: "libclang_rt.builtins-arm-android",
defaults: ["toolchain_libs_defaults"],
native_bridge_supported: true,
vendor_ramdisk_available: true,
}
cc_prebuilt_library_static {
name: "libclang_rt.builtins-aarch64-android",
defaults: ["toolchain_libs_defaults"],
native_bridge_supported: true,
vendor_ramdisk_available: true,
}
cc_prebuilt_library_shared {
name: "libclang_rt.hwasan-aarch64-android",
defaults: ["toolchain_libs_defaults"],
}
cc_prebuilt_library_static {
name: "libclang_rt.builtins-i686-android",
vendor_available: true,
defaults: ["toolchain_libs_defaults"],
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
native_bridge_supported: true,
src: "",
}
toolchain_library {
cc_prebuilt_library_static {
name: "libclang_rt.builtins-x86_64-android",
defaults: ["linux_bionic_supported"],
vendor_available: true,
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
defaults: [
"linux_bionic_supported",
"toolchain_libs_defaults",
],
native_bridge_supported: true,
src: "",
vendor_ramdisk_available: true,
}
toolchain_library {
cc_prebuilt_library_static {
name: "libunwind",
defaults: ["linux_bionic_supported"],
vendor_available: true,
defaults: [
"linux_bionic_supported",
"toolchain_libs_defaults",
],
vendor_ramdisk_available: true,
product_available: true,
recovery_available: true,
native_bridge_supported: true,
src: "",
}
toolchain_library {
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-arm-android",
vendor_available: true,
product_available: true,
recovery_available: true,
src: "",
defaults: ["toolchain_libs_defaults"],
}
toolchain_library {
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-aarch64-android",
vendor_available: true,
product_available: true,
recovery_available: true,
src: "",
defaults: ["toolchain_libs_defaults"],
}
toolchain_library {
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-i686-android",
vendor_available: true,
product_available: true,
recovery_available: true,
src: "",
defaults: ["toolchain_libs_defaults"],
}
toolchain_library {
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-x86_64-android",
defaults: ["linux_bionic_supported"],
vendor_available: true,
product_available: true,
recovery_available: true,
src: "",
defaults: [
"linux_bionic_supported",
"toolchain_libs_defaults",
],
}
toolchain_library {
cc_prebuilt_library_static {
name: "libclang_rt.fuzzer-x86_64",
vendor_available: true,
product_available: true,
recovery_available: true,
src: "",
defaults: [
"linux_bionic_supported",
"toolchain_libs_defaults",
],
}
// Needed for sanitizer
cc_prebuilt_library_shared {
name: "libclang_rt.ubsan_standalone-aarch64-android",
vendor_available: true,
product_available: true,
recovery_available: true,
system_shared_libs: [],
srcs: [""],
defaults: ["toolchain_libs_defaults"],
}
cc_library {
@ -480,7 +458,7 @@ func commonDefaultModules() string {
func withWindowsModules() string {
return `
toolchain_library {
cc_prebuilt_library_static {
name: "libwinpthread",
host_supported: true,
enabled: false,
@ -489,7 +467,8 @@ func withWindowsModules() string {
enabled: true,
},
},
src: "",
stl: "none",
srcs:[""],
}
`
}

View file

@ -1,117 +0,0 @@
// Copyright 2016 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 cc
import (
"android/soong/android"
)
//
// Device libraries shipped with gcc
//
func init() {
android.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
}
type toolchainLibraryProperties struct {
// the prebuilt toolchain library, as a path from the top of the source tree
Src *string `android:"arch_variant"`
// Repack the archive with only the selected objects.
Repack_objects_to_keep []string `android:"arch_variant"`
}
type toolchainLibraryDecorator struct {
*libraryDecorator
stripper Stripper
Properties toolchainLibraryProperties
}
func (*toolchainLibraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
// toolchain libraries can't have any dependencies
return deps
}
func (library *toolchainLibraryDecorator) linkerProps() []interface{} {
var props []interface{}
props = append(props, library.libraryDecorator.linkerProps()...)
return append(props, &library.Properties, &library.stripper.StripProperties)
}
// toolchain_library is used internally by the build tool to link the specified
// static library in src property to the device libraries that are shipped with
// gcc.
func ToolchainLibraryFactory() android.Module {
module, library := NewLibrary(android.HostAndDeviceSupported)
library.BuildOnlyStatic()
toolchainLibrary := &toolchainLibraryDecorator{
libraryDecorator: library,
}
module.compiler = toolchainLibrary
module.linker = toolchainLibrary
module.stl = nil
module.sanitize = nil
module.installer = nil
module.library = toolchainLibrary
module.Properties.Sdk_version = StringPtr("current")
return module.Init()
}
func (library *toolchainLibraryDecorator) compile(ctx ModuleContext, flags Flags,
deps PathDeps) Objects {
return Objects{}
}
func (library *toolchainLibraryDecorator) link(ctx ModuleContext,
flags Flags, deps PathDeps, objs Objects) android.Path {
if library.Properties.Src == nil {
ctx.PropertyErrorf("src", "No library source specified")
return android.PathForSource(ctx, "")
}
srcPath := android.PathForSource(ctx, *library.Properties.Src)
outputFile := android.Path(srcPath)
if library.Properties.Repack_objects_to_keep != nil {
fileName := ctx.ModuleName() + staticLibraryExtension
repackedPath := android.PathForModuleOut(ctx, fileName)
transformArchiveRepack(ctx, outputFile, repackedPath, library.Properties.Repack_objects_to_keep)
outputFile = repackedPath
}
if library.stripper.StripProperties.Strip.Keep_symbols_list != nil {
fileName := ctx.ModuleName() + staticLibraryExtension
strippedPath := android.PathForModuleOut(ctx, fileName)
stripFlags := flagsToStripFlags(flags)
library.stripper.StripStaticLib(ctx, outputFile, strippedPath, stripFlags)
outputFile = strippedPath
}
depSet := android.NewDepSetBuilder(android.TOPOLOGICAL).Direct(outputFile).Build()
ctx.SetProvider(StaticLibraryInfoProvider, StaticLibraryInfo{
StaticLibrary: outputFile,
TransitiveStaticLibrariesForOrdering: depSet,
})
return outputFile
}
func (library *toolchainLibraryDecorator) nativeCoverage() bool {
return false
}

View file

@ -65,10 +65,13 @@ func TestVendorSnapshotCapture(t *testing.T) {
nocrt: true,
}
toolchain_library {
cc_prebuilt_library_static {
name: "libb",
vendor_available: true,
src: "libb.a",
srcs: ["libb.a"],
nocrt: true,
no_libcrt: true,
stl: "none",
}
cc_object {
@ -1222,10 +1225,13 @@ func TestRecoverySnapshotCapture(t *testing.T) {
nocrt: true,
}
toolchain_library {
cc_prebuilt_library_static {
name: "libb",
recovery_available: true,
src: "libb.a",
srcs: ["libb.a"],
nocrt: true,
no_libcrt: true,
stl: "none",
}
cc_object {