diff options
author | Logan Chien <loganchien@google.com> | 2017-06-09 04:02:55 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-09 04:02:55 +0000 |
commit | 2857064d31a41a9e7ba2935f7c5f3398a337e840 (patch) | |
tree | 45478700f09d6a4624c4126fbdbec6bf953465df | |
parent | d9407507536f49751af8c636f34fec174c45017d (diff) | |
parent | 30598eaf81b40d3f0986d25794ad170c567ca4bf (diff) | |
download | android_development-2857064d31a41a9e7ba2935f7c5f3398a337e840.tar.gz android_development-2857064d31a41a9e7ba2935f7c5f3398a337e840.tar.bz2 android_development-2857064d31a41a9e7ba2935f7c5f3398a337e840.zip |
vndk-def: Collect non-AOSP libs must be copied
am: 30598eaf81
Change-Id: I41cff376fb4b25b367d46d6c8a761cfb925a88f4
-rwxr-xr-x | vndk/tools/definition-tool/vndk_definition_tool.py | 80 |
1 files changed, 50 insertions, 30 deletions
diff --git a/vndk/tools/definition-tool/vndk_definition_tool.py b/vndk/tools/definition-tool/vndk_definition_tool.py index 7ea7b4b92..a5e678dbe 100755 --- a/vndk/tools/definition-tool/vndk_definition_tool.py +++ b/vndk/tools/definition-tool/vndk_definition_tool.py @@ -1293,14 +1293,18 @@ class ELFLinker(object): self.normalize_partition_tags(sp_hal, generic_refs) # Find SP-HAL-Dep libs. - def is_not_sp_hal_dep(lib): - if lib.is_ll_ndk or lib.is_sp_ndk or lib in sp_hal: - return True + def is_aosp_lib(lib): if not generic_refs: - # Use simple heuristic when generic reference is not available. + # If generic reference is not available, then assume all system + # libs are AOSP libs. return lib.partition == PT_SYSTEM return generic_refs.has_same_name_lib(lib) + def is_not_sp_hal_dep(lib): + if lib.is_ll_ndk or lib.is_sp_ndk or lib in sp_hal: + return True + return is_aosp_lib(lib) + sp_hal_dep = self.compute_closure(sp_hal, is_not_sp_hal_dep) sp_hal_dep -= sp_hal @@ -1405,34 +1409,46 @@ class ELFLinker(object): if lib.is_ll_ndk or lib.is_sp_ndk or is_vndk_sp_public(lib) or \ lib in fwk_only_rs: return True - if lib.partition != PT_SYSTEM: - return True - if not generic_refs: - # If generic reference is not available, we assume all system - # libs are eligible vndk. - return False - return not generic_refs.has_same_name_lib(lib) + return lib.partition != PT_SYSTEM + + def is_eligible_lib_access(lib, dep): + return not tagged_paths or \ + tagged_paths.is_path_visible(lib.path, dep.path) follow_ineligible_vndk, warn_ineligible_vndk = \ self._parse_action_on_ineligible_lib(action_ineligible_vndk) vndk = set() - for lib in self.lib_pt[PT_VENDOR].values(): - for dep in lib.deps: - if is_vndk_sp_unused(dep): - relabel_vndk_sp_as_used(dep) - continue - if is_not_vndk(dep): - continue - if not tagged_paths or \ - tagged_paths.is_path_visible(lib.path, dep.path): - vndk.add(dep) - continue - if warn_ineligible_vndk: - print('warning: vendor lib/exe {} depends on ineligible ' - 'framework shared lib {}.' - .format(lib.path, dep.path), file=sys.stderr) - if follow_ineligible_vndk: - vndk.add(dep) + extra_vendor_libs = set() + def collect_vndk(vendor_libs): + next_vendor_libs = set() + for lib in vendor_libs: + for dep in lib.deps: + if is_vndk_sp_unused(dep): + relabel_vndk_sp_as_used(dep) + continue + if is_not_vndk(dep): + continue + if not is_aosp_lib(dep): + # The dependency should be copied into vendor partition + # as an extra vendor lib. + if dep not in extra_vendor_libs: + next_vendor_libs.add(dep) + extra_vendor_libs.add(dep) + continue + if is_eligible_lib_access(lib, dep): + vndk.add(dep) + continue + if warn_ineligible_vndk: + print('warning: vendor lib/exe {} depends on ' + 'ineligible framework shared lib {}.' + .format(lib.path, dep.path), file=sys.stderr) + if follow_ineligible_vndk: + vndk.add(dep) + return next_vendor_libs + + candidates = collect_vndk(self.lib_pt[PT_VENDOR].values()) + while candidates: + candidates = collect_vndk(candidates) vndk_indirect = self.compute_closure(vndk, is_not_vndk) vndk_indirect -= vndk @@ -1440,7 +1456,10 @@ class ELFLinker(object): def is_vndk(lib): return lib in vndk or lib in vndk_indirect - # Compute the extended usages from vendor partition. + # Find VNDK-EXT libs (VNDK libs with extended definitions and the + # extended definitions are used by the vendor modules (including + # extra_vendor_libs). + # FIXME: DAUX libraries won't be found by the following algorithm. vndk_ext = set() @@ -1453,6 +1472,7 @@ class ELFLinker(object): return result candidates = collect_vndk_ext(self.lib_pt[PT_VENDOR].values()) + candidates |= collect_vndk_ext(extra_vendor_libs) while candidates: vndk_ext |= candidates @@ -1490,7 +1510,7 @@ class ELFLinker(object): sp_hal=sp_hal, sp_hal_dep=sp_hal_dep, # vnd_only=vnd_only, - vndk_ext=vndk_ext, + 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) |