Fix linker crashes during unknown symbol lookup
Integration of kernel VDSO into internal bionic data structures using
common functions.
Fix for dl_iterate_phdr function: the function provides incorrect
address of object in case of nonzero virtual and base addresses.
Location in address space of a particular program header should be
calculated using the formula: addr = base_addr + virtual_addr.
Signed-off-by: Sergey Melnikov <sergey.melnikov@intel.com>
Change-Id: Ie2ab4257fd456242aab8afed0bd5bd6b29e81d6d
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 938b8a5..6ba8e66 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -222,3 +222,15 @@
ASSERT_TRUE(handle != NULL);
ASSERT_SUBSTR(NULL, dlerror());
}
+
+TEST(dlfcn, rtld_default_unknown_symbol) {
+ void* self = RTLD_DEFAULT;
+ void* addr = dlsym(self, "ANY_UNKNOWN_SYMBOL_NAME");
+ ASSERT_TRUE(addr == NULL);
+}
+
+TEST(dlfcn, rtld_default_known_symbol) {
+ void* self = RTLD_DEFAULT;
+ void* addr = dlsym(self, "fopen");
+ ASSERT_TRUE(addr != NULL);
+}