Sync linker with internal branch

This change includes dlwarning implementation and
the compatibility greylist for apps targeting pre-N.

Change-Id: Ibf02a07cc58cbbb1a5aef4ac34558c5d43e4305f
Test: Run bionic-unit-tests --gtest_filter=dl*:Dl*
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index 110846d..c03ffa8 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -15,6 +15,7 @@
  */
 
 #include "linker.h"
+#include "linker_dlwarning.h"
 
 #include <pthread.h>
 #include <stdio.h>
@@ -138,6 +139,11 @@
   return get_application_target_sdk_version();
 }
 
+void android_dlwarning(void* obj, void (*f)(void*, const char*)) {
+  ScopedPthreadMutexLocker locker(&g_dl_mutex);
+  get_dlwarning(obj, f);
+}
+
 bool android_init_namespaces(const char* public_ns_sonames,
                              const char* anon_ns_library_path) {
   ScopedPthreadMutexLocker locker(&g_dl_mutex);
@@ -199,11 +205,11 @@
   // 00000000001 1111111112222222222 3333333333444444444455555555556666666666777 777777788888888889999999999
   // 01234567890 1234567890123456789 0123456789012345678901234567890123456789012 345678901234567890123456789
     "erate_phdr\0android_dlopen_ext\0android_set_application_target_sdk_version\0android_get_application_tar"
-  // 0000000000111111 111122222222223333333333 4444444444555555555566666 6666677
-  // 0123456789012345 678901234567890123456789 0123456789012345678901234 5678901
-    "get_sdk_version\0android_init_namespaces\0android_create_namespace\0dlvsym\0"
+  // 0000000000111111 111122222222223333333333 4444444444555555555566666 6666677 777777778888888888
+  // 0123456789012345 678901234567890123456789 0123456789012345678901234 5678901 234567890123456789
+    "get_sdk_version\0android_init_namespaces\0android_create_namespace\0dlvsym\0android_dlwarning\0"
 #if defined(__arm__)
-  // 272
+  // 290
     "dl_unwind_find_exidx\0"
 #endif
     ;
@@ -228,8 +234,9 @@
   ELFW(SYM_INITIALIZER)(216, &android_init_namespaces, 1),
   ELFW(SYM_INITIALIZER)(240, &android_create_namespace, 1),
   ELFW(SYM_INITIALIZER)(265, &dlvsym, 1),
+  ELFW(SYM_INITIALIZER)(272, &android_dlwarning, 1),
 #if defined(__arm__)
-  ELFW(SYM_INITIALIZER)(272, &dl_unwind_find_exidx, 1),
+  ELFW(SYM_INITIALIZER)(290, &dl_unwind_find_exidx, 1),
 #endif
 };
 
@@ -246,9 +253,9 @@
 // Note that adding any new symbols here requires stubbing them out in libdl.
 static unsigned g_libdl_buckets[1] = { 1 };
 #if defined(__arm__)
-static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 };
+static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0 };
 #else
-static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0 };
+static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 };
 #endif
 
 static uint8_t __libdl_info_buf[sizeof(soinfo)] __attribute__((aligned(8)));