Delete toolchain_library
Test: m && ci Change-Id: Iab5267e02e3559431d980c70a58b49c2b8b4e6de
This commit is contained in:
parent
0bda815c2e
commit
718eb27f5b
12 changed files with 76 additions and 289 deletions
19
Android.bp
19
Android.bp
|
@ -46,25 +46,6 @@ cc_defaults {
|
||||||
// C static libraries extracted from the gcc toolchain
|
// 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 {
|
kernel_headers {
|
||||||
name: "device_kernel_headers",
|
name: "device_kernel_headers",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
|
|
@ -27,17 +27,6 @@ const (
|
||||||
soongCcLibraryPreamble = `
|
soongCcLibraryPreamble = `
|
||||||
cc_defaults {
|
cc_defaults {
|
||||||
name: "linux_bionic_supported",
|
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 = `
|
soongCcProtoLibraries = `
|
||||||
|
@ -64,7 +53,6 @@ func registerCcLibraryModuleTypes(ctx android.RegistrationContext) {
|
||||||
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
|
||||||
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
|
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
|
||||||
ctx.RegisterModuleType("cc_prebuilt_library_static", cc.PrebuiltStaticLibraryFactory)
|
ctx.RegisterModuleType("cc_prebuilt_library_static", cc.PrebuiltStaticLibraryFactory)
|
||||||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
|
||||||
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
|
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,7 +1252,7 @@ cc_library {
|
||||||
include_build_directory: false,
|
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"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,17 +26,6 @@ const (
|
||||||
soongCcLibraryHeadersPreamble = `
|
soongCcLibraryHeadersPreamble = `
|
||||||
cc_defaults {
|
cc_defaults {
|
||||||
name: "linux_bionic_supported",
|
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) {
|
func registerCcLibraryHeadersModuleTypes(ctx android.RegistrationContext) {
|
||||||
cc.RegisterCCBuildComponents(ctx)
|
cc.RegisterCCBuildComponents(ctx)
|
||||||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCcLibraryHeadersTestCase(t *testing.T, tc bp2buildTestCase) {
|
func runCcLibraryHeadersTestCase(t *testing.T, tc bp2buildTestCase) {
|
||||||
|
|
|
@ -30,7 +30,6 @@ const (
|
||||||
|
|
||||||
func registerCcLibrarySharedModuleTypes(ctx android.RegistrationContext) {
|
func registerCcLibrarySharedModuleTypes(ctx android.RegistrationContext) {
|
||||||
cc.RegisterCCBuildComponents(ctx)
|
cc.RegisterCCBuildComponents(ctx)
|
||||||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
|
||||||
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
|
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
|
||||||
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
|
ctx.RegisterModuleType("cc_library_static", cc.LibraryStaticFactory)
|
||||||
ctx.RegisterModuleType("cc_library", cc.LibraryFactory)
|
ctx.RegisterModuleType("cc_library", cc.LibraryFactory)
|
||||||
|
@ -422,7 +421,7 @@ cc_library_shared {
|
||||||
include_build_directory: false,
|
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"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,17 +27,6 @@ const (
|
||||||
soongCcLibraryStaticPreamble = `
|
soongCcLibraryStaticPreamble = `
|
||||||
cc_defaults {
|
cc_defaults {
|
||||||
name: "linux_bionic_supported",
|
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) {
|
func registerCcLibraryStaticModuleTypes(ctx android.RegistrationContext) {
|
||||||
cc.RegisterCCBuildComponents(ctx)
|
cc.RegisterCCBuildComponents(ctx)
|
||||||
ctx.RegisterModuleType("toolchain_library", cc.ToolchainLibraryFactory)
|
|
||||||
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
|
ctx.RegisterModuleType("cc_library_headers", cc.LibraryHeaderFactory)
|
||||||
ctx.RegisterModuleType("genrule", genrule.GenRuleFactory)
|
ctx.RegisterModuleType("genrule", genrule.GenRuleFactory)
|
||||||
// Required for system_shared_libs dependencies.
|
// Required for system_shared_libs dependencies.
|
||||||
|
|
|
@ -68,7 +68,6 @@ bootstrap_go_package {
|
||||||
"native_bridge_sdk_trait.go",
|
"native_bridge_sdk_trait.go",
|
||||||
"object.go",
|
"object.go",
|
||||||
"test.go",
|
"test.go",
|
||||||
"toolchain_library.go",
|
|
||||||
|
|
||||||
"ndk_abi.go",
|
"ndk_abi.go",
|
||||||
"ndk_headers.go",
|
"ndk_headers.go",
|
||||||
|
|
|
@ -439,14 +439,6 @@ func (test *testLibrary) AndroidMkEntries(ctx AndroidMkContext, entries *android
|
||||||
ctx.subAndroidMk(entries, test.libraryDecorator)
|
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) {
|
func (installer *baseInstaller) AndroidMkEntries(ctx AndroidMkContext, entries *android.AndroidMkEntries) {
|
||||||
if installer.path == (android.InstallPath{}) {
|
if installer.path == (android.InstallPath{}) {
|
||||||
return
|
return
|
||||||
|
|
18
cc/cc.go
18
cc/cc.go
|
@ -548,8 +548,7 @@ type feature interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// compiler is the interface for a compiler helper object. Different module decorators may implement
|
// 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
|
// this helper differently.
|
||||||
// statement than building a `toolchain_library`.
|
|
||||||
type compiler interface {
|
type compiler interface {
|
||||||
compilerInit(ctx BaseModuleContext)
|
compilerInit(ctx BaseModuleContext)
|
||||||
compilerDeps(ctx DepsContext, deps Deps) Deps
|
compilerDeps(ctx DepsContext, deps Deps) Deps
|
||||||
|
@ -979,13 +978,6 @@ func (c *Module) SelectedStl() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Module) ToolchainLibrary() bool {
|
|
||||||
if _, ok := c.linker.(*toolchainLibraryDecorator); ok {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Module) NdkPrebuiltStl() bool {
|
func (c *Module) NdkPrebuiltStl() bool {
|
||||||
if _, ok := c.linker.(*ndkPrebuiltStlLinker); ok {
|
if _, ok := c.linker.(*ndkPrebuiltStlLinker); ok {
|
||||||
return true
|
return true
|
||||||
|
@ -2450,10 +2442,6 @@ func checkLinkType(ctx android.BaseModuleContext, from LinkableInterface, to Lin
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if c, ok := to.(*Module); ok {
|
if c, ok := to.(*Module); ok {
|
||||||
if c.ToolchainLibrary() {
|
|
||||||
// These are always allowed
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if c.NdkPrebuiltStl() {
|
if c.NdkPrebuiltStl() {
|
||||||
// These are allowed, but they don't set sdk_version
|
// These are allowed, but they don't set sdk_version
|
||||||
return
|
return
|
||||||
|
@ -3439,10 +3427,6 @@ func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
|
||||||
if strings.HasPrefix(ctx.OtherModuleName(c), "libclang_rt") {
|
if strings.HasPrefix(ctx.OtherModuleName(c), "libclang_rt") {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// b/154569636: set min_sdk_version correctly for toolchain_libraries
|
|
||||||
if c.ToolchainLibrary() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
// We don't check for prebuilt modules
|
// We don't check for prebuilt modules
|
||||||
if _, ok := c.linker.(prebuiltLinkerInterface); ok {
|
if _, ok := c.linker.(prebuiltLinkerInterface); ok {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -427,7 +427,7 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
||||||
|
|
||||||
deps.LateSharedLibs = append(deps.LateSharedLibs, deps.SystemSharedLibs...)
|
deps.LateSharedLibs = append(deps.LateSharedLibs, deps.SystemSharedLibs...)
|
||||||
|
|
||||||
if ctx.Windows() {
|
if ctx.Windows() && ctx.ModuleName() != "libwinpthread" {
|
||||||
deps.LateStaticLibs = append(deps.LateStaticLibs, "libwinpthread")
|
deps.LateStaticLibs = append(deps.LateStaticLibs, "libwinpthread")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
145
cc/testing.go
145
cc/testing.go
|
@ -30,7 +30,6 @@ func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) {
|
||||||
RegisterLibraryBuildComponents(ctx)
|
RegisterLibraryBuildComponents(ctx)
|
||||||
RegisterLibraryHeadersBuildComponents(ctx)
|
RegisterLibraryHeadersBuildComponents(ctx)
|
||||||
|
|
||||||
ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory)
|
|
||||||
ctx.RegisterModuleType("cc_benchmark", BenchmarkFactory)
|
ctx.RegisterModuleType("cc_benchmark", BenchmarkFactory)
|
||||||
ctx.RegisterModuleType("cc_object", ObjectFactory)
|
ctx.RegisterModuleType("cc_object", ObjectFactory)
|
||||||
ctx.RegisterModuleType("cc_genrule", GenRuleFactory)
|
ctx.RegisterModuleType("cc_genrule", GenRuleFactory)
|
||||||
|
@ -63,41 +62,14 @@ func GatherRequiredDepsForTest(oses ...android.OsType) string {
|
||||||
|
|
||||||
func commonDefaultModules() string {
|
func commonDefaultModules() string {
|
||||||
return `
|
return `
|
||||||
toolchain_library {
|
cc_defaults {
|
||||||
name: "libcompiler_rt-extras",
|
name: "toolchain_libs_defaults",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
vendor_ramdisk_available: true,
|
|
||||||
product_available: true,
|
product_available: true,
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
src: "",
|
no_libcrt: true,
|
||||||
}
|
sdk_version: "minimum",
|
||||||
|
|
||||||
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",
|
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
recovery_available: true,
|
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
stl: "none",
|
stl: "none",
|
||||||
srcs: [""],
|
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",
|
name: "libclang_rt.builtins-i686-android",
|
||||||
vendor_available: true,
|
defaults: ["toolchain_libs_defaults"],
|
||||||
vendor_ramdisk_available: true,
|
vendor_ramdisk_available: true,
|
||||||
product_available: true,
|
|
||||||
recovery_available: true,
|
|
||||||
native_bridge_supported: true,
|
native_bridge_supported: true,
|
||||||
src: "",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libclang_rt.builtins-x86_64-android",
|
name: "libclang_rt.builtins-x86_64-android",
|
||||||
defaults: ["linux_bionic_supported"],
|
defaults: [
|
||||||
vendor_available: true,
|
"linux_bionic_supported",
|
||||||
vendor_ramdisk_available: true,
|
"toolchain_libs_defaults",
|
||||||
product_available: true,
|
],
|
||||||
recovery_available: true,
|
|
||||||
native_bridge_supported: true,
|
native_bridge_supported: true,
|
||||||
src: "",
|
vendor_ramdisk_available: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libunwind",
|
name: "libunwind",
|
||||||
defaults: ["linux_bionic_supported"],
|
defaults: [
|
||||||
vendor_available: true,
|
"linux_bionic_supported",
|
||||||
|
"toolchain_libs_defaults",
|
||||||
|
],
|
||||||
vendor_ramdisk_available: true,
|
vendor_ramdisk_available: true,
|
||||||
product_available: true,
|
|
||||||
recovery_available: true,
|
|
||||||
native_bridge_supported: true,
|
native_bridge_supported: true,
|
||||||
src: "",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libclang_rt.fuzzer-arm-android",
|
name: "libclang_rt.fuzzer-arm-android",
|
||||||
vendor_available: true,
|
defaults: ["toolchain_libs_defaults"],
|
||||||
product_available: true,
|
|
||||||
recovery_available: true,
|
|
||||||
src: "",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libclang_rt.fuzzer-aarch64-android",
|
name: "libclang_rt.fuzzer-aarch64-android",
|
||||||
vendor_available: true,
|
defaults: ["toolchain_libs_defaults"],
|
||||||
product_available: true,
|
|
||||||
recovery_available: true,
|
|
||||||
src: "",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libclang_rt.fuzzer-i686-android",
|
name: "libclang_rt.fuzzer-i686-android",
|
||||||
vendor_available: true,
|
defaults: ["toolchain_libs_defaults"],
|
||||||
product_available: true,
|
|
||||||
recovery_available: true,
|
|
||||||
src: "",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libclang_rt.fuzzer-x86_64-android",
|
name: "libclang_rt.fuzzer-x86_64-android",
|
||||||
defaults: ["linux_bionic_supported"],
|
defaults: [
|
||||||
vendor_available: true,
|
"linux_bionic_supported",
|
||||||
product_available: true,
|
"toolchain_libs_defaults",
|
||||||
recovery_available: true,
|
],
|
||||||
src: "",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libclang_rt.fuzzer-x86_64",
|
name: "libclang_rt.fuzzer-x86_64",
|
||||||
vendor_available: true,
|
defaults: [
|
||||||
product_available: true,
|
"linux_bionic_supported",
|
||||||
recovery_available: true,
|
"toolchain_libs_defaults",
|
||||||
src: "",
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed for sanitizer
|
// Needed for sanitizer
|
||||||
cc_prebuilt_library_shared {
|
cc_prebuilt_library_shared {
|
||||||
name: "libclang_rt.ubsan_standalone-aarch64-android",
|
name: "libclang_rt.ubsan_standalone-aarch64-android",
|
||||||
vendor_available: true,
|
defaults: ["toolchain_libs_defaults"],
|
||||||
product_available: true,
|
|
||||||
recovery_available: true,
|
|
||||||
system_shared_libs: [],
|
|
||||||
srcs: [""],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
|
@ -480,7 +458,7 @@ func commonDefaultModules() string {
|
||||||
|
|
||||||
func withWindowsModules() string {
|
func withWindowsModules() string {
|
||||||
return `
|
return `
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libwinpthread",
|
name: "libwinpthread",
|
||||||
host_supported: true,
|
host_supported: true,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
@ -489,7 +467,8 @@ func withWindowsModules() string {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
src: "",
|
stl: "none",
|
||||||
|
srcs:[""],
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
||||||
}
|
|
|
@ -65,10 +65,13 @@ func TestVendorSnapshotCapture(t *testing.T) {
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libb",
|
name: "libb",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
src: "libb.a",
|
srcs: ["libb.a"],
|
||||||
|
nocrt: true,
|
||||||
|
no_libcrt: true,
|
||||||
|
stl: "none",
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_object {
|
cc_object {
|
||||||
|
@ -1222,10 +1225,13 @@ func TestRecoverySnapshotCapture(t *testing.T) {
|
||||||
nocrt: true,
|
nocrt: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
toolchain_library {
|
cc_prebuilt_library_static {
|
||||||
name: "libb",
|
name: "libb",
|
||||||
recovery_available: true,
|
recovery_available: true,
|
||||||
src: "libb.a",
|
srcs: ["libb.a"],
|
||||||
|
nocrt: true,
|
||||||
|
no_libcrt: true,
|
||||||
|
stl: "none",
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_object {
|
cc_object {
|
||||||
|
|
Loading…
Reference in a new issue