diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2014-08-04 23:39:22 +0000 |
---|---|---|
committer | Dmitriy Ivanov <dimitry@google.com> | 2014-08-04 23:39:22 +0000 |
commit | db7a17d4ff56a05af01ee2fee1f3c55245bfc630 (patch) | |
tree | 53d49b24ccef4c4cddb9f37b869cf364bf5ea8ea /tests | |
parent | 1b1966d9448e979d1503a3d8843708bfa8880dc6 (diff) | |
download | bionic-db7a17d4ff56a05af01ee2fee1f3c55245bfc630.zip bionic-db7a17d4ff56a05af01ee2fee1f3c55245bfc630.tar.gz bionic-db7a17d4ff56a05af01ee2fee1f3c55245bfc630.tar.bz2 |
Revert "Revert "Fix dlsym(3) to do breadth first search.""
This reverts commit 1b1966d9448e979d1503a3d8843708bfa8880dc6.
Change-Id: I05d6d3481aaf8f3e260d2e5e950248519a1d347f
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dlfcn_test.cpp | 21 | ||||
-rw-r--r-- | tests/libs/Android.mk | 13 |
2 files changed, 30 insertions, 4 deletions
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp index f056fb6..9bc2557 100644 --- a/tests/dlfcn_test.cpp +++ b/tests/dlfcn_test.cpp @@ -62,10 +62,9 @@ TEST(dlfcn, dlsym_in_self) { ASSERT_EQ(0, dlclose(self)); } -#if !defined(__LP64__) -// Current compiler/static linker used for aarch64 -// platform optimizes LOCAL PROTECTED symbol -// in libtest_local_symbol.so out of existence +#if defined(__arm__) +// This seems to be working only for arm. +// Others platforms optimize LOCAL PROTECTED symbols. TEST(dlfcn, dlsym_local_symbol) { void* handle = dlopen("libtest_local_symbol.so", RTLD_NOW); ASSERT_TRUE(handle != NULL); @@ -78,9 +77,23 @@ TEST(dlfcn, dlsym_local_symbol) { f = reinterpret_cast<uint32_t (*)(void)>(dlsym(handle, "dlsym_local_symbol_get_taxicab_number_using_dlsym")); ASSERT_TRUE(f != NULL); ASSERT_EQ(1729U, f()); + dlclose(handle); } #endif +TEST(dlfcn, dlsym_with_dependencies) { + void* handle = dlopen("libtest_with_dependency.so", RTLD_NOW); + ASSERT_TRUE(handle != NULL); + dlerror(); + // This symbol is in DT_NEEDED library. + void* sym = dlsym(handle, "getRandomNumber"); + ASSERT_TRUE(sym != NULL); + int (*fn)(void); + fn = reinterpret_cast<int (*)(void)>(sym); + EXPECT_EQ(4, fn()); + dlclose(handle); +} + TEST(dlfcn, dlopen_noload) { void* handle = dlopen("libtest_simple.so", RTLD_NOW | RTLD_NOLOAD); ASSERT_TRUE(handle == NULL); diff --git a/tests/libs/Android.mk b/tests/libs/Android.mk index a374e48..7ed3e7b 100644 --- a/tests/libs/Android.mk +++ b/tests/libs/Android.mk @@ -102,6 +102,19 @@ build_target := SHARED_LIBRARY include $(TEST_PATH)/Android.build.mk # ----------------------------------------------------------------------------- +# Library with dependency used by dlfcn tests +# ----------------------------------------------------------------------------- +libtest_with_dependency_src_files := \ + dlopen_testlib_simple.cpp + +libtest_with_dependency_shared_libraries := libdlext_test + +module := libtest_with_dependency +build_type := target +build_target := SHARED_LIBRARY +include $(TEST_PATH)/Android.build.mk + +# ----------------------------------------------------------------------------- # Library used to test local symbol lookup # ----------------------------------------------------------------------------- libtest_local_symbol_src_files := \ |