Add RTLD_NOLOAD support and some related changes.

* Aligned RTLD_ values with glibc for lp64
 * dlopen supports RTLD_NOLOAD flag
 * soinfo_unload calls find_library(.., RTLD_NOLOAD)
   instead of naive find_loaded_library_by_name()
 * dlopen changed to add child to caller soinfo instead
   of somain.

Bug: https://code.google.com/p/android/issues/detail?id=64069
Change-Id: I1a65f2c34f3e0edc6d2c41a2e408b58195feb640
This commit is contained in:
Dmitriy Ivanov
2014-05-19 15:06:58 -07:00
parent 0b9a72ce11
commit b648a8a57e
7 changed files with 120 additions and 32 deletions

View File

@@ -50,6 +50,18 @@ TEST(dlfcn, dlsym_in_self) {
ASSERT_EQ(0, dlclose(self));
}
TEST(dlfcn, dlopen_noload) {
void* handle = dlopen("libtest_simple.so", RTLD_NOW | RTLD_NOLOAD);
ASSERT_TRUE(handle == NULL);
handle = dlopen("libtest_simple.so", RTLD_NOW);
void* handle2 = dlopen("libtest_simple.so", RTLD_NOW | RTLD_NOLOAD);
ASSERT_TRUE(handle != NULL);
ASSERT_TRUE(handle2 != NULL);
ASSERT_TRUE(handle == handle2);
ASSERT_EQ(0, dlclose(handle));
ASSERT_EQ(0, dlclose(handle2));
}
TEST(dlfcn, dlopen_failure) {
void* self = dlopen("/does/not/exist", RTLD_NOW);
ASSERT_TRUE(self == NULL);