Fix symbol lookup order during relocation

  Relocate symbol against DF_1_GLOBAL shared libraries
  loaded before this shared library. This includes
  main executable, ld_preloads and other libraries
  that have DF_1_GLOBAL flag set.

Bug: 2643900
Bug: 15432753
Change-Id: Ia788748be59b739d1c7e62b978e7e255f9e65c7b
diff --git a/tests/Android.mk b/tests/Android.mk
index c0345e4..3647cd0 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -233,6 +233,7 @@
 
 bionic-unit-tests_src_files := \
     atexit_test.cpp \
+    dl_test.cpp \
     dlext_test.cpp \
     dlfcn_test.cpp \
 
@@ -245,8 +246,7 @@
 bionic-unit-tests_cppflags := $(test_cppflags)
 
 bionic-unit-tests_ldflags := \
-    -Wl,--export-dynamic \
-    -Wl,-u,DlSymTestFunction \
+    -Wl,--export-dynamic
 
 bionic-unit-tests_c_includes := \
     bionic/libc \
@@ -255,6 +255,9 @@
 bionic-unit-tests_shared_libraries_target := \
     libdl \
     libpagemap \
+    libdl_preempt_test_1 \
+    libdl_preempt_test_2 \
+    libdl_test_df_1_global
 
 module := bionic-unit-tests
 module_tag := optional
@@ -302,6 +305,12 @@
 bionic-unit-tests-glibc_src_files := \
     atexit_test.cpp \
     dlfcn_test.cpp \
+    dl_test.cpp \
+
+bionic-unit-tests-glibc_shared_libraries := \
+    libdl_preempt_test_1 \
+    libdl_preempt_test_2 \
+    libdl_test_df_1_global
 
 bionic-unit-tests-glibc_whole_static_libraries := \
     libBionicStandardTests \