Lines Matching refs:lib
1338 def add(self, tag, lib): argument
1340 lib_set.add(lib)
1341 self._path_tag[lib] = tag
1348 def get_path_tag(self, lib): argument
1350 return self._path_tag[lib]
1355 if pattern.match(lib):
1358 return self.get_path_tag_default(lib)
1361 def get_path_tag_default(self, lib): argument
1365 def get_path_tag_bit(self, lib): argument
1366 return self.TAGS[self.get_path_tag(lib)]
1480 def add(self, tag, lib): argument
1482 lib_set.add(lib)
1483 self._path_tag[lib] = tag
1490 for lib in graph.lib_pt[PT_SYSTEM].values():
1491 d.add(tagged_paths.get_path_tag(lib.path), lib)
1494 for lib in graph.lib_pt[PT_VENDOR].values():
1495 if lib in sp_lib.sp_hal:
1496 d.add('sp_hal', lib)
1497 elif lib in sp_lib.sp_hal_dep:
1498 d.add('sp_hal_dep', lib)
1500 d.add('vendor_only', lib)
1502 for lib in graph.lib_pt[PT_PRODUCT].values():
1503 d.add('vendor_only', lib)
1505 for lib in graph.lib_pt[PT_SYSTEM_EXT].values():
1506 d.add('vendor_only', lib)
1511 def get_path_tag(self, lib): argument
1513 return self._path_tag[lib]
1515 return self.get_path_tag_default(lib)
1519 def get_path_tag_default(lib): argument
1520 return TaggedPathDict.get_path_tag_default(lib.path)
1911 for lib in libs:
1912 component = self.extract_path_component(lib.path, 3)
1914 other_libs.add(lib)
1919 other_libs.add(lib)
1923 vndk_sp_libs[version].add(lib)
1925 vndk_libs[version].add(lib)
2193 libs = [lib.path for lib in libs]
2227 def add(self, path, lib): argument
2228 self.get_lib_dict(lib.elf.ei_class)[path] = lib
2231 def remove(self, lib): argument
2232 del self.get_lib_dict(lib.elf.ei_class)[lib.path]
2279 def _add_lib_to_lookup_dict(self, lib): argument
2280 self.lib_pt[lib.partition].add(lib.path, lib)
2283 def _remove_lib_from_lookup_dict(self, lib): argument
2284 self.lib_pt[lib.partition].remove(lib)
2287 def _rename_lib(self, lib, new_path): argument
2288 self._remove_lib_from_lookup_dict(lib)
2289 lib.path = new_path
2290 lib._tag_bit = self.tagged_paths.get_path_tag_bit(new_path)
2291 self._add_lib_to_lookup_dict(lib)
2295 lib = ELFLinkData(partition, path, elf,
2297 self._add_lib_to_lookup_dict(lib)
2298 return lib
2323 for path, lib in lib_set.items():
2325 result.add(lib)
2329 lib = lib_set.get(path)
2330 if lib:
2331 result.add(lib)
2337 lib = lib_set.get(path)
2338 if lib:
2339 return lib
2346 lib = self.get_lib(path)
2347 if not lib:
2352 result.add(lib)
2358 for lib in lib_set.values():
2359 yield lib
2421 for lib in libs:
2422 if symbol in lib.elf.exported_symbols:
2423 return lib
2427 def _resolve_lib_imported_symbols(self, lib, imported_libs, generic_refs): argument
2429 for symbol in lib.elf.imported_symbols:
2432 lib.unresolved_symbols.add(symbol)
2434 lib.linked_symbols[symbol] = imported_lib
2438 lib.imported_ext_symbols[imported_lib].add(symbol)
2441 def _resolve_lib_dt_needed(self, lib, resolver): argument
2443 for dt_needed in lib.elf.dt_needed:
2444 dep = resolver.resolve(lib.path, dt_needed, lib.elf.dt_rpath,
2445 lib.elf.dt_runpath)
2448 lib.path, dt_needed, lib.elf.dt_rpath, lib.elf.dt_runpath))
2450 .format(lib.path, dt_needed, candidates),
2452 lib.unresolved_dt_needed.append(dt_needed)
2454 lib.add_needed_dep(dep)
2459 def _resolve_lib_deps(self, lib, resolver, generic_refs): argument
2461 imported_libs = self._resolve_lib_dt_needed(lib, resolver)
2469 lib.imported_ext_symbols[imported_lib].update()
2472 self._resolve_lib_imported_symbols(lib, imported_libs, generic_refs)
2476 for lib in lib_set:
2477 self._resolve_lib_deps(lib, resolver, generic_refs)
2659 return set(lib for lib in self.all_libs() if lib.is_sp_hal)
2663 def is_ll_ndk_or_sp_hal(lib): argument
2664 return lib.is_ll_ndk or lib.is_sp_hal
2666 ll_ndk = set(lib for lib in self.all_libs() if lib.is_ll_ndk)
2671 def is_ll_ndk(lib): argument
2672 return lib.is_ll_ndk
2678 def is_aosp_lib(lib): argument
2680 generic_refs.classify_lib(lib) != GenericRefs.NEW_LIB)
2684 for lib in sp_hal_closure - sp_hal:
2685 if is_aosp_lib(lib):
2686 vndk_sp_hal.add(lib)
2688 sp_hal_dep.add(lib)
2699 def is_system_lib_or_sp_hal(lib): argument
2700 return lib.is_system_lib() or lib in sp_hals
2702 for lib in self.lib_pt[PT_SYSTEM].values():
2703 if all(is_system_lib_or_sp_hal(dep) for dep in lib.deps_all):
2708 for dep in list(lib.deps_needed_all):
2712 'not exist.'.format(lib.path, dep.path),
2714 lib.hide_needed_dep(dep)
2715 for dep in list(lib.deps_dlopen_all):
2719 'not exist.'.format(lib.path, dep.path),
2721 lib.hide_dlopen_dep(dep)
2729 for lib in list(self.all_libs()):
2730 if not lib.path.startswith(APEX_PREFIX):
2733 apex_name_end = lib.path.find('/', APEX_PREFIX_LEN)
2734 apex_name = lib.path[APEX_PREFIX_LEN:apex_name_end]
2737 self._rename_lib(lib, '/apex/' + lib.path[APEX_PREFIX_LEN:])
2760 ll_ndk = set(lib for lib in self.all_libs() if lib.is_ll_ndk)
2764 lib for lib in self.all_libs() if lib.is_system_only_rs)
2766 lib for lib in self.all_libs() if lib.is_vndk_sp)
2768 lib for lib in self.all_libs() if lib.is_vndk_sp_private)
2779 def is_aosp_lib(lib): argument
2783 return lib.partition == PT_SYSTEM
2784 return generic_refs.has_same_name_lib(lib)
2786 def is_not_sp_hal_dep(lib): argument
2787 if lib.is_ll_ndk or lib in sp_hal:
2789 return is_aosp_lib(lib)
2795 def is_not_vndk_sp(lib): argument
2796 return lib.is_ll_ndk or lib in sp_hal or lib in sp_hal_dep
2801 for lib in itertools.chain(sp_hal, sp_hal_dep):
2802 for dep in lib.deps_all:
2810 'library {}.'.format(lib.path, dep.path),
2816 def is_not_vndk_sp_private(lib): argument
2817 return lib.is_ll_ndk or lib in vndk_sp or lib in system_only_rs
2824 vndk_sp_unused = set(lib for lib in predefined_vndk_sp
2825 if VNDKLibDir.is_in_vndk_sp_dir(lib.path))
2830 def is_not_vndk_sp_private_unused(lib): argument
2831 return is_not_vndk_sp_private(lib) or lib in vndk_sp_private
2837 lib for lib in predefined_vndk_sp_private
2838 if VNDKLibDir.is_in_vndk_sp_dir(lib.path))
2847 def is_vndk_sp_public(lib): argument
2848 return lib in vndk_sp or lib in vndk_sp_unused or \
2849 lib in vndk_sp_private or \
2850 lib in vndk_sp_private_unused
2852 def is_vndk_sp(lib): argument
2853 return is_vndk_sp_public(lib) or lib in vndk_sp_private
2855 def is_vndk_sp_unused(lib): argument
2856 return lib in vndk_sp_unused or lib in vndk_sp_private_unused
2858 def relabel_vndk_sp_as_used(lib): argument
2859 assert is_vndk_sp_unused(lib)
2861 if lib in vndk_sp_unused:
2862 vndk_sp_unused.remove(lib)
2863 vndk_sp.add(lib)
2865 vndk_sp_private_unused.remove(lib)
2866 vndk_sp_private.add(lib)
2870 {lib}, lambda lib: lib not in vndk_sp_private_unused, True)
2871 closure.remove(lib)
2879 for lib in libs:
2880 for dep in lib.imported_ext_symbols:
2894 for lib in libs:
2895 exts = set(lib.imported_ext_symbols.keys())
2896 for dep in lib.deps_all:
2914 def is_not_vndk_sp_private(lib): argument
2915 return lib.is_ll_ndk or lib in vndk_sp or lib in system_only_rs
2924 def is_not_vndk(lib): argument
2925 if lib.is_ll_ndk or is_vndk_sp_public(lib) or lib in system_only_rs:
2927 return lib.partition != PT_SYSTEM
2929 def is_eligible_lib_access(lib, dep): argument
2931 tagged_paths.is_path_visible(lib.path, dep.path)
2939 for lib in vendor_libs:
2940 for dep in lib.deps_all:
2953 if is_eligible_lib_access(lib, dep):
2959 .format(lib.path, dep.path), file=sys.stderr)
2971 def is_vndk(lib): argument
2972 return lib in vndk or lib in vndk_private
2983 for lib in libs:
2984 for dep in lib.imported_ext_symbols:
2997 def is_not_ll_ndk_private(lib): argument
2998 return lib.is_ll_ndk or lib.is_sp_hal or is_vndk_sp(lib) or \
2999 is_vndk_sp(lib) or is_vndk(lib)
3031 lib = stack.pop()
3032 for succ in get_successors(lib):
3160 def classify_lib(self, lib): argument
3161 ref_lib = self.refs.get(lib.path)
3164 exported_symbols = lib.elf.exported_symbols
3172 def is_equivalent_lib(self, lib): argument
3173 return self.classify_lib(lib) == GenericRefs.EXPORT_EQUAL
3176 def has_same_name_lib(self, lib): argument
3177 return os.path.basename(lib.path) in self._lib_names
3185 for lib in graph.all_libs():
3186 name = os.path.basename(lib.path)
3192 if not lib.elf.is_jni_lib():
3195 names[name].add(lib)
3196 names[root].add(lib)
3206 names[root[3:]].add(lib)
3579 for lib in lib_set.values():
3580 if not lib.num_users:
3582 if all((user.partition != partition for user in lib.users_all)):
3583 print(error_msg.format(lib.path), file=sys.stderr)
3630 for lib in sorted_lib_path_list(libs):
3631 print(tag, lib, file=file)
3639 return sorted({get_module_name(lib.path) for lib in lib_set})
3665 def collect_tags(lib): argument
3668 if lib in getattr(vndk_lib, field_name):
3678 for lib in sorted(graph.all_libs()):
3680 lib.path, collect_tags(lib), lib.elf.file_size,
3681 lib.elf.ro_seg_file_size, lib.elf.ro_seg_mem_size,
3682 lib.elf.rw_seg_file_size, lib.elf.rw_seg_mem_size))
3692 for lib in lib_set:
3693 total_file_size += lib.elf.file_size
3694 total_ro_seg_file_size += lib.elf.ro_seg_file_size
3695 total_ro_seg_mem_size += lib.elf.ro_seg_mem_size
3696 total_rw_seg_file_size += lib.elf.rw_seg_file_size
3697 total_rw_seg_mem_size += lib.elf.rw_seg_mem_size
3708 lib_set = [lib for lib in lib_set if lib.elf.is_32bit]
3715 lib_set = [lib for lib in lib_set if not lib.elf.is_32bit]
3773 libs.sort(key=lambda lib: lib.path)
3774 libs_dict = {lib: i for i, lib in enumerate(libs)}
3786 return [libs_dict[lib] for lib in sorted(libs)]
3788 def collect_deps(lib): argument
3789 queue = list(lib.deps_all)
3791 visited.add(lib)
3798 for lib in queue:
3799 for dep in lib.deps_all:
3811 def collect_source_dir_paths(lib): argument
3813 for path in module_info.get_module_path(lib.path)]
3815 def collect_tags(lib): argument
3818 if lib in getattr(vndk_lib, field_name):
3823 for lib in libs:
3824 mods.append([get_str_idx(lib.path),
3825 32 if lib.elf.is_32bit else 64,
3826 collect_tags(lib),
3827 collect_deps(lib),
3828 collect_path_sorted_lib_idxs(lib.users_all),
3829 collect_source_dir_paths(lib)])
3913 for name, lib in graph.lib_pt[partition].items():
3919 for assoc_lib in sorted(lib.users_all):
3921 collect_symbols(assoc_lib, lib)))
3923 for assoc_lib in sorted(lib.deps_all):
3925 collect_symbols(lib, assoc_lib)))
3983 for lib in sorted_lib_path_list(closure):
3984 print(indent + lib)
3993 root_libs = graph.get_libs(args.lib, report_error)
3998 def is_excluded_libs(lib): argument
3999 return lib.is_ll_ndk or lib in excluded_libs
4001 def is_excluded_libs(lib): argument
4002 return lib in excluded_libs
4010 for lib in sorted(root_libs):
4011 print(lib.path)
4012 self.print_deps_closure({lib}, graph, is_excluded_libs,
4030 def _dump_unresolved(self, lib, module_info, delimiter): argument
4031 if not lib.unresolved_symbols and not lib.unresolved_dt_needed:
4035 print(lib.path)
4036 for module_path in module_info.get_module_path(lib.path):
4038 for dt_needed in sorted(lib.unresolved_dt_needed):
4040 for symbol in sorted(lib.unresolved_symbols):
4051 libs = [lib for lib in libs if path_filter.match(lib.path)]
4054 for lib in sorted(libs):
4055 self._dump_unresolved(lib, module_info, delimiter)
4095 def _dump_dep(self, lib, bad_deps, module_info): argument
4097 print(lib.path)
4098 for module_path in module_info.get_module_path(lib.path):
4104 for symbol in lib.get_dep_linked_symbols(dep):
4171 def _is_app_lib(lib): argument
4180 return any(_is_under_dir(d, lib.path) for d in app_dirs)
4182 for lib in sorted(vendor_libs):
4186 for dep, symbols in lib.imported_ext_symbols.items():
4193 .format(lib.path, symbol, dep.path),
4197 for dep in lib.deps_all:
4199 if _is_app_lib(lib) and public_libs.is_public_lib(dep.path):
4212 'lib "{}".'.format(lib.path, dep.path),
4218 .format(lib.path, dep.path),
4223 .format(lib.path, dep.path),
4228 '/vendor/lib[64].'.format(lib.path, dep.path),
4232 self._dump_dep(lib, bad_deps, module_info)
4242 def _is_libc_prior_to_libdl(lib): argument
4243 dt_needed = lib.elf.dt_needed
4249 for lib in sorted(graph.all_libs()):
4250 if _is_libc_prior_to_libdl(lib):
4256 .format(lib.path, lib.elf.dt_needed), file=sys.stderr)
4373 def _get_lib_tag(hierarchy, tagged_paths, lib): argument
4374 return hierarchy[tagged_paths.get_path_tag(lib.path)]
4396 for lib in graph.all_libs():
4397 lib_tag = self._get_lib_tag(hierarchy, tagged_paths, lib)
4399 'name': lib.path,
4405 for dep in lib.deps_all:
4411 dep.path, lib.get_dep_linked_symbols(dep)])
4415 violate_libs[lib_tag].append((lib.path, violate_count))