Merge "Fix mmap leak in MmapFile"
diff --git a/linker/Android.bp b/linker/Android.bp
index b6fcf49..2fcf369 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -209,12 +209,6 @@
         android: {
             static_libs: ["libdebuggerd_handler_fallback"],
         },
-        android64: {
-            cflags: ["-DTARGET_IS_64_BIT"],
-        },
-        linux_bionic: {
-            cflags: ["-DTARGET_IS_64_BIT"],
-        },
     },
     compile_multilib: "both",
 
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 3f898ba..ff2a7e6 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -863,11 +863,8 @@
     }
   }
 
-  // If not found - use dlsym_handle_lookup for caller's
-  // local_group unless it is part of the global group in which
-  // case we already did it.
-  if (s == nullptr && caller != nullptr &&
-      (caller->get_rtld_flags() & RTLD_GLOBAL) == 0) {
+  // If not found - use dlsym_handle_lookup for caller's local_group
+  if (s == nullptr && caller != nullptr) {
     soinfo* local_group_root = caller->get_local_group_root();
 
     return dlsym_handle_lookup(local_group_root->get_primary_namespace(),
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 000d1f7..c40a35b 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -256,7 +256,12 @@
     return;
   }
 #endif
-  void* handle = dlopen("linux-vdso.so.1", RTLD_NOW);
+
+  const char* vdso_name = "linux-vdso.so.1";
+#if defined(__i386__)
+  vdso_name = "linux-gate.so.1";
+#endif
+  void* handle = dlopen(vdso_name, RTLD_NOW);
   ASSERT_TRUE(handle != nullptr) << dlerror();
   dlclose(handle);
 }
@@ -1118,7 +1123,7 @@
 
 // Check that RTLD_NEXT of a libc symbol works in dlopened library
 TEST(dlfcn, rtld_next_from_library) {
-  void* library_with_fclose = dlopen("libtest_check_rtld_next_from_library.so", RTLD_NOW);
+  void* library_with_fclose = dlopen("libtest_check_rtld_next_from_library.so", RTLD_NOW | RTLD_GLOBAL);
   ASSERT_TRUE(library_with_fclose != nullptr) << dlerror();
   void* expected_addr = dlsym(RTLD_DEFAULT, "fclose");
   ASSERT_TRUE(expected_addr != nullptr) << dlerror();