aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2023-05-08 13:54:50 +0900
committerJustin Yun <justinyun@google.com>2023-05-09 07:47:42 +0000
commitc21c1e4dbf56cf8a3fb95bdd6a71132dbb23d25a (patch)
tree4e5e24a9a3f13b3d8bf5e1ca52da5d9167b86e14
parent70811b4030aeae423471d03ecea7bf3ac9700065 (diff)
downloadsoong-c21c1e4dbf56cf8a3fb95bdd6a71132dbb23d25a.tar.gz
Mark LLNDK prebuilts as LLNDK
so that Vendor APEXes don't embed the LLNDK prebuilts (which are just stubs of LLNDK libraries). Bug: 280697209 Bug: 277403349 Test: m nothing (soong test) Merged-In: I9e6c123e73fa0ab56d8494a01652ee32a9b6a6cd Change-Id: I9e6c123e73fa0ab56d8494a01652ee32a9b6a6cd (cherry picked from commit e3f0281b8897da1fe23b2f4f3a05f1dc87bcc902)
-rw-r--r--apex/apex_test.go168
-rw-r--r--cc/vndk.go7
2 files changed, 174 insertions, 1 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 440afec97..5a96b8e7b 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -4102,6 +4102,174 @@ func TestVndkApexShouldNotProvideNativeLibs(t *testing.T) {
})
}
+func TestVendorApexWithVndkPrebuilts(t *testing.T) {
+ ctx := testApex(t, "",
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.DeviceVndkVersion = proptools.StringPtr("27")
+ }),
+ android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
+ cc.RegisterVendorSnapshotModules(ctx)
+ }),
+ withFiles(map[string][]byte{
+ "vendor/foo/Android.bp": []byte(`
+ apex {
+ name: "myapex",
+ binaries: ["foo"],
+ key: "myapex.key",
+ min_sdk_version: "27",
+ vendor: true,
+ }
+
+ cc_binary {
+ name: "foo",
+ vendor: true,
+ srcs: ["abc.cpp"],
+ shared_libs: [
+ "libllndk",
+ "libvndk",
+ ],
+ nocrt: true,
+ system_shared_libs: [],
+ min_sdk_version: "27",
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `),
+ // Simulate VNDK prebuilts with vendor_snapshot
+ "prebuilts/vndk/Android.bp": []byte(`
+ vndk_prebuilt_shared {
+ name: "libllndk",
+ version: "27",
+ vendor_available: true,
+ product_available: true,
+ target_arch: "arm64",
+ arch: {
+ arm64: {
+ srcs: ["libllndk.so"],
+ },
+ },
+ }
+
+ vndk_prebuilt_shared {
+ name: "libvndk",
+ version: "27",
+ vendor_available: true,
+ product_available: true,
+ target_arch: "arm64",
+ arch: {
+ arm64: {
+ srcs: ["libvndk.so"],
+ },
+ },
+ vndk: {
+ enabled: true,
+ },
+ min_sdk_version: "27",
+ }
+
+ vndk_prebuilt_shared {
+ name: "libc++",
+ version: "27",
+ target_arch: "arm64",
+ vendor_available: true,
+ product_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
+ arch: {
+ arm64: {
+ srcs: ["libc++.so"],
+ },
+ },
+ min_sdk_version: "apex_inherit",
+ }
+
+ vendor_snapshot {
+ name: "vendor_snapshot",
+ version: "27",
+ arch: {
+ arm64: {
+ vndk_libs: [
+ "libc++",
+ "libllndk",
+ "libvndk",
+ ],
+ static_libs: [
+ "libc++demangle",
+ "libclang_rt.builtins",
+ "libunwind",
+ ],
+ },
+ }
+ }
+
+ vendor_snapshot_static {
+ name: "libclang_rt.builtins",
+ version: "27",
+ target_arch: "arm64",
+ vendor: true,
+ arch: {
+ arm64: {
+ src: "libclang_rt.builtins-aarch64-android.a",
+ },
+ },
+ }
+
+ vendor_snapshot_static {
+ name: "libc++demangle",
+ version: "27",
+ target_arch: "arm64",
+ compile_multilib: "64",
+ vendor: true,
+ arch: {
+ arm64: {
+ src: "libc++demangle.a",
+ },
+ },
+ min_sdk_version: "apex_inherit",
+ }
+
+ vendor_snapshot_static {
+ name: "libunwind",
+ version: "27",
+ target_arch: "arm64",
+ compile_multilib: "64",
+ vendor: true,
+ arch: {
+ arm64: {
+ src: "libunwind.a",
+ },
+ },
+ min_sdk_version: "apex_inherit",
+ }
+ `),
+ }))
+
+ // Should embed the prebuilt VNDK libraries in the apex
+ ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
+ "bin/foo",
+ "prebuilts/vndk/libc++.so:lib64/libc++.so",
+ "prebuilts/vndk/libvndk.so:lib64/libvndk.so",
+ })
+
+ // Should link foo with prebuilt libraries (shared/static)
+ ldRule := ctx.ModuleForTests("foo", "android_vendor.27_arm64_armv8-a_myapex").Rule("ld")
+ android.AssertStringDoesContain(t, "should link to prebuilt llndk", ldRule.Args["libFlags"], "prebuilts/vndk/libllndk.so")
+ android.AssertStringDoesContain(t, "should link to prebuilt vndk", ldRule.Args["libFlags"], "prebuilts/vndk/libvndk.so")
+ android.AssertStringDoesContain(t, "should link to prebuilt libc++demangle", ldRule.Args["libFlags"], "prebuilts/vndk/libc++demangle.a")
+ android.AssertStringDoesContain(t, "should link to prebuilt libunwind", ldRule.Args["libFlags"], "prebuilts/vndk/libunwind.a")
+
+ // Should declare the LLNDK library as a "required" external dependency
+ manifestRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule")
+ requireNativeLibs := names(manifestRule.Args["requireNativeLibs"])
+ ensureListContains(t, requireNativeLibs, "libllndk.so")
+}
+
func TestDependenciesInApexManifest(t *testing.T) {
ctx := testApex(t, `
apex {
diff --git a/cc/vndk.go b/cc/vndk.go
index 30bfdd89f..9b70004c5 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -241,7 +241,7 @@ var (
func vndkModuleLister(predicate func(*Module) bool) moduleListerFunc {
return func(ctx android.SingletonContext) (moduleNames, fileNames []string) {
ctx.VisitAllModules(func(m android.Module) {
- if c, ok := m.(*Module); ok && predicate(c) {
+ if c, ok := m.(*Module); ok && predicate(c) && !c.IsVndkPrebuiltLibrary() {
filename, err := getVndkFileName(c)
if err != nil {
ctx.ModuleErrorf(m, "%s", err)
@@ -402,6 +402,11 @@ func VndkMutator(mctx android.BottomUpMutatorContext) {
m.VendorProperties.IsVNDKPrivate = Bool(prebuiltLib.Properties.Llndk.Private)
}
+ if m.IsVndkPrebuiltLibrary() && !m.IsVndk() {
+ m.VendorProperties.IsLLNDK = true
+ // TODO(b/280697209): copy "llndk.private" flag to vndk_prebuilt_shared
+ }
+
if (isLib && lib.buildShared()) || (isPrebuiltLib && prebuiltLib.buildShared()) {
if m.vndkdep != nil && m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
processVndkLibrary(mctx, m)