summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cc/cc_test.go17
-rw-r--r--cc/image.go59
-rw-r--r--cc/llndk_library.go12
3 files changed, 49 insertions, 39 deletions
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 3502d5f36..be0391309 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -738,12 +738,29 @@ func TestVndkWhenVndkVersionIsNotSet(t *testing.T) {
},
nocrt: true,
}
+
+ cc_library {
+ name: "libllndk",
+ llndk_stubs: "libllndk.llndk",
+ }
+
+ llndk_library {
+ name: "libllndk.llndk",
+ symbol_file: "",
+ export_llndk_headers: ["libllndk_headers"],
+ }
+
+ llndk_headers {
+ name: "libllndk_headers",
+ export_include_dirs: ["include"],
+ }
`)
checkVndkOutput(t, ctx, "vndk/vndk.libraries.txt", []string{
"LLNDK: libc.so",
"LLNDK: libdl.so",
"LLNDK: libft2.so",
+ "LLNDK: libllndk.so",
"LLNDK: libm.so",
"VNDK-SP: libc++.so",
"VNDK-core: libvndk-private.so",
diff --git a/cc/image.go b/cc/image.go
index 12bd65b67..86c7e60a7 100644
--- a/cc/image.go
+++ b/cc/image.go
@@ -282,31 +282,34 @@ func (m *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
productVndkVersion = platformVndkVersion
}
- if boardVndkVersion == "" {
+ _, isLLNDKLibrary := m.linker.(*llndkStubDecorator)
+ _, isLLNDKHeaders := m.linker.(*llndkHeadersDecorator)
+ lib := moduleLibraryInterface(m)
+ hasLLNDKStubs := lib != nil && lib.hasLLNDKStubs()
+
+ if isLLNDKLibrary || isLLNDKHeaders || hasLLNDKStubs {
+ // This is an LLNDK library. The implementation of the library will be on /system,
+ // and vendor and product variants will be created with LLNDK stubs.
+ // The LLNDK libraries need vendor variants even if there is no VNDK.
+ // The obsolete llndk_library and llndk_headers modules also need the vendor variants
+ // so the cc_library LLNDK stubs can depend on them.
+ if hasLLNDKStubs {
+ coreVariantNeeded = true
+ }
+ if platformVndkVersion != "" {
+ vendorVariants = append(vendorVariants, platformVndkVersion)
+ productVariants = append(productVariants, platformVndkVersion)
+ }
+ if boardVndkVersion != "" {
+ vendorVariants = append(vendorVariants, boardVndkVersion)
+ }
+ if productVndkVersion != "" {
+ productVariants = append(productVariants, productVndkVersion)
+ }
+ } else if boardVndkVersion == "" {
// If the device isn't compiling against the VNDK, we always
// use the core mode.
coreVariantNeeded = true
- } else if _, ok := m.linker.(*llndkStubDecorator); ok {
- // LL-NDK stubs only exist in the vendor and product variants,
- // since the real libraries will be used in the core variant.
- vendorVariants = append(vendorVariants,
- platformVndkVersion,
- boardVndkVersion,
- )
- productVariants = append(productVariants,
- platformVndkVersion,
- productVndkVersion,
- )
- } else if _, ok := m.linker.(*llndkHeadersDecorator); ok {
- // ... and LL-NDK headers as well
- vendorVariants = append(vendorVariants,
- platformVndkVersion,
- boardVndkVersion,
- )
- productVariants = append(productVariants,
- platformVndkVersion,
- productVndkVersion,
- )
} else if m.isSnapshotPrebuilt() {
// Make vendor variants only for the versions in BOARD_VNDK_VERSION and
// PRODUCT_EXTRA_VNDK_VERSIONS.
@@ -364,18 +367,6 @@ func (m *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
} else {
vendorVariants = append(vendorVariants, platformVndkVersion)
}
- } else if lib := moduleLibraryInterface(m); lib != nil && lib.hasLLNDKStubs() {
- // This is an LLNDK library. The implementation of the library will be on /system,
- // and vendor and product variants will be created with LLNDK stubs.
- coreVariantNeeded = true
- vendorVariants = append(vendorVariants,
- platformVndkVersion,
- boardVndkVersion,
- )
- productVariants = append(productVariants,
- platformVndkVersion,
- productVndkVersion,
- )
} else {
// This is either in /system (or similar: /data), or is a
// modules built with the NDK. Modules built with the NDK
diff --git a/cc/llndk_library.go b/cc/llndk_library.go
index bd48501a3..a46b31c8b 100644
--- a/cc/llndk_library.go
+++ b/cc/llndk_library.go
@@ -161,6 +161,13 @@ type llndkHeadersDecorator struct {
*libraryDecorator
}
+func (llndk *llndkHeadersDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
+ deps.HeaderLibs = append(deps.HeaderLibs, llndk.Properties.Llndk.Export_llndk_headers...)
+ deps.ReexportHeaderLibHeaders = append(deps.ReexportHeaderLibHeaders,
+ llndk.Properties.Llndk.Export_llndk_headers...)
+ return deps
+}
+
// llndk_headers contains a set of c/c++ llndk headers files which are imported
// by other soongs cc modules.
func llndkHeadersFactory() android.Module {
@@ -178,11 +185,6 @@ func llndkHeadersFactory() android.Module {
module.installer = nil
module.library = decorator
- module.AddProperties(
- &module.Properties,
- &library.MutatedProperties,
- &library.flagExporter.Properties)
-
module.Init()
return module