Revert "Load libraries in breadth-first order"
This reverts commita3ad450a2e. (cherry picked from commit498eb18b82) Change-Id: Iec7eab83d0c0ed1604e1e8ea3f9e9d0ce1d29680
This commit is contained in:
@@ -158,55 +158,6 @@ TEST(dlfcn, dlopen_check_relocation_dt_needed_order) {
|
||||
ASSERT_EQ(1, fn());
|
||||
}
|
||||
|
||||
TEST(dlfcn, dlopen_check_order) {
|
||||
// Here is how the test library and its dt_needed
|
||||
// libraries are arranged
|
||||
//
|
||||
// libtest_check_order.so
|
||||
// |
|
||||
// +-> libtest_check_order_1_left.so
|
||||
// | |
|
||||
// | +-> libtest_check_order_a.so
|
||||
// | |
|
||||
// | +-> libtest_check_order_b.so
|
||||
// |
|
||||
// +-> libtest_check_order_2_right.so
|
||||
// | |
|
||||
// | +-> libtest_check_order_d.so
|
||||
// | |
|
||||
// | +-> libtest_check_order_b.so
|
||||
// |
|
||||
// +-> libtest_check_order_3_c.so
|
||||
//
|
||||
// load order should be (1, 2, 3, a, b, d)
|
||||
//
|
||||
// get_answer() is defined in (2, 3, a, b, c)
|
||||
// get_answer2() is defined in (b, d)
|
||||
void* sym = dlsym(RTLD_DEFAULT, "dlopen_test_get_answer");
|
||||
ASSERT_TRUE(sym == nullptr);
|
||||
void* handle = dlopen("libtest_check_order.so", RTLD_NOW);
|
||||
ASSERT_TRUE(handle != nullptr);
|
||||
typedef int (*fn_t) (void);
|
||||
fn_t fn, fn2;
|
||||
fn = reinterpret_cast<fn_t>(dlsym(RTLD_DEFAULT, "dlopen_test_get_answer"));
|
||||
ASSERT_TRUE(fn != NULL);
|
||||
fn2 = reinterpret_cast<fn_t>(dlsym(RTLD_DEFAULT, "dlopen_test_get_answer2"));
|
||||
ASSERT_TRUE(fn2 != NULL);
|
||||
|
||||
ASSERT_EQ(42, fn());
|
||||
ASSERT_EQ(43, fn2());
|
||||
dlclose(handle);
|
||||
}
|
||||
|
||||
// libtest_with_dependency_loop.so -> libtest_with_dependency_loop_a.so ->
|
||||
// libtest_with_dependency_loop_b.so -> libtest_with_dependency_loop_c.so ->
|
||||
// libtest_with_dependency_loop_a.so
|
||||
TEST(dlfcn, dlopen_check_loop) {
|
||||
void* handle = dlopen("libtest_with_dependency_loop.so", RTLD_NOW);
|
||||
ASSERT_TRUE(handle == NULL);
|
||||
ASSERT_STREQ("dlopen failed: recursive link to \"libtest_with_dependency_loop_a.so\"", dlerror());
|
||||
}
|
||||
|
||||
TEST(dlfcn, dlopen_failure) {
|
||||
void* self = dlopen("/does/not/exist", RTLD_NOW);
|
||||
ASSERT_TRUE(self == NULL);
|
||||
|
||||
Reference in New Issue
Block a user