summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLogan Chien <loganchien@google.com>2017-06-09 04:03:01 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-06-09 04:03:01 +0000
commitffa9960f657f50281913bc2ef492c4d88786d4c1 (patch)
treecdc8cc5e80ac812822a60ed3bdb07a4762b38c6e
parent2857064d31a41a9e7ba2935f7c5f3398a337e840 (diff)
parent79bff6a973cc8ed9b44c69a2044afbb7f67086ae (diff)
downloadandroid_development-ffa9960f657f50281913bc2ef492c4d88786d4c1.tar.gz
android_development-ffa9960f657f50281913bc2ef492c4d88786d4c1.tar.bz2
android_development-ffa9960f657f50281913bc2ef492c4d88786d4c1.zip
vndk-def: Implement VNDK-SP-Ext collection
am: 79bff6a973 Change-Id: I913291d718a09361fde2845a1d39cfe22ea61c98
-rwxr-xr-xvndk/tools/definition-tool/vndk_definition_tool.py70
1 files changed, 51 insertions, 19 deletions
diff --git a/vndk/tools/definition-tool/vndk_definition_tool.py b/vndk/tools/definition-tool/vndk_definition_tool.py
index a5e678dbe..7ab84ae2e 100755
--- a/vndk/tools/definition-tool/vndk_definition_tool.py
+++ b/vndk/tools/definition-tool/vndk_definition_tool.py
@@ -1359,24 +1359,7 @@ class ELFLinker(object):
# TODO: Compute VNDK-SP-Indirect-Private.
vndk_sp_indirect_private = set()
- predefined_vndk_sp_indirect = self.compute_predefined_vndk_sp_indirect()
-
- # TODO: Compute VNDK-SP-Ext and VNDK-SP-Indirect-Ext.
- vndk_sp_ext = set()
-
- def is_not_vndk_sp_indirect_ext(lib):
- return lib.is_ll_ndk or lib.is_sp_ndk or lib in vndk_sp_ext or \
- lib in predefined_vndk_sp or \
- lib in predefined_vndk_sp_indirect
-
- vndk_sp_indirect_ext = self.compute_closure(
- vndk_sp_ext, is_not_vndk_sp_indirect_ext)
- vndk_sp_indirect_ext -= vndk_sp_ext
-
- vndk_sp_closure = vndk_sp | vndk_sp_indirect
- extra_vndk_sp_indirect = vndk_sp_closure - predefined_vndk_sp - \
- predefined_vndk_sp_indirect
-
+ # Define helper functions for vndk_sp sets.
def is_vndk_sp_public(lib):
return lib in vndk_sp or lib in vndk_sp_unused or \
lib in vndk_sp_indirect or \
@@ -1403,6 +1386,55 @@ class ELFLinker(object):
vndk_sp_indirect_unused.difference_update(closure)
vndk_sp_indirect.update(closure)
+ # Find VNDK-SP-Ext libs.
+ vndk_sp_ext = set()
+ def collect_vndk_ext(libs):
+ result = set()
+ for lib in libs:
+ for dep in lib.imported_ext_symbols:
+ if dep in vndk_sp and dep not in vndk_sp_ext:
+ result.add(dep)
+ return result
+
+ candidates = collect_vndk_ext(self.lib_pt[PT_VENDOR].values())
+ while candidates:
+ vndk_sp_ext |= candidates
+ candidates = collect_vndk_ext(candidates)
+
+ # Find VNDK-SP-Indirect-Ext libs.
+ predefined_vndk_sp_indirect = self.compute_predefined_vndk_sp_indirect()
+ vndk_sp_indirect_ext = set()
+ def collect_vndk_sp_indirect_ext(libs):
+ result = set()
+ for lib in libs:
+ exts = set(lib.imported_ext_symbols.keys())
+ for dep in lib.deps:
+ if not is_vndk_sp_public(dep):
+ continue
+ if dep in vndk_sp_ext or dep in vndk_sp_indirect_ext:
+ continue
+ # If lib is using extended definition from deps, then we
+ # have to make a copy of dep.
+ if dep in exts:
+ result.add(dep)
+ continue
+ # If lib is using non-predefined VNDK-SP-Indirect, then we
+ # have to make a copy of dep.
+ if dep not in predefined_vndk_sp and \
+ dep not in predefined_vndk_sp_indirect:
+ result.add(dep)
+ continue
+ return result
+
+ def is_not_vndk_sp_indirect(lib):
+ return lib.is_ll_ndk or lib.is_sp_ndk or lib in vndk_sp or \
+ lib in fwk_only_rs
+
+ candidates = collect_vndk_sp_indirect_ext(vndk_sp_ext)
+ while candidates:
+ vndk_sp_indirect_ext |= candidates
+ candidates = collect_vndk_sp_indirect_ext(candidates)
+
# Find VNDK libs (a.k.a. system shared libs directly used by vendor
# partition.)
def is_not_vndk(lib):
@@ -1513,7 +1545,7 @@ class ELFLinker(object):
vndk_ext=vndk_ext | extra_vendor_libs,
# vndk_sp_ext=vndk_sp_ext,
# vndk_sp_indirect_ext=vndk_sp_indirect_ext,
- extra_vndk_sp_indirect=extra_vndk_sp_indirect)
+ extra_vndk_sp_indirect=vndk_sp_ext | vndk_sp_indirect_ext)
def compute_vndk_cap(self, banned_libs):
# ELF files on vendor partitions are banned unconditionally. ELF files