Lines Matching full:soinfo
107 void add_soinfo(soinfo* si) {
111 void add_soinfos(const soinfo::soinfo_list_t& soinfos) {
118 void remove_soinfo(soinfo* si) {
119 soinfo_list_.remove_if([&](soinfo* candidate) {
124 const soinfo::soinfo_list_t& soinfo_list() const { return soinfo_list_; }
136 soinfo::soinfo_list_t soinfo_list_;
143 static std::unordered_map<uintptr_t, soinfo*> g_soinfo_handles_map;
148 static LinkerTypeAllocator<soinfo> g_soinfo_allocator;
149 static LinkerTypeAllocator<LinkedListEntry<soinfo>> g_soinfo_links_allocator;
154 static soinfo* solist;
155 static soinfo* sonext;
156 static soinfo* somain; // main process, always the one after libdl_info
210 static bool is_greylisted(const char* name, const soinfo* needed_by) {
264 static std::vector<soinfo*> g_ld_preloads;
267 static soinfo::soinfo_list_t g_public_namespace;
310 static void notify_gdb_of_load(soinfo* info) {
329 static void notify_gdb_of_unload(soinfo* info) {
359 LinkedListEntry<soinfo>* SoinfoListAllocator::alloc() {
363 void SoinfoListAllocator::free(LinkedListEntry<soinfo>* entry) {
375 static soinfo* soinfo_alloc(android_namespace_t* ns, const char* name,
383 soinfo* si = new (g_soinfo_allocator.alloc()) soinfo(ns, name, file_stat,
392 TRACE("name %s: allocated soinfo @ %p", name, si);
396 static void soinfo_free(soinfo* si) {
411 soinfo *prev = nullptr, *trav;
413 TRACE("name %s: freeing soinfo @ %p", si->get_realpath(), si);
438 si->~soinfo();
509 void soinfo::set_dt_runpath(const char* path) {
584 for (soinfo* si = solist; si != 0; si = si->next) {
600 for (soinfo* si = solist; si != nullptr; si = si->next) {
614 const ElfW(Versym)* soinfo::get_versym(size_t n) const {
622 ElfW(Addr) soinfo::get_verneed_ptr() const {
630 size_t soinfo::get_verneed_cnt() const {
638 ElfW(Addr) soinfo::get_verdef_ptr() const {
646 size_t soinfo::get_verdef_cnt() const {
655 static bool for_each_verdef(const soinfo* si, F functor) {
702 bool soinfo::find_verdef_version_index(const version_info* vi, ElfW(Versym)* versym) const {
723 bool soinfo::find_symbol_by_name(SymbolName& symbol_name,
739 static bool is_symbol_global_and_defined(const soinfo* si, const ElfW(Sym)* s) {
765 bool soinfo::gnu_lookup(SymbolName& symbol_name,
834 bool soinfo::elf_lookup(SymbolName& symbol_name,
877 soinfo::soinfo(android_namespace_t* ns, const char* realpath,
899 soinfo::~soinfo() {
941 bool soinfo_do_lookup(soinfo* si_from, const char* name, const version_info* vi,
942 soinfo** si_found_in, const soinfo::soinfo_list_t& global_group,
943 const soinfo::soinfo_list_t& local_group, const ElfW(Sym)** symbol) {
972 global_group.visit([&](soinfo* global_si) {
996 local_group.visit([&](soinfo* local_si) {
1106 static LoadTask* create(const char* name, soinfo* needed_by,
1107 std::unordered_map<const soinfo*, ElfReader>* readers_map) {
1116 soinfo* get_needed_by() const {
1120 soinfo* get_soinfo() const {
1124 void set_soinfo(soinfo* si) {
1171 std::unordered_map<const soinfo*, ElfReader>* get_readers_map() {
1197 LoadTask(const char* name, soinfo* needed_by,
1198 std::unordered_map<const soinfo*, ElfReader>* readers_map)
1210 soinfo* needed_by_;
1211 soinfo* si_;
1216 std::unordered_map<const soinfo*, ElfReader>* elf_readers_map_;
1229 typedef linked_list_t<soinfo> SoinfoLinkedList;
1234 // This function walks down the tree of soinfo dependencies
1236 // * calls action(soinfo* si) for each node, and
1242 static bool walk_dependencies_tree(soinfo* root_soinfos[], size_t root_soinfos_size, F action) {
1250 soinfo* si;
1262 si->get_children().for_each([&](soinfo* child) {
1271 static const ElfW(Sym)* dlsym_handle_lookup(soinfo* root, soinfo* skip_until,
1272 soinfo** found, SymbolName& symbol_name,
1277 walk_dependencies_tree(&root, 1, [&](soinfo* current_soinfo) {
1302 soinfo** found,
1303 soinfo* caller,
1307 // specified soinfo object and its dependencies in breadth first order.
1308 static const ElfW(Sym)* dlsym_handle_lookup(soinfo* si, soinfo** found,
1328 specified soinfo (for RTLD_NEXT).
1333 soinfo** found,
1334 soinfo* caller,
1353 soinfo* si = *it;
1388 soinfo* find_containing_library(const void* p) {
1390 for (soinfo* si = solist; si != nullptr; si = si->next) {
1398 ElfW(Sym)* soinfo::find_symbol_by_address(const void* addr) {
1408 ElfW(Sym)* soinfo::gnu_addr_lookup(const void* addr) {
1429 ElfW(Sym)* soinfo::elf_addr_lookup(const void* addr) {
1602 const char* name, soinfo *needed_by,
1670 static void for_each_dt_needed(const soinfo* si, F action) {
1719 auto predicate = [&](soinfo* si) {
1727 soinfo* si = ns->soinfo_list().find_if(predicate);
1739 "will return existing soinfo", name, si->get_realpath());
1752 const soinfo* needed_by = task->is_dt_needed() ? task->get_needed_by() : nullptr;
1756 const soinfo* needed_or_dlopened_by = task->get_needed_by();
1787 soinfo* si = soinfo_alloc(ns, realpath.c_str(), &file_stat, file_offset, rtld_flags);
1803 // going to be overwritten on soinfo::prelink_image
1828 soinfo* needed_by = task->get_needed_by();
1868 const char* name, soinfo** candidate) {
1878 return !ns->soinfo_list().visit([&](soinfo* si) {
1908 soinfo* candidate;
1917 candidate = g_public_namespace.find_if([&](soinfo* si) {
1948 static void soinfo_unload(soinfo* si);
1949 static void soinfo_unload(soinfo* soinfos[], size_t count);
1958 static soinfo::soinfo_list_t make_global_group(android_namespace_t* ns) {
1959 soinfo::soinfo_list_t global_group;
1960 ns->soinfo_list().for_each([&](soinfo* si) {
1974 static soinfo::soinfo_list_t get_shared_group(android_namespace_t* ns) {
1979 soinfo::soinfo_list_t shared_group;
1980 ns->soinfo_list().for_each([&](soinfo* si) {
2002 soinfo* start_with,
2004 size_t library_names_count, soinfo* soinfos[],
2005 std::vector<soinfo*>* ld_preloads,
2011 std::unordered_map<const soinfo*, ElfReader> readers_map;
2019 soinfo::soinfo_list_t global_group = make_global_group(ns);
2029 size_t soinfos_size = sizeof(soinfo*)*library_names_count;
2030 soinfos = reinterpret_cast<soinfo**>(alloca(soinfos_size));
2054 soinfo* needed_by = task->get_needed_by();
2064 soinfo* si = task->get_soinfo();
2088 soinfo* si = task->get_soinfo();
2108 soinfo* si = task->get_soinfo();
2126 soinfo::soinfo_list_t local_group;
2130 [&] (soinfo* si) {
2139 bool linked = local_group.visit([&](soinfo* si) {
2150 local_group.for_each([](soinfo* si) {
2166 static soinfo* find_library(android_namespace_t* ns,
2169 soinfo* needed_by) {
2170 soinfo* si;
2182 static void soinfo_unload(soinfo* root) {
2195 static void soinfo_unload(soinfo* soinfos[], size_t count) {
2206 soinfo::soinfo_list_t unload_list;
2208 soinfo* si = soinfos[i];
2227 soinfo* root = soinfos[0];
2229 soinfo::soinfo_list_t local_unload_list;
2230 soinfo::soinfo_list_t external_unload_list;
2231 soinfo* si = nullptr;
2241 soinfo* child = nullptr;
2256 __libc_fatal("soinfo for \"%s\"@%p has no version", si->get_realpath(), si);
2258 PRINT("warning: soinfo for \"%s\"@%p has no version", si->get_realpath(), si);
2260 TRACE("deprecated (old format of soinfo): %s needs to unload %s",
2263 soinfo* needed = find_library(si->get_primary_namespace(),
2287 local_unload_list.for_each([](soinfo* si) {
2309 static android_namespace_t* get_caller_namespace(soinfo* caller) {
2342 soinfo* const caller = find_containing_library(caller_addr);
2400 soinfo* si = find_library(ns, translated_name, flags, extinfo, caller);
2411 soinfo* si = find_containing_library(addr);
2432 static soinfo* soinfo_from_handle(void* handle) {
2442 return static_cast<soinfo*>(handle);
2459 soinfo* found = nullptr;
2461 soinfo* caller = find_containing_library(caller_addr);
2476 soinfo* si = soinfo_from_handle(handle);
2502 soinfo* si = soinfo_from_handle(handle);
2528 soinfo* candidate = nullptr;
2575 soinfo* caller_soinfo = find_containing_library(caller_addr);
2632 const soinfo* target_si) {
2642 bool VersionTracker::init_verneed(const soinfo* si_from) {
2663 soinfo* target_si = si_from->get_children().find_if([&](const soinfo* si) {
2688 soinfo* si_from) {
2698 bool VersionTracker::init(const soinfo* si_from) {
2706 bool soinfo::lookup_version_info(const VersionTracker& version_tracker, ElfW(Word) sym,
2743 bool soinfo::relocate(const VersionTracker& version_tracker, ElfRelIteratorT&& rel_iterator,
2765 soinfo* lsi = nullptr;
3106 void soinfo::call_array(const char* array_name __unused, linker_function_t* functions,
3126 void soinfo::call_function(const char* function_name __unused, linker_function_t function) {
3136 void soinfo::call_pre_init_constructors() {
3142 void soinfo::call_constructors() {
3153 // soinfo for libc_malloc_debug_leak.so.
3155 // called again with the libc soinfo. If it doesn't trigger the early-
3164 get_children().for_each([] (soinfo* si) {
3175 void soinfo::call_destructors() {
3192 void soinfo::add_child(soinfo* child) {
3199 void soinfo::remove_all_links() {
3205 children_.for_each([&] (soinfo* child) {
3206 child->parents_.remove_if([&] (const soinfo* parent) {
3211 parents_.for_each([&] (soinfo* parent) {
3212 parent->children_.remove_if([&] (const soinfo* child) {
3233 dev_t soinfo::get_st_dev() const {
3241 ino_t soinfo::get_st_ino() const {
3249 off64_t soinfo::get_file_offset() const {
3257 uint32_t soinfo::get_rtld_flags() const {
3265 uint32_t soinfo::get_dt_flags_1() const {
3273 void soinfo::set_dt_flags_1(uint32_t dt_flags_1) {
3287 void soinfo::set_nodelete() {
3291 const char* soinfo::get_realpath() const {
3303 void soinfo::set_soname(const char* soname) {
3314 const char* soinfo::get_soname() const {
3328 static soinfo::soinfo_list_t g_empty_list;
3330 soinfo::soinfo_list_t& soinfo::get_children() {
3338 const soinfo::soinfo_list_t& soinfo::get_children() const {
3346 soinfo::soinfo_list_t& soinfo::get_parents() {
3356 const std::vector<std::string>& soinfo::get_dt_runpath() const {
3364 android_namespace_t* soinfo::get_primary_namespace() {
3372 void soinfo::add_secondary_namespace(android_namespace_t* secondary_ns) {
3377 ElfW(Addr) soinfo::resolve_symbol_address(const ElfW(Sym)* s) const {
3385 const char* soinfo::get_string(ElfW(Word) index) const {
3394 bool soinfo::is_gnu_hash() const {
3398 bool soinfo::can_unload() const {
3402 bool soinfo::is_linked() const {
3406 bool soinfo::is_main_executable() const {
3410 bool soinfo::is_linker() const {
3414 void soinfo::set_linked() {
3418 void soinfo::set_linker_flag() {
3422 void soinfo::set_main_executable() {
3426 void soinfo::increment_ref_count() {
3430 size_t soinfo::decrement_ref_count() {
3434 soinfo* soinfo::get_local_group_root() const {
3439 void soinfo::set_mapped_by_caller(bool mapped_by_caller) {
3447 bool soinfo::is_mapped_by_caller() const {
3454 uint32_t soinfo::get_target_sdk_version() const {
3462 uintptr_t soinfo::get_handle() const {
3468 void* soinfo::to_handle() {
3476 void soinfo::generate_handle() {
3495 bool soinfo::prelink_image() {
3932 bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t& local_group,
4077 bool soinfo::protect_relro() {
4098 soinfo* si = soinfo_alloc(&g_default_namespace, "[vdso]", nullptr, 0, 0);
4107 si->link_image(g_empty_list, soinfo::soinfo_list_t::make_list(si), nullptr);
4115 * Note that the linker shouldn't be on the soinfo list.
4235 soinfo* si = soinfo_alloc(&g_default_namespace, executable_path, &file_stat, 0, RTLD_GLOBAL);
4237 __libc_fatal("Couldn't allocate soinfo: out of memory?");
4321 if (!si->link_image(g_empty_list, soinfo::soinfo_list_t::make_list(si), nullptr)) {
4433 soinfo linker_so(nullptr, nullptr, nullptr, 0, 0);