Lines Matching refs:handle

99   void* handle = dlopen("libtest_dlsym_from_this.so", RTLD_LAZY | RTLD_LOCAL);
100 ASSERT_TRUE(handle != nullptr) << dlerror();
109 reinterpret_cast<fn_t>(dlsym(handle, "lookup_dlsym_symbol_using_RTLD_DEFAULT"));
117 reinterpret_cast<fn_t>(dlsym(handle, "lookup_dlsym_symbol2_using_RTLD_DEFAULT"));
125 reinterpret_cast<fn_t>(dlsym(handle, "lookup_dlsym_symbol_using_RTLD_NEXT"));
132 dlclose(handle);
139 void* handle = dlopen("libtest_dlsym_from_this.so", RTLD_NOW | RTLD_LOCAL);
140 ASSERT_TRUE(handle != nullptr) << dlerror();
149 reinterpret_cast<fn_t>(dlsym(handle, "lookup_dlsym_symbol_using_RTLD_DEFAULT"));
157 reinterpret_cast<fn_t>(dlsym(handle, "lookup_dlsym_symbol2_using_RTLD_DEFAULT"));
165 reinterpret_cast<fn_t>(dlsym(handle, "lookup_dlsym_symbol_using_RTLD_NEXT"));
172 dlclose(handle);
178 // when looking up symbol by handle
179 void* handle = dlopen("libtest_empty.so", RTLD_NOW);
181 void* sym = dlsym(handle, "getRandomNumber");
185 sym = dlsym(handle, "DlSymTestFunction");
188 dlclose(handle);
193 void* handle = dlopen("libtest_dlsym_from_this.so", RTLD_NOW);
194 ASSERT_TRUE(handle != nullptr) << dlerror();
195 void* sym = dlsym(handle, "");
198 dlclose(handle);
202 void* handle = dlopen("libtest_with_dependency.so", RTLD_NOW);
203 ASSERT_TRUE(handle != nullptr);
206 void* sym = dlsym(handle, "getRandomNumber");
211 dlclose(handle);
215 void* handle = dlopen("libtest_simple.so", RTLD_NOW | RTLD_NOLOAD);
216 ASSERT_TRUE(handle == nullptr);
217 handle = dlopen("libtest_simple.so", RTLD_NOW);
219 ASSERT_TRUE(handle != nullptr);
221 ASSERT_TRUE(handle == handle2);
222 ASSERT_EQ(0, dlclose(handle));
230 void* handle = dlopen(soname, RTLD_NOW);
231 ASSERT_TRUE(handle == nullptr);
234 handle = dlopen(filename, RTLD_NOW);
235 ASSERT_TRUE(handle != nullptr) << dlerror();
240 ASSERT_EQ(handle, handle_soname);
245 ASSERT_EQ(handle, handle_filename);
249 dlclose(handle);
264 void* handle = dlopen(vdso_name, RTLD_NOW);
265 ASSERT_TRUE(handle != nullptr) << dlerror();
266 dlclose(handle);
279 void* handle = dlopen("libtest_ifunc_variable.so", RTLD_NOW);
280 ASSERT_TRUE(handle != nullptr) << dlerror();
281 const char** foo_ptr = reinterpret_cast<const char**>(dlsym(handle, "foo"));
282 fn_ptr foo_library_ptr = reinterpret_cast<fn_ptr>(dlsym(handle, "foo_library"));
287 dlclose(handle);
293 handle = dlopen("libtest_ifunc_variable.so", RTLD_NOW);
294 ASSERT_TRUE(handle != nullptr) << dlerror();
295 foo_ptr = reinterpret_cast<const char**>(dlsym(handle, "foo"));
296 foo_library_ptr = reinterpret_cast<fn_ptr>(dlsym(handle, "foo_library"));
301 dlclose(handle);
311 void* handle = dlopen("libtest_ifunc.so", RTLD_NOW);
312 ASSERT_TRUE(handle != nullptr) << dlerror();
313 fn_ptr foo_ptr = reinterpret_cast<fn_ptr>(dlsym(handle, "foo"));
314 fn_ptr foo_library_ptr = reinterpret_cast<fn_ptr>(dlsym(handle, "foo_library"));
319 dlclose(handle);
323 handle = dlopen("libtest_ifunc.so", RTLD_NOW);
324 ASSERT_TRUE(handle != nullptr) << dlerror();
325 foo_ptr = reinterpret_cast<fn_ptr>(dlsym(handle, "foo"));
326 foo_library_ptr = reinterpret_cast<fn_ptr>(dlsym(handle, "foo_library"));
331 dlclose(handle);
337 void* handle = dlopen("libtest_ifunc.so", RTLD_NOW);
338 ASSERT_TRUE(handle != nullptr) << dlerror();
339 fn_ptr is_ctor_called = reinterpret_cast<fn_ptr>(dlsym(handle, "is_ctor_called_irelative"));
343 is_ctor_called = reinterpret_cast<fn_ptr>(dlsym(handle, "is_ctor_called_jump_slot"));
346 dlclose(handle);
352 void* handle = dlopen("libtest_ifunc.so", RTLD_LAZY);
353 ASSERT_TRUE(handle != nullptr) << dlerror();
354 fn_ptr is_ctor_called = reinterpret_cast<fn_ptr>(dlsym(handle, "is_ctor_called_irelative"));
358 is_ctor_called = reinterpret_cast<fn_ptr>(dlsym(handle, "is_ctor_called_jump_slot"));
361 dlclose(handle);
377 void* handle = nullptr;
378 auto guard = android::base::make_scope_guard([&]() { dlclose(handle); });
380 handle = dlopen("libtest_relo_check_dt_needed_order.so", RTLD_NOW);
381 ASSERT_TRUE(handle != nullptr) << dlerror();
384 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "relo_test_get_answer"));
415 void* handle = dlopen("libtest_check_order_dlsym.so", RTLD_NOW | RTLD_GLOBAL);
416 ASSERT_TRUE(handle != nullptr) << dlerror();
426 dlclose(handle);
460 void* handle = dlopen("libtest_check_order_reloc_siblings.so", RTLD_NOW | RTLD_NOLOAD);
461 ASSERT_TRUE(handle == nullptr);
467 handle = dlopen("libtest_check_order_reloc_siblings.so", RTLD_NOW | RTLD_LOCAL);
468 ASSERT_TRUE(handle != nullptr) << dlerror();
471 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "check_order_reloc_get_answer"));
475 ASSERT_EQ(0, dlclose(handle));
484 void* handle = dlopen("libtest_check_order_reloc_siblings.so", RTLD_NOW | RTLD_NOLOAD);
485 ASSERT_TRUE(handle == nullptr);
486 handle = dlopen("libtest_check_order_reloc_siblings_1.so", RTLD_NOW | RTLD_NOLOAD);
487 ASSERT_TRUE(handle == nullptr);
492 handle = dlopen("libtest_check_order_reloc_siblings.so", RTLD_NOW | RTLD_LOCAL);
493 ASSERT_TRUE(handle != nullptr) << dlerror();
498 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "check_order_reloc_get_answer"));
502 ASSERT_EQ(0, dlclose(handle));
525 void* handle = dlopen("libtest_check_order_reloc_siblings.so", RTLD_NOW | RTLD_NOLOAD);
526 ASSERT_TRUE(handle == nullptr);
532 handle = dlopen("libtest_check_order_reloc_siblings.so", RTLD_NOW | RTLD_LOCAL);
533 ASSERT_TRUE(handle != nullptr) << dlerror();
536 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "check_order_reloc_grandchild_get_answer"));
540 ASSERT_EQ(0, dlclose(handle));
571 void* handle = dlopen("libtest_check_order_reloc_siblings.so", RTLD_NOW | RTLD_NOLOAD);
572 ASSERT_TRUE(handle == nullptr);
578 handle = dlopen("libtest_check_order_reloc_siblings.so", RTLD_NOW | RTLD_LOCAL);
579 ASSERT_TRUE(handle != nullptr) << dlerror();
582 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "check_order_reloc_nephew_get_answer"));
586 ASSERT_EQ(0, dlclose(handle));
602 void* handle = dlopen("libtest_two_parents_parent1.so", RTLD_NOW | RTLD_LOCAL);
603 ASSERT_TRUE(handle != nullptr) << dlerror();
613 ASSERT_EQ(0, dlclose(handle));
615 handle = dlopen("libtest_two_parents_parent1.so", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
616 ASSERT_TRUE(handle != nullptr);
617 ASSERT_EQ(0, dlclose(handle));
625 handle = dlopen("libtest_two_parents_parent1.so", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
626 ASSERT_TRUE(handle == nullptr);
646 void* handle = dlopen("libtest_check_order_reloc_root.so", RTLD_NOW | RTLD_NOLOAD);
647 ASSERT_TRUE(handle == nullptr);
653 handle = dlopen("libtest_check_order_reloc_root.so", RTLD_NOW | RTLD_LOCAL);
654 ASSERT_TRUE(handle != nullptr) << dlerror();
657 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "check_order_reloc_root_get_answer"));
661 ASSERT_EQ(0, dlclose(handle));
669 void* handle = dlopen("libtest_simple.so", RTLD_NOW);
673 sym = dlsym(handle, "dlopen_testlib_simple_func");
676 dlclose(handle);
679 handle = dlopen("libtest_simple.so", RTLD_NOW | RTLD_LOCAL);
683 sym = dlsym(handle, "dlopen_testlib_simple_func");
686 dlclose(handle);
693 void* handle = dlopen("libtest_simple.so", RTLD_NOW | RTLD_GLOBAL);
694 ASSERT_TRUE(handle != nullptr) << dlerror();
698 dlclose(handle);
704 // Check if dlsym() for main program's handle searches RTLD_GLOBAL
718 void* handle = dlopen("libtest_with_dependency_loop.so", RTLD_NOW);
719 ASSERT_TRUE(handle != nullptr) << dlerror();
720 void* f = dlsym(handle, "dlopen_test_loopy_function");
723 ASSERT_EQ(0, dlclose(handle));
726 handle = dlopen("libtest_with_dependency_loop.so", RTLD_NOW | RTLD_NOLOAD);
727 ASSERT_TRUE(handle == nullptr);
735 handle = dlopen("libtest_with_dependency_a.so", RTLD_NOW | RTLD_NOLOAD);
736 ASSERT_TRUE(handle == nullptr);
742 void* handle = dlopen("libtest_nodelete_1.so", RTLD_NOW | RTLD_NODELETE);
743 ASSERT_TRUE(handle != nullptr) << dlerror();
745 set_unload_flag_ptr = reinterpret_cast<void (*)(bool*)>(dlsym(handle, "dlopen_nodelete_1_set_unload_flag_ptr"));
749 uint32_t* taxicab_number = reinterpret_cast<uint32_t*>(dlsym(handle, "dlopen_nodelete_1_taxicab_number"));
754 dlclose(handle);
757 uint32_t* taxicab_number_after_dlclose = reinterpret_cast<uint32_t*>(dlsym(handle, "dlopen_nodelete_1_taxicab_number"));
762 handle = dlopen("libtest_nodelete_1.so", RTLD_NOW);
763 uint32_t* taxicab_number2 = reinterpret_cast<uint32_t*>(dlsym(handle, "dlopen_nodelete_1_taxicab_number"));
768 dlclose(handle);
775 void* handle = dlopen("libtest_nodelete_2.so", RTLD_NOW);
776 ASSERT_TRUE(handle != nullptr) << dlerror();
778 set_unload_flag_ptr = reinterpret_cast<void (*)(bool*)>(dlsym(handle, "dlopen_nodelete_2_set_unload_flag_ptr"));
782 uint32_t* taxicab_number = reinterpret_cast<uint32_t*>(dlsym(handle, "dlopen_nodelete_2_taxicab_number"));
791 ASSERT_EQ(handle, handle1);
794 dlclose(handle);
802 void* handle = dlopen("libtest_nodelete_dt_flags_1.so", RTLD_NOW);
803 ASSERT_TRUE(handle != nullptr) << dlerror();
805 set_unload_flag_ptr = reinterpret_cast<void (*)(bool*)>(dlsym(handle, "dlopen_nodelete_dt_flags_1_set_unload_flag_ptr"));
809 dlclose(handle);
814 void* handle = dlopen("libtest_dlsym_df_1_global.so", RTLD_NOW);
815 ASSERT_TRUE(handle != nullptr) << dlerror();
817 get_answer = reinterpret_cast<int (*)()>(dlsym(handle, "dl_df_1_global_get_answer"));
820 ASSERT_EQ(0, dlclose(handle));
834 void* handle = dlopen("libtest_simple.so", RTLD_NOW);
835 ASSERT_TRUE(handle != nullptr) << dlerror();
836 uint32_t* taxicab_number = static_cast<uint32_t*>(dlsym(handle, "dlopen_testlib_taxicab_number"));
839 dlclose(handle);
851 void* handle = dlopen("/child/thread", RTLD_NOW);
852 ASSERT_TRUE(handle == nullptr);
861 void* handle = dlopen("/main/thread", RTLD_NOW);
862 ASSERT_TRUE(handle == nullptr);
877 void* handle = dlopen("/main/thread", RTLD_NOW);
878 ASSERT_TRUE(handle == nullptr);
900 // so it can be distinguished from the NULL handle.
903 ASSERT_STREQ("dlsym failed: library handle is null", dlerror());
1045 void* handle = dlopen("libgnu-hash-table-library.so", RTLD_NOW);
1046 ASSERT_TRUE(handle != nullptr) << dlerror();
1047 auto guard = android::base::make_scope_guard([&]() { dlclose(handle); });
1048 void* sym = dlsym(handle, "getRandomNumber");
1066 void* handle = dlopen("libsysv-hash-table-library.so", RTLD_NOW);
1067 ASSERT_TRUE(handle != nullptr) << dlerror();
1068 auto guard = android::base::make_scope_guard([&]() { dlclose(handle); });
1069 void* sym = dlsym(handle, "getRandomNumber");
1085 void* handle = dlopen("libelf-tls-library.so", RTLD_NOW);
1086 ASSERT_TRUE(handle == nullptr);
1092 void* handle;
1096 handle = dlopen(nullptr, 0);
1097 ASSERT_TRUE(handle == nullptr);
1101 handle = dlopen(nullptr, 0xffffffff);
1102 ASSERT_TRUE(handle == nullptr);
1106 handle = dlopen(nullptr, RTLD_NOW|RTLD_LAZY);
1107 ASSERT_TRUE(handle != nullptr);
1149 void* handle = dlopen("libtest_dlsym_weak_func.so", RTLD_NOW);
1150 ASSERT_TRUE(handle != nullptr);
1153 weak_func = reinterpret_cast<int (*)()>(dlsym(handle, "weak_func"));
1156 dlclose(handle);
1160 void* handle = dlopen("libtest_dlopen_weak_undefined_func.so", RTLD_NOW);
1161 ASSERT_TRUE(handle != nullptr) << dlerror();
1163 weak_func = reinterpret_cast<int (*)()>(dlsym(handle, "use_weak_undefined_func"));
1166 dlclose(handle);
1187 void* handle = dlopen("libtest_dlopen_from_ctor_main.so", RTLD_NOW);
1188 ASSERT_TRUE(handle != nullptr) << dlerror();
1189 dlclose(handle);
1203 void* handle = dlopen(libname, RTLD_NOW);
1204 ASSERT_TRUE(handle != nullptr) << dlerror();
1207 reinterpret_cast<get_init_order_number_t>(dlsym(handle, "get_init_order_number"));
1212 reinterpret_cast<set_fini_callback_t>(dlsym(handle, "set_fini_callback"));
1214 dlclose(handle);
1224 void* handle = dlopen("libtest_versioned_uselibv1.so", RTLD_NOW);
1225 ASSERT_TRUE(handle != nullptr) << dlerror();
1227 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "get_function_version"));
1230 dlclose(handle);
1234 void* handle = dlopen("libtest_versioned_uselibv2.so", RTLD_NOW);
1235 ASSERT_TRUE(handle != nullptr) << dlerror();
1237 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "get_function_version"));
1240 dlclose(handle);
1244 void* handle = dlopen("libtest_versioned_uselibv2_other.so", RTLD_NOW);
1245 ASSERT_TRUE(handle != nullptr) << dlerror();
1247 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "get_function_version"));
1250 dlclose(handle);
1254 void* handle = dlopen("libtest_versioned_uselibv3_other.so", RTLD_NOW);
1255 ASSERT_TRUE(handle != nullptr) << dlerror();
1257 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "get_function_version"));
1260 dlclose(handle);
1264 void* handle = dlopen("libtest_versioned_lib.so", RTLD_NOW);
1265 ASSERT_TRUE(handle != nullptr) << dlerror();
1267 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "versioned_function"));
1270 dlclose(handle);
1274 void* handle = dlopen("libtest_versioned_lib.so", RTLD_NOW);
1275 ASSERT_TRUE(handle != nullptr) << dlerror();
1279 fn_t fn = reinterpret_cast<fn_t>(dlvsym(handle, "versioned_function", "nonversion"));
1285 fn_t fn = reinterpret_cast<fn_t>(dlvsym(handle, "versioned_function", "TESTLIB_V2"));
1290 dlclose(handle);
1304 void* handle = dlopen("libtest_dt_runpath_d.so", RTLD_NOW);
1305 ASSERT_TRUE(handle != nullptr) << dlerror();
1308 dlopen_b_fn fn = (dlopen_b_fn)dlsym(handle, "dlopen_b");
1314 dlclose(handle);
1319 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1320 ASSERT_TRUE(handle != nullptr) << dlerror();
1323 dlopen_b_fn fn = (dlopen_b_fn)dlsym(handle, "dlopen_b");
1329 dlclose(handle);
1335 auto f = [](void* handle, bool* is_dtor_triggered) {
1337 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "init_thread_local_variable"));
1345 void* handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW | RTLD_NOLOAD);
1346 ASSERT_TRUE(handle == nullptr);
1348 handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW);
1349 ASSERT_TRUE(handle != nullptr) << dlerror();
1351 std::thread t(f, handle, &is_dtor_triggered);
1355 dlclose(handle);
1357 handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW | RTLD_NOLOAD);
1358 ASSERT_TRUE(handle == nullptr);
1365 void* handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW | RTLD_NOLOAD);
1366 ASSERT_TRUE(handle == nullptr);
1368 handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW);
1369 ASSERT_TRUE(handle != nullptr) << dlerror();
1372 fn_t fn = reinterpret_cast<fn_t>(dlsym(handle, "init_thread_local_variable"));
1377 dlclose(handle);
1381 // Since we have thread_atexit dtors associated with handle - the library should
1383 handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW | RTLD_NOLOAD);
1384 ASSERT_TRUE(handle != nullptr) << dlerror();
1385 dlclose(handle);
1388 void* handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW);
1389 ASSERT_TRUE(handle != nullptr) << dlerror();
1390 dlclose(handle);
1392 handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW | RTLD_NOLOAD);
1393 ASSERT_TRUE(handle == nullptr);
1400 handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW | RTLD_NOLOAD);
1401 ASSERT_TRUE(handle == nullptr);
1405 handle = dlopen("libtest_thread_local_dtor.so", RTLD_NOW | RTLD_NOLOAD);
1406 ASSERT_TRUE(handle != nullptr) << dlerror();
1516 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1517 ASSERT_TRUE(handle == nullptr);
1527 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1528 ASSERT_TRUE(handle == nullptr);
1538 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1539 ASSERT_TRUE(handle == nullptr);
1549 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1550 ASSERT_TRUE(handle == nullptr);
1560 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1561 ASSERT_TRUE(handle == nullptr);
1571 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1572 ASSERT_TRUE(handle == nullptr);
1582 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1583 ASSERT_TRUE(handle == nullptr);
1593 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1594 ASSERT_TRUE(handle == nullptr);
1604 void* handle = dlopen(libpath.c_str(), RTLD_NOW);
1605 ASSERT_TRUE(handle == nullptr);
1611 void* handle = dlopen("libtest_dlopen_df_1_global.so", RTLD_NOW);
1612 ASSERT_TRUE(handle != nullptr) << dlerror();