Fix dlsym() to take into account RTLD_GLOBAL/LOCAL
Symbols from libraries opened with RTLD_LOCAL (default)
should not be visible via dlsym(RLTD_DEFAULT/RTLD_NEXT, .)
Bug: 17512583
Bug: 18186310
(cherry picked from commit e8ba50fe0d51fbefee1a8f5bb62bf51d841512c8)
Change-Id: Idf6bbe2233fb2bfc0c88677e7d1fc518fb3f7a8b
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 3631d2f..59f673a 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -232,7 +232,7 @@
static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
#endif
-static soinfo __libdl_info("libdl.so", nullptr, 0);
+static soinfo __libdl_info("libdl.so", nullptr, 0, RTLD_GLOBAL);
// This is used by the dynamic linker. Every process gets these symbols for free.
soinfo* get_libdl_info() {