List of VNDK-related libs are exported to make
LL-NDK, VNDK-core, VNDK-SP libraries are exported to make as
SOONG_LLNDK_LIBRARIES, SOONG_VNDK_CORE_LIBRARIES, and
SOONG_VNDK_SAMEPROCESS_LIBRARIES. This can be used to auto-generate
ld.config.txt from a template.
Bug: 64013660
Test: BOARD_VNDK_VERSION=current m -j successful
Test: check out/soong/make_vars*.mk and look for SOONG_*_LIBRARIES
Merged-In: I0f4c5d05d9cd28c3fc9fdcca6ce0e6eaeaacbe8d
Change-Id: I0f4c5d05d9cd28c3fc9fdcca6ce0e6eaeaacbe8d
diff --git a/cc/vndk.go b/cc/vndk.go
index fd1bdcb..2e6ac13 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -15,6 +15,9 @@
package cc
import (
+ "strings"
+ "sync"
+
"android/soong/android"
)
@@ -96,3 +99,38 @@
return
}
}
+
+var (
+ vndkCoreLibraries []string
+ vndkSpLibraries []string
+ llndkLibraries []string
+ vndkLibrariesLock sync.Mutex
+)
+
+// gather list of vndk-core, vndk-sp, and ll-ndk libs
+func vndkMutator(mctx android.BottomUpMutatorContext) {
+ if m, ok := mctx.Module().(*Module); ok {
+ if _, ok := m.linker.(*llndkStubDecorator); ok {
+ vndkLibrariesLock.Lock()
+ defer vndkLibrariesLock.Unlock()
+ name := strings.TrimSuffix(m.Name(), llndkLibrarySuffix)
+ if !inList(name, llndkLibraries) {
+ llndkLibraries = append(llndkLibraries, name)
+ }
+ } else if lib, ok := m.linker.(*libraryDecorator); ok && lib.shared() {
+ if m.vndkdep.isVndk() {
+ vndkLibrariesLock.Lock()
+ defer vndkLibrariesLock.Unlock()
+ if m.vndkdep.isVndkSp() {
+ if !inList(m.Name(), vndkSpLibraries) {
+ vndkSpLibraries = append(vndkSpLibraries, m.Name())
+ }
+ } else {
+ if !inList(m.Name(), vndkCoreLibraries) {
+ vndkCoreLibraries = append(vndkCoreLibraries, m.Name())
+ }
+ }
+ }
+ }
+ }
+}