Add SDK member support for cc_object.
Test: m nothing
Test: Add
sdk {
name: "runtime-module-sdk",
native_shared_libs: [
"libc",
"libdl",
"libm",
"ld-android",
],
native_objects: [
"crtbegin_dynamic",
"crtbegin_static",
"crtend_android",
],
}
to bionic/apex/Android.bp. Then:
build/soong/scripts/build-aml-prebuilts.sh runtime-module-sdk
Take the generated runtime-module-sdk-current.zip and unzip into a
master-art tree without bionic/, edit the generated Android.bp to
extend cc_prebuilt_* modules with:
nocrt: true,
stl: "none",
system_shared_libs: [],
apex_available: ["//apex_available:anyapex"],
recovery_available: true,
vendor_available: true,
ramdisk_available: true,
Then "m com.android.art.debug". This passes Soong but fails in the
build step because more members are required.
Bug: 148934017
Change-Id: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
diff --git a/cc/library_headers.go b/cc/library_headers.go
index 88cf7af..b7ab390 100644
--- a/cc/library_headers.go
+++ b/cc/library_headers.go
@@ -29,7 +29,7 @@
SupportsSdk: true,
},
prebuiltModuleType: "cc_prebuilt_library_headers",
- linkTypes: nil,
+ noOutputFiles: true,
}
func RegisterLibraryHeadersBuildComponents(ctx android.RegistrationContext) {
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go
index 843ebb0..69c3d18 100644
--- a/cc/library_sdk_member.go
+++ b/cc/library_sdk_member.go
@@ -18,6 +18,7 @@
"path/filepath"
"android/soong/android"
+
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
)
@@ -53,7 +54,10 @@
prebuiltModuleType string
- // The set of link types supported, set of "static", "shared".
+ noOutputFiles bool // True if there are no srcs files.
+
+ // The set of link types supported. A set of "static", "shared", or nil to
+ // skip link type variations.
linkTypes []string
}
@@ -327,7 +331,7 @@
// If the library has some link types then it produces an output binary file, otherwise it
// is header only.
- if p.memberType.linkTypes != nil {
+ if !p.memberType.noOutputFiles {
p.outputFile = ccModule.OutputFile().Path()
}
diff --git a/cc/object.go b/cc/object.go
index 74badc9..19decec 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -26,6 +26,16 @@
func init() {
android.RegisterModuleType("cc_object", ObjectFactory)
+ android.RegisterSdkMemberType(ccObjectSdkMemberType)
+}
+
+var ccObjectSdkMemberType = &librarySdkMemberType{
+ SdkMemberTypeBase: android.SdkMemberTypeBase{
+ PropertyName: "native_objects",
+ SupportsSdk: true,
+ },
+ prebuiltModuleType: "cc_prebuilt_object",
+ linkTypes: nil,
}
type objectLinker struct {
@@ -67,6 +77,7 @@
// Clang's address-significance tables are incompatible with ld -r.
module.compiler.appendCflags([]string{"-fno-addrsig"})
+ module.sdkMemberTypes = []android.SdkMemberType{ccObjectSdkMemberType}
return module.Init()
}