Merge changes I9b662ca9,Iad7f3fc9,I1b16a4b5,I47b07755,I6496a8c4, ...

* changes:
  versioner: add support for preprocessing headers.
  versioner: fix makefiles.
  versioner: purge iostreams.
  versioner: assorted fixes.
  versioner: replace availability attributes with annotate.
  versioner: improve the test script.
diff --git a/libc/Android.bp b/libc/Android.bp
index 0a76e87..c706935 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -17,8 +17,6 @@
     "bionic/system_properties_compat.c",
     "stdio/fread.c",
     "stdio/refill.c",
-    "stdio/snprintf.c",
-    "stdio/sprintf.c",
     "stdio/stdio.cpp",
     "stdio/stdio_ext.cpp",
     "stdlib/atexit.c",
@@ -36,36 +34,26 @@
     "bionic/time64.c",
 ]
 
+libc_common_flags = [
+    "-D_LIBC=1",
+    "-Wall",
+    "-Wextra",
+    "-Wunused",
+    "-Wno-deprecated-declarations",
+
+    // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
+    "-Werror=pointer-to-int-cast",
+    "-Werror=int-to-pointer-cast",
+    "-Werror=type-limits",
+    "-Werror",
+]
+
 // Define some common cflags
 // ========================================================
 cc_defaults {
     name: "libc_defaults",
-    cflags: [
-        "-D_LIBC=1",
-        "-Wall",
-        "-Wextra",
-        "-Wunused",
-        "-Wno-deprecated-declarations",
-
-        // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
-        "-Werror=pointer-to-int-cast",
-        "-Werror=int-to-pointer-cast",
-        "-Werror=type-limits",
-        "-Werror",
-    ],
-    // TODO: split out the asflags.
-    asflags: [
-        "-D_LIBC=1",
-        "-Wall",
-        "-Wextra",
-        "-Wunused",
-
-        // Try to catch typical 32-bit assumptions that break with 64-bit pointers.
-        "-Werror=pointer-to-int-cast",
-        "-Werror=int-to-pointer-cast",
-        "-Werror=type-limits",
-        "-Werror",
-    ],
+    cflags: libc_common_flags,
+    asflags: libc_common_flags,
     conlyflags: ["-std=gnu99"],
     cppflags: [],
     include_dirs: ["external/jemalloc/include"],
@@ -416,7 +404,6 @@
         "upstream-openbsd/lib/libc/net/ntohl.c",
         "upstream-openbsd/lib/libc/net/ntohs.c",
         "upstream-openbsd/lib/libc/net/res_random.c",
-        "upstream-openbsd/lib/libc/stdio/asprintf.c",
         "upstream-openbsd/lib/libc/stdio/fflush.c",
         "upstream-openbsd/lib/libc/stdio/fgetln.c",
         "upstream-openbsd/lib/libc/stdio/fgets.c",
@@ -442,7 +429,6 @@
         "upstream-openbsd/lib/libc/stdio/puts.c",
         "upstream-openbsd/lib/libc/stdio/rget.c",
         "upstream-openbsd/lib/libc/stdio/setvbuf.c",
-        "upstream-openbsd/lib/libc/stdio/sscanf.c",
         "upstream-openbsd/lib/libc/stdio/tempnam.c",
         "upstream-openbsd/lib/libc/stdio/tmpnam.c",
         "upstream-openbsd/lib/libc/stdio/ungetc.c",
@@ -453,8 +439,6 @@
         "upstream-openbsd/lib/libc/stdio/vfscanf.c",
         "upstream-openbsd/lib/libc/stdio/vfwprintf.c",
         "upstream-openbsd/lib/libc/stdio/vfwscanf.c",
-        "upstream-openbsd/lib/libc/stdio/vsnprintf.c",
-        "upstream-openbsd/lib/libc/stdio/vsprintf.c",
         "upstream-openbsd/lib/libc/stdio/vsscanf.c",
         "upstream-openbsd/lib/libc/stdio/vswprintf.c",
         "upstream-openbsd/lib/libc/stdio/vswscanf.c",
@@ -542,12 +526,6 @@
         "upstream-openbsd/lib/libc/string/strncmp.c",
         "upstream-openbsd/lib/libc/string/strncpy.c",
     ],
-    multilib: {
-        lib32: {
-            // LP32 cruft
-            srcs: ["upstream-openbsd/lib/libc/stdio/putw.c"],
-        },
-    },
 
     arch: {
         arm: {
@@ -1651,11 +1629,6 @@
 
             // Don't re-export new/delete and friends, even if the compiler really wants to.
             version_script: "libc.arm.map",
-            product_variables: {
-                brillo: {
-                    version_script: "libc.arm.brillo.map",
-                },
-            },
 
             shared: {
                 srcs: [
@@ -1678,11 +1651,6 @@
         mips: {
             // Don't re-export new/delete and friends, even if the compiler really wants to.
             version_script: "libc.mips.map",
-            product_variables: {
-                brillo: {
-                    version_script: "libc.mips.brillo.map",
-                },
-            },
         },
         mips64: {
             // Don't re-export new/delete and friends, even if the compiler really wants to.
@@ -1694,11 +1662,6 @@
 
             // Don't re-export new/delete and friends, even if the compiler really wants to.
             version_script: "libc.x86.map",
-            product_variables: {
-                brillo: {
-                    version_script: "libc.x86.brillo.map",
-                },
-            },
         },
         x86_64: {
             // Don't re-export new/delete and friends, even if the compiler really wants to.
diff --git a/libc/NOTICE b/libc/NOTICE
index 5e0d7b2..735b6c4 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -1457,23 +1457,6 @@
 Copyright (c) 1989 The Regents of the University of California.
 All rights reserved.
 
-Redistribution and use in source and binary forms are permitted
-provided that the above copyright notice and this paragraph are
-duplicated in all such forms and that any documentation,
-advertising materials, and other materials related to such
-distribution and use acknowledge that the software was developed
-by the University of California, Berkeley. The name of the
-University may not be used to endorse or promote products derived
-from this software without specific prior written permission.
-THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
--------------------------------------------------------------------
-
-Copyright (c) 1989 The Regents of the University of California.
-All rights reserved.
-
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:
@@ -4815,6 +4798,34 @@
 
 -------------------------------------------------------------------
 
+Copyright 1989 The Regents of the University of California.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+   3. Neither the name of the University nor the names of its contributors
+      may be used to endorse or promote products derived from this software
+      without specific prior written permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
+   ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+   ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+   OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+   OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+
+-------------------------------------------------------------------
+
 Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
 Copyright 2008 Damien Miller <djm@openbsd.org>
 All rights reserved.
diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp
index 11abeb1..cf50664 100644
--- a/libc/bionic/fortify.cpp
+++ b/libc/bionic/fortify.cpp
@@ -217,8 +217,7 @@
 }
 
 ssize_t __recvfrom_chk(int socket, void* buf, size_t len, size_t buf_size,
-                       int flags, const sockaddr* src_addr,
-                       socklen_t* addrlen) {
+                       int flags, sockaddr* src_addr, socklen_t* addrlen) {
   __check_buffer_access("recvfrom", "write into", len, buf_size);
   return recvfrom(socket, buf, len, flags, src_addr, addrlen);
 }
@@ -424,7 +423,12 @@
 // Runtime implementation of __builtin____vsprintf_chk (used directly by compiler, not in headers).
 extern "C" int __vsprintf_chk(char* dst, int /*flags*/,
                               size_t dst_len_from_compiler, const char* format, va_list va) {
-  int result = vsnprintf(dst, dst_len_from_compiler, format, va);
+  // The compiler uses SIZE_MAX to mean "no idea", but our vsnprintf rejects sizes that large.
+  int result = vsnprintf(dst,
+                         dst_len_from_compiler == SIZE_MAX ? SSIZE_MAX : dst_len_from_compiler,
+                         format, va);
+
+  // Try to catch failures after the fact...
   __check_buffer_access("vsprintf", "write into", result + 1, dst_len_from_compiler);
   return result;
 }
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 1c6c845..c042f9f 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -50,8 +50,8 @@
 
 extern "C" {
 
-// Brillo and LP64 don't need to support any legacy cruft.
-#if !defined(__BRILLO__) && !defined(__LP64__)
+// LP64 doesn't need to support any legacy cruft.
+#if !defined(__LP64__)
 
 // These were accidentally declared in <unistd.h> because we stupidly used to inline
 // getpagesize() and __getpageshift(). Needed for backwards compatibility with old NDK apps.
@@ -375,6 +375,11 @@
     return 0;
 }
 
-#endif // !defined(__BRILLO__) && !defined (__LP64__)
+// LP32's <stdio.h> had putw (but not getw).
+int putw(int value, FILE* fp) {
+    return fwrite(&value, sizeof(value), 1, fp) == 1 ? 0 : EOF;
+}
+
+#endif // !defined (__LP64__)
 
 } // extern "C"
diff --git a/libc/bionic/netinet_in.cpp b/libc/bionic/netinet_in.cpp
index dfa5d8d..2a7090a 100644
--- a/libc/bionic/netinet_in.cpp
+++ b/libc/bionic/netinet_in.cpp
@@ -29,6 +29,7 @@
 #include <netinet/in.h>
 
 #include <errno.h>
+#include <netdb.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <string.h>
diff --git a/libc/bionic/pthread_barrier.cpp b/libc/bionic/pthread_barrier.cpp
index 1bcd12a..1618222 100644
--- a/libc/bionic/pthread_barrier.cpp
+++ b/libc/bionic/pthread_barrier.cpp
@@ -42,7 +42,7 @@
   return 0;
 }
 
-int pthread_barrierattr_getpshared(pthread_barrierattr_t* attr, int* pshared) {
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t* attr, int* pshared) {
   *pshared = (*attr & 1) ? PTHREAD_PROCESS_SHARED : PTHREAD_PROCESS_PRIVATE;
   return 0;
 }
diff --git a/libc/bionic/sysconf.cpp b/libc/bionic/sysconf.cpp
index 7be0ab7..4a23fec 100644
--- a/libc/bionic/sysconf.cpp
+++ b/libc/bionic/sysconf.cpp
@@ -29,10 +29,10 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
-#include <linux/uio.h>  // For UIO_MAXIOV.
 #include <pthread.h>
 #include <stdio.h>  // For FOPEN_MAX.
 #include <sys/auxv.h>
+#include <sys/param.h>
 #include <sys/resource.h>
 #include <sys/sysinfo.h>
 #include <time.h>
@@ -48,18 +48,39 @@
 
 long sysconf(int name) {
   switch (name) {
-    case _SC_ARG_MAX:           return ARG_MAX;
+    //
+    // Things we actually have to calculate...
+    //
+    case _SC_ARG_MAX:
+      // Not a constant since Linux 2.6.23; see fs/exec.c for details.
+      // At least 32 pages, otherwise a quarter of the stack limit.
+      return MAX(__sysconf_rlimit(RLIMIT_STACK) / 4, _KERNEL_ARG_MAX);
+
+    case _SC_AVPHYS_PAGES:      return get_avphys_pages();
+    case _SC_CHILD_MAX:         return __sysconf_rlimit(RLIMIT_NPROC);
+    case _SC_CLK_TCK:           return static_cast<long>(getauxval(AT_CLKTCK));
+    case _SC_NPROCESSORS_CONF:  return get_nprocs_conf();
+    case _SC_NPROCESSORS_ONLN:  return get_nprocs();
+    case _SC_OPEN_MAX:          return __sysconf_rlimit(RLIMIT_NOFILE);
+
+    case _SC_PAGESIZE:
+    case _SC_PAGE_SIZE:
+      // _SC_PAGESIZE and _SC_PAGE_SIZE are distinct, but return the same value.
+      return static_cast<long>(getauxval(AT_PAGESZ));
+
+    case _SC_PHYS_PAGES:        return get_phys_pages();
+
+    //
+    // Constants...
+    //
     case _SC_BC_BASE_MAX:       return _POSIX2_BC_BASE_MAX;   // Minimum requirement.
     case _SC_BC_DIM_MAX:        return _POSIX2_BC_DIM_MAX;    // Minimum requirement.
     case _SC_BC_SCALE_MAX:      return _POSIX2_BC_SCALE_MAX;  // Minimum requirement.
     case _SC_BC_STRING_MAX:     return _POSIX2_BC_STRING_MAX; // Minimum requirement.
-    case _SC_CHILD_MAX:         return __sysconf_rlimit(RLIMIT_NPROC);
-    case _SC_CLK_TCK:           return static_cast<long>(getauxval(AT_CLKTCK));
     case _SC_COLL_WEIGHTS_MAX:  return _POSIX2_COLL_WEIGHTS_MAX;  // Minimum requirement.
     case _SC_EXPR_NEST_MAX:     return _POSIX2_EXPR_NEST_MAX;     // Minimum requirement.
     case _SC_LINE_MAX:          return _POSIX2_LINE_MAX;          // Minimum requirement.
     case _SC_NGROUPS_MAX:       return NGROUPS_MAX;
-    case _SC_OPEN_MAX:          return __sysconf_rlimit(RLIMIT_NOFILE);
     case _SC_PASS_MAX:          return PASS_MAX;
     case _SC_2_C_BIND:          return _POSIX2_C_BIND;
     case _SC_2_C_DEV:           return _POSIX2_C_DEV;
@@ -84,12 +105,7 @@
     case _SC_XOPEN_REALTIME_THREADS: return _XOPEN_REALTIME_THREADS;
     case _SC_XOPEN_LEGACY:      return _XOPEN_LEGACY;
     case _SC_ATEXIT_MAX:        return LONG_MAX;    // Unlimited.
-    case _SC_IOV_MAX:           return UIO_MAXIOV;
-
-    // _SC_PAGESIZE and _SC_PAGE_SIZE are distinct, but return the same value.
-    case _SC_PAGESIZE:
-    case _SC_PAGE_SIZE:
-      return static_cast<long>(getauxval(AT_PAGESZ));
+    case _SC_IOV_MAX:           return IOV_MAX;
 
     case _SC_XOPEN_UNIX:        return _XOPEN_UNIX;
     case _SC_AIO_LISTIO_MAX:    return _POSIX_AIO_LISTIO_MAX;     // Minimum requirement.
@@ -132,10 +148,6 @@
     case _SC_THREAD_PRIO_INHERIT: return _POSIX_THREAD_PRIO_INHERIT;
     case _SC_THREAD_PRIO_PROTECT: return _POSIX_THREAD_PRIO_PROTECT;
     case _SC_THREAD_SAFE_FUNCTIONS:  return _POSIX_THREAD_SAFE_FUNCTIONS;
-    case _SC_NPROCESSORS_CONF:  return get_nprocs_conf();
-    case _SC_NPROCESSORS_ONLN:  return get_nprocs();
-    case _SC_PHYS_PAGES:        return get_phys_pages();
-    case _SC_AVPHYS_PAGES:      return get_avphys_pages();
     case _SC_MONOTONIC_CLOCK:   return _POSIX_VERSION;
 
     case _SC_2_PBS:             return -1;     // Obsolescent in POSIX.1-2008.
diff --git a/libc/bionic/sysinfo.cpp b/libc/bionic/sysinfo.cpp
index 1cb5c79..304634a 100644
--- a/libc/bionic/sysinfo.cpp
+++ b/libc/bionic/sysinfo.cpp
@@ -76,29 +76,14 @@
   return cpu_count;
 }
 
-static int __get_meminfo_page_count(const char* pattern) {
-  FILE* fp = fopen("/proc/meminfo", "re");
-  if (fp == NULL) {
-    return -1;
-  }
-
-  int page_count = -1;
-  char buf[256];
-  while (fgets(buf, sizeof(buf), fp) != NULL) {
-    long total;
-    if (sscanf(buf, pattern, &total) == 1) {
-      page_count = static_cast<int>(total / (sysconf(_SC_PAGE_SIZE) / 1024));
-      break;
-    }
-  }
-  fclose(fp);
-  return page_count;
-}
-
 long get_phys_pages() {
-  return __get_meminfo_page_count("MemTotal: %ld kB");
+  struct sysinfo si;
+  sysinfo(&si);
+  return (si.totalram * si.mem_unit) / sysconf(_SC_PAGE_SIZE);
 }
 
 long get_avphys_pages() {
-  return __get_meminfo_page_count("MemFree: %ld kB");
+  struct sysinfo si;
+  sysinfo(&si);
+  return ((si.freeram + si.bufferram) * si.mem_unit) / sysconf(_SC_PAGE_SIZE);
 }
diff --git a/libc/include/bits/pthread_types.h b/libc/include/bits/pthread_types.h
index 194a49b..7fc379b 100644
--- a/libc/include/bits/pthread_types.h
+++ b/libc/include/bits/pthread_types.h
@@ -32,8 +32,6 @@
 #include <sys/cdefs.h>
 #include <sys/types.h>
 
-typedef long pthread_t;
-
 typedef struct {
   uint32_t flags;
   void* stack_base;
@@ -46,4 +44,58 @@
 #endif
 } pthread_attr_t;
 
+typedef struct {
+#if defined(__LP64__)
+  int64_t __private[4];
+#else
+  int32_t __private[8];
+#endif
+} pthread_barrier_t;
+
+typedef int pthread_barrierattr_t;
+
+typedef struct {
+#if defined(__LP64__)
+  int32_t __private[12];
+#else
+  int32_t __private[1];
+#endif
+} pthread_cond_t;
+
+typedef long pthread_condattr_t;
+
+typedef int pthread_key_t;
+
+typedef struct {
+#if defined(__LP64__)
+  int32_t __private[10];
+#else
+  int32_t __private[1];
+#endif
+} pthread_mutex_t;
+
+typedef long pthread_mutexattr_t;
+
+typedef int pthread_once_t;
+
+typedef struct {
+#if defined(__LP64__)
+  int32_t __private[14];
+#else
+  int32_t __private[10];
+#endif
+} pthread_rwlock_t;
+
+typedef long pthread_rwlockattr_t;
+
+typedef struct {
+#if defined(__LP64__)
+  int64_t __private;
+#else
+  int32_t __private[2];
+#endif
+} pthread_spinlock_t;
+
+typedef long pthread_t;
+
 #endif
diff --git a/libc/include/bits/seek_constants.h b/libc/include/bits/seek_constants.h
new file mode 100644
index 0000000..34c5866
--- /dev/null
+++ b/libc/include/bits/seek_constants.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _BITS_SEEK_CONSTANTS_H_
+#define _BITS_SEEK_CONSTANTS_H_
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+
+#endif
diff --git a/libc/include/cpio.h b/libc/include/cpio.h
new file mode 100644
index 0000000..ceeeb87
--- /dev/null
+++ b/libc/include/cpio.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _CPIO_H_
+#define _CPIO_H_
+
+#include <sys/cdefs.h>
+
+#define C_IRUSR 0000400
+#define C_IWUSR 0000200
+#define C_IXUSR 0000100
+#define C_IRGRP 0000040
+#define C_IWGRP 0000020
+#define C_IXGRP 0000010
+#define C_IROTH 0000004
+#define C_IWOTH 0000002
+#define C_IXOTH 0000001
+#define C_ISUID 0004000
+#define C_ISGID 0002000
+#define C_ISVTX 0001000
+#define C_ISDIR 0040000
+#define C_ISFIFO 0010000
+#define C_ISREG 0100000
+#define C_ISBLK 0060000
+#define C_ISCHR 0020000
+#define C_ISCTG 0110000
+#define C_ISLNK 0120000
+#define C_ISSOCK 0140000
+
+#define MAGIC "070707"
+
+#endif /* _CPIO_H_ */
diff --git a/libc/include/dlfcn.h b/libc/include/dlfcn.h
index a53f664..9aa4a1f 100644
--- a/libc/include/dlfcn.h
+++ b/libc/include/dlfcn.h
@@ -51,7 +51,7 @@
 
 void* dlopen(const char* filename, int flag);
 int dlclose(void* _Nonnull handle);
-const char* dlerror(void);
+char* dlerror(void);
 void* dlsym(void* handle, const char* _Nonnull symbol);
 void* dlvsym(void* handle, const char* _Nonnull symbol, const char* _Nonnull version) __INTRODUCED_IN(24);
 int dladdr(const void* addr, Dl_info* _Nonnull info);
diff --git a/libc/include/fcntl.h b/libc/include/fcntl.h
index 872a727..c49dbd0 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -37,6 +37,7 @@
 #include <linux/uio.h>
 
 #include <bits/fcntl.h>
+#include <bits/seek_constants.h>
 
 #if defined(__USE_GNU) || defined(__USE_BSD)
 #include <bits/lockf.h>
diff --git a/libc/include/locale.h b/libc/include/locale.h
index a8f03bc..a681a17 100644
--- a/libc/include/locale.h
+++ b/libc/include/locale.h
@@ -32,6 +32,9 @@
 #include <sys/cdefs.h>
 #include <xlocale.h>
 
+#define __need_NULL
+#include <stddef.h>
+
 __BEGIN_DECLS
 
 #define LC_CTYPE           0
diff --git a/libc/include/netdb.h b/libc/include/netdb.h
index 7fcb11f..95f0986 100644
--- a/libc/include/netdb.h
+++ b/libc/include/netdb.h
@@ -192,6 +192,8 @@
  */
 #define	SCOPE_DELIMITER	'%'
 
+#define IPPORT_RESERVED 1024
+
 __BEGIN_DECLS
 
 /* BIONIC-BEGIN */
diff --git a/libc/include/netinet/in.h b/libc/include/netinet/in.h
index b524b05..00b5cf9 100644
--- a/libc/include/netinet/in.h
+++ b/libc/include/netinet/in.h
@@ -40,8 +40,6 @@
 
 __BEGIN_DECLS
 
-#define IPPORT_RESERVED  1024
-
 #define INET_ADDRSTRLEN 16
 
 typedef uint16_t in_port_t;
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index 1153695..85b8cd9 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -43,16 +43,6 @@
 #pragma clang diagnostic ignored "-Wnullability-completeness"
 #endif
 
-typedef struct {
-#if defined(__LP64__)
-  int32_t __private[10];
-#else
-  int32_t __private[1];
-#endif
-} pthread_mutex_t;
-
-typedef long pthread_mutexattr_t;
-
 enum {
     PTHREAD_MUTEX_NORMAL = 0,
     PTHREAD_MUTEX_RECURSIVE = 1,
@@ -68,28 +58,8 @@
 #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP { { ((PTHREAD_MUTEX_RECURSIVE & 3) << 14) } }
 #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP { { ((PTHREAD_MUTEX_ERRORCHECK & 3) << 14) } }
 
-typedef struct {
-#if defined(__LP64__)
-  int32_t __private[12];
-#else
-  int32_t __private[1];
-#endif
-} pthread_cond_t;
-
-typedef long pthread_condattr_t;
-
 #define PTHREAD_COND_INITIALIZER  { { 0 } }
 
-typedef struct {
-#if defined(__LP64__)
-  int32_t __private[14];
-#else
-  int32_t __private[10];
-#endif
-} pthread_rwlock_t;
-
-typedef long pthread_rwlockattr_t;
-
 #define PTHREAD_RWLOCK_INITIALIZER  { { 0 } }
 
 enum {
@@ -97,32 +67,10 @@
   PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP = 1,
 };
 
-typedef int pthread_key_t;
-
-typedef int pthread_once_t;
-
 #define PTHREAD_ONCE_INIT 0
 
-typedef struct {
-#if defined(__LP64__)
-  int64_t __private[4];
-#else
-  int32_t __private[8];
-#endif
-} pthread_barrier_t;
-
-typedef int pthread_barrierattr_t;
-
 #define PTHREAD_BARRIER_SERIAL_THREAD -1
 
-typedef struct {
-#if defined(__LP64__)
-  int64_t __private;
-#else
-  int32_t __private[2];
-#endif
-} pthread_spinlock_t;
-
 #if defined(__LP64__)
 #define PTHREAD_STACK_MIN (4 * PAGE_SIZE)
 #else
@@ -232,8 +180,8 @@
 
 int pthread_barrierattr_init(pthread_barrierattr_t* _Nonnull attr) __INTRODUCED_IN(24);
 int pthread_barrierattr_destroy(pthread_barrierattr_t* _Nonnull attr) __INTRODUCED_IN(24);
-int pthread_barrierattr_getpshared(pthread_barrierattr_t* _Nonnull attr, int* _Nonnull pshared)
-  __INTRODUCED_IN(24);
+int pthread_barrierattr_getpshared(const pthread_barrierattr_t* _Nonnull attr,
+                                   int* _Nonnull pshared) __INTRODUCED_IN(24);
 int pthread_barrierattr_setpshared(pthread_barrierattr_t* _Nonnull attr, int pshared)
   __INTRODUCED_IN(24);
 
diff --git a/libc/include/semaphore.h b/libc/include/semaphore.h
index 4ef13af..218f22a 100644
--- a/libc/include/semaphore.h
+++ b/libc/include/semaphore.h
@@ -42,7 +42,7 @@
 #endif
 } sem_t;
 
-#define SEM_FAILED NULL
+#define SEM_FAILED __BIONIC_CAST(reinterpret_cast, sem_t*, 0)
 
 int sem_destroy(sem_t*);
 int sem_getvalue(sem_t*, int*);
diff --git a/libc/include/stdio.h b/libc/include/stdio.h
index 1bbd669..38021ef 100644
--- a/libc/include/stdio.h
+++ b/libc/include/stdio.h
@@ -47,6 +47,8 @@
 #define __need_NULL
 #include <stddef.h>
 
+#include <bits/seek_constants.h>
+
 __BEGIN_DECLS
 
 #if defined(__clang__)
@@ -106,10 +108,6 @@
 #define	L_tmpnam	1024	/* XXX must be == PATH_MAX */
 #define	TMP_MAX		308915776
 
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-
 /*
  * Functions defined in ANSI C standard.
  */
@@ -264,7 +262,7 @@
 __errordecl(__fwrite_too_big_error, "fwrite called with size * count bigger than buffer");
 __errordecl(__fwrite_overflow, "fwrite called with overflowing size * count");
 
-#if defined(__BIONIC_FORTIFY)
+#if defined(__BIONIC_FORTIFY) && !defined(__BIONIC_NO_STDIO_FORTIFY)
 
 #if __ANDROID_API__ >= 17
 __BIONIC_FORTIFY_INLINE
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index 1174e79..13c3269 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -40,7 +40,6 @@
 /*
  * Testing against Clang-specific extensions.
  */
-
 #ifndef __has_extension
 #define __has_extension         __has_feature
 #endif
@@ -57,19 +56,16 @@
 #define __has_attribute(x)      0
 #endif
 
-
 #define __strong_alias(alias, sym) \
     __asm__(".global " #alias "\n" \
             #alias " = " #sym);
 
 #if defined(__cplusplus)
-#define	__BEGIN_DECLS		extern "C" {
-#define	__END_DECLS		}
-#define	__static_cast(x,y)	static_cast<x>(y)
+#define __BEGIN_DECLS extern "C" {
+#define __END_DECLS }
 #else
-#define	__BEGIN_DECLS
-#define	__END_DECLS
-#define	__static_cast(x,y)	(x)y
+#define __BEGIN_DECLS
+#define __END_DECLS
 #endif
 
 #if defined(__cplusplus)
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index 223c3b2..6a275e4 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -291,18 +291,18 @@
 ssize_t recv(int, void*, size_t, int);
 
 __socketcall ssize_t sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t);
-__socketcall ssize_t recvfrom(int, void*, size_t, int, const struct sockaddr*, socklen_t*);
+__socketcall ssize_t recvfrom(int, void*, size_t, int, struct sockaddr*, socklen_t*);
 
 __errordecl(__recvfrom_error, "recvfrom called with size bigger than buffer");
-ssize_t __recvfrom_chk(int, void*, size_t, size_t, int, const struct sockaddr*, socklen_t*)
+ssize_t __recvfrom_chk(int, void*, size_t, size_t, int, struct sockaddr*, socklen_t*)
   __INTRODUCED_IN(21);
-ssize_t __recvfrom_real(int, void*, size_t, int, const struct sockaddr*, socklen_t*) __RENAME(recvfrom);
+ssize_t __recvfrom_real(int, void*, size_t, int, struct sockaddr*, socklen_t*) __RENAME(recvfrom);
 
 #if defined(__BIONIC_FORTIFY)
 
 #if __ANDROID_API__ >= 24
 __BIONIC_FORTIFY_INLINE
-ssize_t recvfrom(int fd, void* buf, size_t len, int flags, const struct sockaddr* src_addr, socklen_t* addr_len) {
+ssize_t recvfrom(int fd, void* buf, size_t len, int flags, struct sockaddr* src_addr, socklen_t* addr_len) {
   size_t bos = __bos0(buf);
 
 #if !defined(__clang__)
diff --git a/libc/include/sys/types.h b/libc/include/sys/types.h
index 2895057..8188f89 100644
--- a/libc/include/sys/types.h
+++ b/libc/include/sys/types.h
@@ -35,6 +35,8 @@
 #include <linux/types.h>
 #include <linux/posix_types.h>
 
+#include <bits/pthread_types.h>
+
 /* gids, uids, and pids are all 32-bit. */
 typedef __kernel_gid32_t __gid_t;
 typedef __gid_t gid_t;
diff --git a/libc/include/tar.h b/libc/include/tar.h
new file mode 100644
index 0000000..a5d7a36
--- /dev/null
+++ b/libc/include/tar.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _TAR_H_
+#define _TAR_H_
+
+#include <sys/cdefs.h>
+
+#define TMAGIC "ustar"
+#define TMAGLEN 6
+#define TVERSION "00"
+#define TVERSLEN 2
+
+#define REGTYPE '0'
+#define AREGTYPE '\0'
+#define LNKTYPE '1'
+#define SYMTYPE '2'
+#define CHRTYPE '3'
+#define BLKTYPE '4'
+#define DIRTYPE '5'
+#define FIFOTYPE '6'
+#define CONTTYPE '7'
+
+#define TSUID 04000
+#define TSGID 02000
+#define TSVTX 01000
+#define TUREAD 00400
+#define TUWRITE 00200
+#define TUEXEC 00100
+#define TGREAD 00040
+#define TGWRITE 00020
+#define TGEXEC 00010
+#define TOREAD 00004
+#define TOWRITE 00002
+#define TOEXEC 00001
+
+#endif /* _TAR_H_ */
diff --git a/libc/include/unistd.h b/libc/include/unistd.h
index c792289..ac7d4c2 100644
--- a/libc/include/unistd.h
+++ b/libc/include/unistd.h
@@ -39,6 +39,7 @@
 #include <bits/ioctl.h>
 #include <bits/lockf.h>
 #include <bits/posix_limits.h>
+#include <bits/seek_constants.h>
 #include <bits/sysconf.h>
 
 __BEGIN_DECLS
@@ -52,10 +53,6 @@
 #define W_OK 2
 #define R_OK 4
 
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-
 #define _PC_FILESIZEBITS 0
 #define _PC_LINK_MAX 1
 #define _PC_MAX_CANON 2
@@ -97,9 +94,10 @@
 int execvp(const char* __file, char* const* __argv);
 int execvpe(const char* __file, char* const* __argv, char* const* __envp) __INTRODUCED_IN(21);
 int execve(const char* __file, char* const* __argv, char* const* __envp);
-int execl(const char* __path, const char* __arg0, ...);
-int execlp(const char* __file, const char* __arg0, ...);
-int execle(const char* __path, const char* __arg0, ...);
+int execl(const char* __path, const char* __arg0, ...) __attribute__((__sentinel__));
+int execlp(const char* __file, const char* __arg0, ...) __attribute__((__sentinel__));
+int execle(const char* __path, const char* __arg0, ... /*,  char* const* __envp */)
+    __attribute__((__sentinel__(1)));
 
 int nice(int __incr);
 
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 773d22f..340af13 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -53,9 +53,10 @@
     "x86": {},
     }
 
-# Replace tokens in the output according to this mapping
+# Replace tokens in the output according to this mapping.
 kernel_token_replacements = {
-    "asm": "__asm__",
+    # The kernel's ARG_MAX is actually the "minimum" maximum (see fs/exec.c).
+    "ARG_MAX": "_KERNEL_ARG_MAX",
     # The kernel usage of __unused for unused struct fields conflicts with the macro defined in <sys/cdefs.h>.
     "__unused": "__linux_unused",
     # The kernel's _NSIG/NSIG are one less than the userspace value, so we need to move them aside.
diff --git a/libc/kernel/uapi/linux/limits.h b/libc/kernel/uapi/linux/limits.h
index 406d175..4441592 100644
--- a/libc/kernel/uapi/linux/limits.h
+++ b/libc/kernel/uapi/linux/limits.h
@@ -21,7 +21,7 @@
 #define NR_OPEN 1024
 #define NGROUPS_MAX 65536
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ARG_MAX 131072
+#define _KERNEL_ARG_MAX 131072
 #define LINK_MAX 127
 #define MAX_CANON 255
 #define MAX_INPUT 255
diff --git a/libc/libc.arm.brillo.map b/libc/libc.arm.brillo.map
deleted file mode 100644
index 4e8212b..0000000
--- a/libc/libc.arm.brillo.map
+++ /dev/null
@@ -1,1491 +0,0 @@
-# Generated by genversion-scripts.py. Do not edit.
-LIBC {
-  global:
-    __assert;
-    __assert2;
-    __atomic_cmpxchg; # arm
-    __atomic_dec; # arm
-    __atomic_inc; # arm
-    __atomic_swap; # arm
-    __b64_ntop;
-    __b64_pton;
-    __cmsg_nxthdr; # introduced=21
-    __connect; # arm x86 mips introduced=21
-    __ctype_get_mb_cur_max; # introduced=21
-    __cxa_atexit;
-    __cxa_finalize;
-    __cxa_thread_atexit_impl; # introduced=23
-    __dn_comp;
-    __dn_count_labels;
-    __dn_skipname;
-    __epoll_pwait; # arm x86 mips introduced=21
-    __errno;
-    __exit; # arm x86 mips introduced=21
-    __fbufsize; # introduced=23
-    __fcntl64; # arm x86 mips
-    __FD_CLR_chk; # introduced=21
-    __FD_ISSET_chk; # introduced=21
-    __FD_SET_chk; # introduced=21
-    __fgets_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __flbf; # introduced=23
-    __fp_nquery;
-    __fp_query;
-    __fpclassify; # introduced=21
-    __fpclassifyd;
-    __fpclassifyf;
-    __fpclassifyl;
-    __fpending; # introduced=23
-    __fpurge; # introduced=23
-    __freadable; # introduced=23
-    __fsetlocking; # introduced=23
-    __fstatfs64; # arm x86 mips
-    __fwritable; # introduced=23
-    __get_h_errno;
-    __getcpu; # arm x86 mips introduced-arm=12 introduced-mips=16 introduced-x86=12
-    __getcwd; # arm x86 mips
-    __getpid; # arm x86 mips introduced=21
-    __getpriority; # arm x86 mips
-    __gnu_basename; # introduced=23
-    __gnu_strerror_r; # introduced=23
-    __hostalias;
-    __ioctl; # arm x86 mips
-    __isfinite;
-    __isfinitef;
-    __isfinitel;
-    __isinf;
-    __isinff;
-    __isinfl;
-    __isnan; # introduced=21
-    __isnanf; # introduced=21
-    __isnanl;
-    __isnormal;
-    __isnormalf;
-    __isnormall;
-    __isthreaded; # arm x86 mips var
-    __libc_current_sigrtmax; # introduced=21
-    __libc_current_sigrtmin; # introduced=21
-    __libc_init;
-    __llseek; # arm x86 mips
-    __loc_aton;
-    __loc_ntoa;
-    __memchr_chk; # introduced=23
-    __memcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __memmove_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __memrchr_chk; # introduced=23
-    __memset_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __mmap2; # arm x86 mips
-    __ns_format_ttl; # arm x86 mips
-    __ns_get16; # arm x86 mips
-    __ns_get32; # arm x86 mips
-    __ns_initparse; # arm x86 mips
-    __ns_makecanon; # arm x86 mips
-    __ns_msg_getflag; # arm x86 mips
-    __ns_name_compress; # arm x86 mips
-    __ns_name_ntol; # arm x86 mips
-    __ns_name_ntop; # arm x86 mips
-    __ns_name_pack; # arm x86 mips
-    __ns_name_pton; # arm x86 mips
-    __ns_name_rollback; # arm x86 mips
-    __ns_name_skip; # arm x86 mips
-    __ns_name_uncompress; # arm x86 mips
-    __ns_name_unpack; # arm x86 mips
-    __ns_parserr; # arm x86 mips
-    __ns_put16; # arm x86 mips
-    __ns_put32; # arm x86 mips
-    __ns_samename; # arm x86 mips
-    __ns_skiprr; # arm x86 mips
-    __ns_sprintrr; # arm x86 mips
-    __ns_sprintrrf; # arm x86 mips
-    __open_2; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __openat; # arm x86 mips
-    __openat_2; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __p_cdname;
-    __p_cdnname;
-    __p_class;
-    __p_class_syms; # var
-    __p_fqname;
-    __p_fqnname;
-    __p_option;
-    __p_query;
-    __p_rcode;
-    __p_secstodate;
-    __p_time;
-    __p_type;
-    __p_type_syms; # var
-    __poll_chk; # introduced=23
-    __ppoll; # arm x86 mips introduced=21
-    __ppoll_chk; # introduced=23
-    __pread64_chk; # introduced=23
-    __pread_chk; # introduced=23
-    __progname; # var
-    __pselect6; # arm x86 mips introduced=21
-    __pthread_cleanup_pop;
-    __pthread_cleanup_push;
-    __ptrace; # arm x86 mips
-    __putlong;
-    __putshort;
-    __read_chk; # introduced=21
-    __readlink_chk; # introduced=23
-    __readlinkat_chk; # introduced=23
-    __reboot; # arm x86 mips
-    __recvfrom_chk; # introduced=21
-    __register_atfork; # introduced=23
-    __res_close;
-    __res_dnok;
-    __res_hnok;
-    __res_hostalias;
-    __res_isourserver;
-    __res_mailok;
-    __res_nameinquery;
-    __res_nclose;
-    __res_ninit;
-    __res_nmkquery;
-    __res_nquery;
-    __res_nquerydomain;
-    __res_nsearch;
-    __res_nsend;
-    __res_ownok;
-    __res_queriesmatch;
-    __res_querydomain;
-    __res_send;
-    __res_send_setqhook;
-    __res_send_setrhook;
-    __rt_sigaction; # arm x86 mips
-    __rt_sigpending; # arm x86 mips introduced=21
-    __rt_sigprocmask; # arm x86 mips
-    __rt_sigsuspend; # arm x86 mips introduced=21
-    __rt_sigtimedwait; # arm x86 mips
-    __sched_cpualloc; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __sched_cpucount; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __sched_cpufree; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __sched_getaffinity; # arm x86 mips introduced=12
-    __set_tid_address; # arm x86 mips introduced=21
-    __set_tls; # arm mips
-    __sF; # var
-    __sigaction; # arm x86 mips introduced=21
-    __snprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __socket; # arm x86 mips introduced=21
-    __sprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __stack_chk_fail;
-    __stack_chk_guard; # var
-    __statfs64; # arm x86 mips
-    __stpcpy_chk; # introduced=21
-    __stpncpy_chk; # introduced=21
-    __stpncpy_chk2; # introduced=21
-    __strcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    __strcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strlcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strlcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strlen_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strncat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strncpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strncpy_chk2; # introduced=21
-    __strrchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    __sym_ntop;
-    __sym_ntos;
-    __sym_ston;
-    __system_properties_init;
-    __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_area__; # var
-    __system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_area_serial; # introduced=23
-    __system_property_find;
-    __system_property_find_nth;
-    __system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_get;
-    __system_property_read;
-    __system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __timer_create; # arm x86 mips
-    __timer_delete; # arm x86 mips
-    __timer_getoverrun; # arm x86 mips
-    __timer_gettime; # arm x86 mips
-    __timer_settime; # arm x86 mips
-    __umask_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    __vsnprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __vsprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __waitid; # arm x86 mips
-    _ctype_; # var
-    _Exit; # introduced=21
-    _exit;
-    _flushlbf; # introduced=23
-    _getlong;
-    _getshort;
-    _longjmp;
-    _resolv_delete_cache_for_net; # introduced=21
-    _resolv_flush_cache_for_net; # introduced=21
-    _resolv_set_nameservers_for_net; # introduced=21
-    _setjmp;
-    _tolower; # introduced=21
-    _tolower_tab_; # arm x86 mips var
-    _toupper; # introduced=21
-    _toupper_tab_; # arm x86 mips var
-    abort;
-    abs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    accept;
-    accept4; # introduced=21
-    access;
-    acct;
-    alarm;
-    alphasort;
-    alphasort64; # introduced=21
-    android_set_abort_message; # introduced=21
-    arc4random;
-    arc4random_buf;
-    arc4random_uniform;
-    asctime;
-    asctime64; # arm x86 mips
-    asctime64_r; # arm x86 mips
-    asctime_r;
-    asprintf;
-    at_quick_exit; # introduced=21
-    atof; # introduced=21
-    atoi;
-    atol;
-    atoll;
-    basename;
-    basename_r; # arm x86 mips
-    bind;
-    bindresvport;
-    brk;
-    bsearch;
-    btowc;
-    c16rtomb; # introduced=21
-    c32rtomb; # introduced=21
-    cacheflush; # arm mips
-    calloc;
-    capget;
-    capset;
-    cfgetispeed; # introduced=21
-    cfgetospeed; # introduced=21
-    cfmakeraw; # introduced=21
-    cfsetispeed; # introduced=21
-    cfsetospeed; # introduced=21
-    cfsetspeed; # introduced=21
-    chdir;
-    chmod;
-    chown;
-    chroot;
-    clearenv;
-    clearerr;
-    clearerr_unlocked; # introduced=23
-    clock;
-    clock_getcpuclockid; # introduced=23
-    clock_getres;
-    clock_gettime;
-    clock_nanosleep;
-    clock_settime;
-    clone; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    close;
-    closedir;
-    closelog;
-    connect;
-    creat;
-    creat64; # introduced=21
-    ctime;
-    ctime64; # arm x86 mips
-    ctime64_r; # arm x86 mips
-    ctime_r;
-    daemon;
-    daylight; # var
-    delete_module;
-    difftime;
-    dirfd;
-    dirname;
-    dirname_r; # arm x86 mips
-    div;
-    dn_expand;
-    dprintf; # introduced=21
-    drand48;
-    dup;
-    dup2;
-    dup3; # introduced=21
-    duplocale; # introduced=21
-    endmntent; # introduced=21
-    endservent;
-    endutent;
-    environ; # var
-    epoll_create;
-    epoll_create1; # introduced=21
-    epoll_ctl;
-    epoll_pwait; # introduced=21
-    epoll_wait;
-    erand48;
-    err;
-    error; # introduced=23
-    error_at_line; # introduced=23
-    error_message_count; # var introduced=23
-    error_one_per_line; # var introduced=23
-    error_print_progname; # var introduced=23
-    errx;
-    ether_aton; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ether_aton_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ether_ntoa; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ether_ntoa_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    eventfd;
-    eventfd_read;
-    eventfd_write;
-    execl;
-    execle;
-    execlp;
-    execv;
-    execve;
-    execvp;
-    execvpe; # introduced=21
-    exit;
-    faccessat; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    fallocate; # introduced=21
-    fallocate64; # introduced=21
-    fchdir;
-    fchmod;
-    fchmodat;
-    fchown;
-    fchownat;
-    fclose;
-    fcntl;
-    fdatasync;
-    fdopen;
-    fdopendir;
-    feof;
-    feof_unlocked; # introduced=23
-    ferror;
-    ferror_unlocked; # introduced=23
-    fflush;
-    ffs; # introduced-arm=9 introduced-arm64=21 introduced-mips=9 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    fgetc;
-    fgetln;
-    fgetpos;
-    fgets;
-    fgetwc;
-    fgetws;
-    fgetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    fileno;
-    flistxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    flock;
-    flockfile;
-    fmemopen; # introduced=23
-    fnmatch;
-    fopen;
-    fork;
-    forkpty; # introduced=23
-    fpathconf;
-    fprintf;
-    fpurge;
-    fputc;
-    fputs;
-    fputwc;
-    fputws;
-    fread;
-    free;
-    freeaddrinfo;
-    freelocale; # introduced=21
-    fremovexattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    freopen;
-    fscanf;
-    fseek;
-    fseeko;
-    fsetpos;
-    fsetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    fstat;
-    fstat64; # introduced=21
-    fstatat;
-    fstatat64; # introduced=21
-    fstatfs;
-    fstatfs64; # introduced=21
-    fstatvfs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    fstatvfs64; # introduced=21
-    fsync;
-    ftell;
-    ftello;
-    ftok;
-    ftruncate;
-    ftruncate64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ftrylockfile;
-    fts_children;
-    fts_close;
-    fts_open;
-    fts_read;
-    fts_set;
-    ftw; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    ftw64; # introduced=21
-    funlockfile;
-    funopen;
-    futimens; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    fwide;
-    fwprintf;
-    fwrite;
-    fwscanf;
-    gai_strerror;
-    get_avphys_pages; # introduced=23
-    get_nprocs; # introduced=23
-    get_nprocs_conf; # introduced=23
-    get_phys_pages; # introduced=23
-    getaddrinfo;
-    getauxval; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    getc;
-    getc_unlocked;
-    getchar;
-    getchar_unlocked;
-    getcwd;
-    getdelim; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    getegid;
-    getenv;
-    geteuid;
-    getgid;
-    getgrgid;
-    getgrnam;
-    getgrouplist;
-    getgroups;
-    gethostbyaddr;
-    gethostbyaddr_r; # introduced=23
-    gethostbyname;
-    gethostbyname2;
-    gethostbyname2_r; # introduced=23
-    gethostbyname_r;
-    gethostent;
-    gethostname;
-    getitimer;
-    getline; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    getlogin;
-    getmntent;
-    getmntent_r; # introduced=21
-    getnameinfo;
-    getnetbyaddr;
-    getnetbyname;
-    getopt;
-    getopt_long;
-    getopt_long_only;
-    getpagesize; # introduced=21
-    getpeername;
-    getpgid;
-    getpgrp;
-    getpid;
-    getppid;
-    getpriority;
-    getprogname; # introduced=21
-    getprotobyname;
-    getprotobynumber;
-    getpt;
-    getpwnam;
-    getpwnam_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    getpwuid;
-    getpwuid_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    getresgid;
-    getresuid;
-    getrlimit;
-    getrlimit64; # introduced=21
-    getrusage;
-    gets;
-    getservbyname;
-    getservbyport;
-    getservent;
-    getsid; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    getsockname;
-    getsockopt;
-    gettid;
-    gettimeofday;
-    getuid;
-    getutent;
-    getwc;
-    getwchar;
-    getxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    gmtime;
-    gmtime64; # arm x86 mips
-    gmtime64_r; # arm x86 mips
-    gmtime_r;
-    grantpt; # introduced=21
-    herror;
-    hstrerror;
-    htonl; # introduced=21
-    htons; # introduced=21
-    if_indextoname;
-    if_nametoindex;
-    imaxabs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    imaxdiv; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    inet_addr;
-    inet_aton;
-    inet_lnaof; # introduced=21
-    inet_makeaddr; # introduced=21
-    inet_netof; # introduced=21
-    inet_network; # introduced=21
-    inet_nsap_addr;
-    inet_nsap_ntoa;
-    inet_ntoa;
-    inet_ntop;
-    inet_pton;
-    init_module;
-    initgroups;
-    initstate; # introduced=21
-    inotify_add_watch;
-    inotify_init;
-    inotify_init1; # introduced=21
-    inotify_rm_watch;
-    insque; # introduced=21
-    ioctl;
-    isalnum;
-    isalnum_l; # introduced=21
-    isalpha;
-    isalpha_l; # introduced=21
-    isascii;
-    isatty;
-    isblank;
-    isblank_l; # introduced=21
-    iscntrl;
-    iscntrl_l; # introduced=21
-    isdigit;
-    isdigit_l; # introduced=21
-    isfinite; # introduced=21
-    isfinitef; # introduced=21
-    isfinitel; # introduced=21
-    isgraph;
-    isgraph_l; # introduced=21
-    isinf; # introduced=21
-    isinff; # introduced=21
-    isinfl; # introduced=21
-    islower;
-    islower_l; # introduced=21
-    isnan;
-    isnanf;
-    isnanl; # introduced=21
-    isnormal; # introduced=21
-    isnormalf; # introduced=21
-    isnormall; # introduced=21
-    isprint;
-    isprint_l; # introduced=21
-    ispunct;
-    ispunct_l; # introduced=21
-    isspace;
-    isspace_l; # introduced=21
-    isupper;
-    isupper_l; # introduced=21
-    iswalnum;
-    iswalnum_l; # introduced=21
-    iswalpha;
-    iswalpha_l; # introduced=21
-    iswblank; # introduced=21
-    iswblank_l; # introduced=21
-    iswcntrl;
-    iswcntrl_l; # introduced=21
-    iswctype;
-    iswctype_l; # introduced=21
-    iswdigit;
-    iswdigit_l; # introduced=21
-    iswgraph;
-    iswgraph_l; # introduced=21
-    iswlower;
-    iswlower_l; # introduced=21
-    iswprint;
-    iswprint_l; # introduced=21
-    iswpunct;
-    iswpunct_l; # introduced=21
-    iswspace;
-    iswspace_l; # introduced=21
-    iswupper;
-    iswupper_l; # introduced=21
-    iswxdigit;
-    iswxdigit_l; # introduced=21
-    isxdigit;
-    isxdigit_l; # introduced=21
-    jrand48;
-    kill;
-    killpg;
-    klogctl;
-    labs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    lchown;
-    lcong48; # introduced=23
-    ldexp;
-    ldiv;
-    lfind; # introduced=21
-    lgetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    link;
-    linkat; # introduced=21
-    listen;
-    listxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    llabs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    lldiv;
-    llistxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    localeconv; # introduced=21
-    localtime;
-    localtime64; # arm x86 mips
-    localtime64_r; # arm x86 mips
-    localtime_r;
-    login_tty; # introduced=23
-    longjmp;
-    lrand48;
-    lremovexattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    lsearch; # introduced=21
-    lseek;
-    lseek64;
-    lsetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    lstat;
-    lstat64; # introduced=21
-    madvise;
-    mallinfo;
-    malloc;
-    malloc_info; # introduced=23
-    malloc_usable_size; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    mbrlen;
-    mbrtoc16; # introduced=21
-    mbrtoc32; # introduced=21
-    mbrtowc;
-    mbsinit;
-    mbsnrtowcs; # introduced=21
-    mbsrtowcs;
-    mbstowcs;
-    mbtowc; # introduced=21
-    memalign;
-    memccpy;
-    memchr;
-    memcmp;
-    memcpy;
-    memmem;
-    memmove;
-    mempcpy; # introduced=23
-    memrchr;
-    memset;
-    mincore;
-    mkdir;
-    mkdirat;
-    mkdtemp;
-    mkfifo; # introduced=21
-    mkfifoat; # introduced=23
-    mknod;
-    mknodat; # introduced=21
-    mkostemp; # introduced=23
-    mkostemp64; # introduced=23
-    mkostemps; # introduced=23
-    mkostemps64; # introduced=23
-    mkstemp;
-    mkstemp64; # introduced=21
-    mkstemps;
-    mkstemps64; # introduced=23
-    mktemp;
-    mktime;
-    mktime64; # arm x86 mips
-    mlock;
-    mlockall; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    mmap;
-    mmap64; # introduced=21
-    mount;
-    mprotect;
-    mrand48;
-    mremap;
-    msync;
-    munlock;
-    munlockall; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    munmap;
-    nanosleep;
-    newlocale; # introduced=21
-    nftw; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    nftw64; # introduced=21
-    nice;
-    nrand48;
-    nsdispatch;
-    ntohl; # introduced=21
-    ntohs; # introduced=21
-    open;
-    open64; # introduced=21
-    open_memstream; # introduced=23
-    open_wmemstream; # introduced=23
-    openat;
-    openat64; # introduced=21
-    opendir;
-    openlog;
-    openpty; # introduced=23
-    optarg; # var
-    opterr; # var
-    optind; # var
-    optopt; # var
-    optreset; # var
-    pathconf;
-    pause;
-    pclose;
-    perror;
-    personality; # introduced-arm=15 introduced-arm64=21 introduced-mips=15 introduced-mips64=21 introduced-x86=15 introduced-x86_64=21
-    pipe;
-    pipe2;
-    poll;
-    popen;
-    posix_fadvise; # introduced=21
-    posix_fadvise64; # introduced=21
-    posix_fallocate; # introduced=21
-    posix_fallocate64; # introduced=21
-    posix_madvise; # introduced=23
-    posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    posix_openpt; # introduced=21
-    ppoll; # introduced=21
-    prctl;
-    pread;
-    pread64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    printf;
-    prlimit64; # introduced=21
-    process_vm_readv; # introduced=23
-    process_vm_writev; # introduced=23
-    pselect;
-    psiginfo; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    psignal; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    pthread_atfork; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    pthread_attr_destroy;
-    pthread_attr_getdetachstate;
-    pthread_attr_getguardsize;
-    pthread_attr_getschedparam;
-    pthread_attr_getschedpolicy;
-    pthread_attr_getscope;
-    pthread_attr_getstack;
-    pthread_attr_getstacksize;
-    pthread_attr_init;
-    pthread_attr_setdetachstate;
-    pthread_attr_setguardsize;
-    pthread_attr_setschedparam;
-    pthread_attr_setschedpolicy;
-    pthread_attr_setscope;
-    pthread_attr_setstack;
-    pthread_attr_setstacksize;
-    pthread_cond_broadcast;
-    pthread_cond_destroy;
-    pthread_cond_init;
-    pthread_cond_signal;
-    pthread_cond_timedwait;
-    pthread_cond_timedwait_monotonic; # arm x86 mips
-    pthread_cond_timedwait_monotonic_np; # arm x86 mips
-    pthread_cond_timedwait_relative_np; # arm x86 mips
-    pthread_cond_timeout_np; # arm x86 mips
-    pthread_cond_wait;
-    pthread_condattr_destroy;
-    pthread_condattr_getclock; # introduced=21
-    pthread_condattr_getpshared;
-    pthread_condattr_init;
-    pthread_condattr_setclock; # introduced=21
-    pthread_condattr_setpshared;
-    pthread_create;
-    pthread_detach;
-    pthread_equal;
-    pthread_exit;
-    pthread_getattr_np;
-    pthread_getcpuclockid;
-    pthread_getschedparam;
-    pthread_getspecific;
-    pthread_gettid_np; # introduced=21
-    pthread_join;
-    pthread_key_create;
-    pthread_key_delete;
-    pthread_kill;
-    pthread_mutex_destroy;
-    pthread_mutex_init;
-    pthread_mutex_lock;
-    pthread_mutex_lock_timeout_np; # arm x86 mips
-    pthread_mutex_timedlock; # introduced=21
-    pthread_mutex_trylock;
-    pthread_mutex_unlock;
-    pthread_mutexattr_destroy;
-    pthread_mutexattr_getpshared;
-    pthread_mutexattr_gettype;
-    pthread_mutexattr_init;
-    pthread_mutexattr_setpshared;
-    pthread_mutexattr_settype;
-    pthread_once;
-    pthread_rwlock_destroy;
-    pthread_rwlock_init;
-    pthread_rwlock_rdlock;
-    pthread_rwlock_timedrdlock;
-    pthread_rwlock_timedwrlock;
-    pthread_rwlock_tryrdlock;
-    pthread_rwlock_trywrlock;
-    pthread_rwlock_unlock;
-    pthread_rwlock_wrlock;
-    pthread_rwlockattr_destroy;
-    pthread_rwlockattr_getkind_np; # introduced=23
-    pthread_rwlockattr_getpshared;
-    pthread_rwlockattr_init;
-    pthread_rwlockattr_setkind_np; # introduced=23
-    pthread_rwlockattr_setpshared;
-    pthread_self;
-    pthread_setname_np;
-    pthread_setschedparam;
-    pthread_setspecific;
-    pthread_sigmask;
-    ptrace;
-    ptsname;
-    ptsname_r;
-    putc;
-    putc_unlocked;
-    putchar;
-    putchar_unlocked;
-    putenv;
-    puts;
-    pututline;
-    putw; # arm x86 mips
-    putwc;
-    putwchar;
-    pvalloc; # arm x86 mips introduced=17
-    pwrite;
-    pwrite64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    qsort;
-    quick_exit; # introduced=21
-    raise;
-    rand; # introduced=21
-    rand_r; # introduced=21
-    random; # introduced=21
-    read;
-    readahead; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    readdir;
-    readdir64; # introduced=21
-    readdir64_r; # introduced=21
-    readdir_r;
-    readlink;
-    readlinkat; # introduced=21
-    readv;
-    realloc;
-    realpath;
-    reboot;
-    recv;
-    recvfrom;
-    recvmmsg; # introduced=21
-    recvmsg;
-    regcomp;
-    regerror;
-    regexec;
-    regfree;
-    remove;
-    removexattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    remque; # introduced=21
-    rename;
-    renameat;
-    res_init;
-    res_mkquery;
-    res_query;
-    res_search;
-    rewind;
-    rewinddir;
-    rmdir;
-    sbrk;
-    scandir;
-    scandir64; # introduced=21
-    scanf;
-    sched_get_priority_max;
-    sched_get_priority_min;
-    sched_getaffinity; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sched_getcpu; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sched_getparam;
-    sched_getscheduler;
-    sched_rr_get_interval;
-    sched_setaffinity; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sched_setparam;
-    sched_setscheduler;
-    sched_yield;
-    seed48;
-    seekdir; # introduced=23
-    select;
-    sem_close;
-    sem_destroy;
-    sem_getvalue;
-    sem_init;
-    sem_open;
-    sem_post;
-    sem_timedwait;
-    sem_trywait;
-    sem_unlink;
-    sem_wait;
-    send;
-    sendfile;
-    sendfile64; # introduced=21
-    sendmmsg; # introduced=21
-    sendmsg;
-    sendto;
-    setbuf;
-    setbuffer;
-    setegid;
-    setenv;
-    seteuid;
-    setfsgid; # introduced=21
-    setfsuid; # introduced=21
-    setgid;
-    setgroups;
-    sethostname; # introduced=23
-    setitimer;
-    setjmp;
-    setlinebuf;
-    setlocale;
-    setlogmask;
-    setmntent; # introduced=21
-    setns; # introduced=21
-    setpgid;
-    setpgrp;
-    setpriority;
-    setprogname; # introduced=21
-    setregid;
-    setresgid;
-    setresuid;
-    setreuid;
-    setrlimit;
-    setrlimit64; # introduced=21
-    setservent;
-    setsid;
-    setsockopt;
-    setstate; # introduced=21
-    settimeofday;
-    setuid;
-    setutent;
-    setvbuf;
-    setxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    shutdown;
-    sigaction;
-    sigaddset; # introduced=21
-    sigaltstack;
-    sigblock;
-    sigdelset; # introduced=21
-    sigemptyset; # introduced=21
-    sigfillset; # introduced=21
-    siginterrupt;
-    sigismember; # introduced=21
-    siglongjmp; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    signal; # introduced=21
-    signalfd; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    sigpending;
-    sigprocmask;
-    sigqueue; # introduced=23
-    sigsetjmp; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sigsetmask;
-    sigsuspend;
-    sigtimedwait; # introduced=23
-    sigwait;
-    sigwaitinfo; # introduced=23
-    sleep;
-    snprintf;
-    socket;
-    socketpair;
-    splice; # introduced=21
-    sprintf;
-    srand; # introduced=21
-    srand48;
-    srandom; # introduced=21
-    sscanf;
-    stat;
-    stat64; # introduced=21
-    statfs;
-    statfs64; # introduced=21
-    statvfs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    statvfs64; # introduced=21
-    stderr; # var introduced=23
-    stdin; # var introduced=23
-    stdout; # var introduced=23
-    stpcpy; # introduced=21
-    stpncpy; # introduced=21
-    strcasecmp;
-    strcasecmp_l; # introduced=23
-    strcasestr;
-    strcat;
-    strchr;
-    strcmp;
-    strcoll;
-    strcoll_l; # introduced=21
-    strcpy;
-    strcspn;
-    strdup;
-    strerror;
-    strerror_l; # introduced=23
-    strerror_r;
-    strftime;
-    strftime_l; # introduced=21
-    strlcat;
-    strlcpy;
-    strlen;
-    strncasecmp;
-    strncasecmp_l; # introduced=23
-    strncat;
-    strncmp;
-    strncpy;
-    strndup;
-    strnlen;
-    strpbrk;
-    strptime;
-    strrchr;
-    strsep;
-    strsignal;
-    strspn;
-    strstr;
-    strtod;
-    strtof; # introduced=21
-    strtoimax;
-    strtok;
-    strtok_r;
-    strtol;
-    strtold; # introduced=21
-    strtold_l; # introduced=21
-    strtoll;
-    strtoll_l; # introduced=21
-    strtoq; # introduced=21
-    strtoul;
-    strtoull;
-    strtoull_l; # introduced=21
-    strtoumax;
-    strtouq; # introduced=21
-    strxfrm;
-    strxfrm_l; # introduced=21
-    swapoff; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    swapon; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    swprintf;
-    swscanf;
-    symlink;
-    symlinkat; # introduced=21
-    sync;
-    sys_siglist; # var
-    sys_signame; # var
-    syscall;
-    sysconf;
-    sysinfo;
-    syslog;
-    system;
-    tcdrain; # introduced=21
-    tcflow; # introduced=21
-    tcflush; # introduced=21
-    tcgetattr; # introduced=21
-    tcgetpgrp;
-    tcgetsid; # introduced=21
-    tcsendbreak; # introduced=21
-    tcsetattr; # introduced=21
-    tcsetpgrp;
-    tdelete; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    tdestroy; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    tee; # introduced=21
-    telldir; # introduced=23
-    tempnam;
-    tfind; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    tgkill; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    time;
-    timegm; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    timegm64; # arm x86 mips
-    timelocal; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    timelocal64; # arm x86 mips
-    timer_create;
-    timer_delete;
-    timer_getoverrun;
-    timer_gettime;
-    timer_settime;
-    timerfd_create; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    timerfd_gettime; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    timerfd_settime; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    times;
-    timezone; # var
-    tmpfile;
-    tmpnam;
-    toascii;
-    tolower;
-    tolower_l; # introduced=21
-    toupper;
-    toupper_l; # introduced=21
-    towlower;
-    towlower_l; # introduced=21
-    towupper;
-    towupper_l; # introduced=21
-    truncate;
-    truncate64; # introduced=21
-    tsearch; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    ttyname;
-    ttyname_r;
-    twalk; # introduced=21
-    tzname; # var
-    tzset;
-    umask;
-    umount;
-    umount2;
-    uname;
-    ungetc;
-    ungetwc;
-    unlink;
-    unlinkat;
-    unlockpt;
-    unsetenv;
-    unshare; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    uselocale; # introduced=21
-    usleep;
-    utime;
-    utimensat; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    utimes;
-    utmpname;
-    valloc; # arm x86 mips
-    vasprintf;
-    vdprintf; # introduced=21
-    verr;
-    verrx;
-    vfork;
-    vfprintf;
-    vfscanf;
-    vfwprintf;
-    vfwscanf; # introduced=21
-    vmsplice; # introduced=21
-    vprintf;
-    vscanf;
-    vsnprintf;
-    vsprintf;
-    vsscanf;
-    vswprintf;
-    vswscanf; # introduced=21
-    vsyslog;
-    vwarn;
-    vwarnx;
-    vwprintf;
-    vwscanf; # introduced=21
-    wait;
-    wait4; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    waitid;
-    waitpid;
-    warn;
-    warnx;
-    wcpcpy;
-    wcpncpy;
-    wcrtomb;
-    wcscasecmp;
-    wcscasecmp_l; # introduced=23
-    wcscat;
-    wcschr;
-    wcscmp;
-    wcscoll;
-    wcscoll_l; # introduced=21
-    wcscpy;
-    wcscspn;
-    wcsdup;
-    wcsftime;
-    wcslcat;
-    wcslcpy;
-    wcslen;
-    wcsncasecmp;
-    wcsncasecmp_l; # introduced=23
-    wcsncat;
-    wcsncmp;
-    wcsncpy;
-    wcsnlen;
-    wcsnrtombs; # introduced=21
-    wcspbrk;
-    wcsrchr;
-    wcsrtombs;
-    wcsspn;
-    wcsstr;
-    wcstod;
-    wcstof; # introduced=21
-    wcstoimax; # introduced=21
-    wcstok;
-    wcstol;
-    wcstold; # introduced=21
-    wcstold_l; # introduced=21
-    wcstoll; # introduced=21
-    wcstoll_l; # introduced=21
-    wcstombs;
-    wcstoul;
-    wcstoull; # introduced=21
-    wcstoull_l; # introduced=21
-    wcstoumax; # introduced=21
-    wcswidth;
-    wcsxfrm;
-    wcsxfrm_l; # introduced=21
-    wctob;
-    wctomb; # introduced=21
-    wctype;
-    wctype_l; # introduced=21
-    wcwidth;
-    wmemchr;
-    wmemcmp;
-    wmemcpy;
-    wmemmove;
-    wmempcpy; # introduced=23
-    wmemset;
-    wprintf;
-    write;
-    writev;
-    wscanf;
-  local:
-    *;
-};
-
-LIBC_N { # introduced-arm64=24 introduced-mips=24 introduced-mips64=24 introduced-x86=24 introduced-x86_64=24
-  global:
-    __aeabi_atexit; # arm versioned=24
-    __aeabi_memclr; # arm versioned=24
-    __aeabi_memclr4; # arm versioned=24
-    __aeabi_memclr8; # arm versioned=24
-    __aeabi_memcpy; # arm versioned=24
-    __aeabi_memcpy4; # arm versioned=24
-    __aeabi_memcpy8; # arm versioned=24
-    __aeabi_memmove; # arm versioned=24
-    __aeabi_memmove4; # arm versioned=24
-    __aeabi_memmove8; # arm versioned=24
-    __aeabi_memset; # arm versioned=24
-    __aeabi_memset4; # arm versioned=24
-    __aeabi_memset8; # arm versioned=24
-    __fread_chk; # introduced=24
-    __fwrite_chk; # introduced=24
-    __getcwd_chk; # introduced=24
-    __gnu_Unwind_Find_exidx; # arm versioned=24
-    __pwrite_chk; # introduced=24
-    __pwrite64_chk; # introduced=24
-    __write_chk; # introduced=24
-    adjtimex; # introduced=24
-    clock_adjtime; # introduced=24
-    fgetpos64; # introduced=24
-    fileno_unlocked; # introduced=24
-    fopen64; # introduced=24
-    freeifaddrs; # introduced=24
-    freopen64; # introduced=24
-    fseeko64; # introduced=24
-    fsetpos64; # introduced=24
-    ftello64; # introduced=24
-    funopen64; # introduced=24
-    getgrgid_r; # introduced=24
-    getgrnam_r; # introduced=24
-    getifaddrs; # introduced=24
-    if_freenameindex; # introduced=24
-    if_nameindex; # introduced=24
-    in6addr_any; # var introduced=24
-    in6addr_loopback; # var introduced=24
-    lockf; # introduced=24
-    lockf64; # introduced=24
-    preadv; # introduced=24
-    preadv64; # introduced=24
-    prlimit; # arm mips x86 introduced=24
-    pthread_barrierattr_destroy; # introduced=24
-    pthread_barrierattr_getpshared; # introduced=24
-    pthread_barrierattr_init; # introduced=24
-    pthread_barrierattr_setpshared; # introduced=24
-    pthread_barrier_destroy; # introduced=24
-    pthread_barrier_init; # introduced=24
-    pthread_barrier_wait; # introduced=24
-    pthread_spin_destroy; # introduced=24
-    pthread_spin_init; # introduced=24
-    pthread_spin_lock; # introduced=24
-    pthread_spin_trylock; # introduced=24
-    pthread_spin_unlock; # introduced=24
-    pwritev; # introduced=24
-    pwritev64; # introduced=24
-    scandirat; # introduced=24
-    scandirat64; # introduced=24
-    strchrnul; # introduced=24
-    tmpfile64; # introduced=24
-} LIBC;
-
-LIBC_O {
-  global:
-    catclose; # future
-    catgets; # future
-    catopen; # future
-    ctermid; # future
-    endgrent; # future
-    endpwent; # future
-    futimes; # future
-    futimesat; # future
-    getdomainname; # future
-    getgrent; # future
-    getpwent; # future
-    getsubopt; # future
-    hasmntopt; # future
-    lutimes; # future
-    mblen; # future
-    pthread_getname_np; # future
-    quotactl; # future
-    setdomainname; # future
-    setgrent; # future
-    setpwent; # future
-    sighold; # future
-    sigignore; # future
-    sigpause; # future
-    sigrelse; # future
-    sigset; # future
-    sync_file_range; # future
-    towctrans; # future
-    towctrans_l; # future
-    wctrans; # future
-    wctrans_l; # future
-} LIBC_N;
-
-LIBC_PRIVATE {
-  global:
-    ___Unwind_Backtrace; # arm
-    ___Unwind_ForcedUnwind; # arm
-    ___Unwind_RaiseException; # arm
-    ___Unwind_Resume; # arm
-    ___Unwind_Resume_or_Rethrow; # arm
-    __accept4; # arm x86 mips
-    __adddf3; # arm
-    __addsf3; # arm
-    __aeabi_atexit; # arm
-    __aeabi_cdcmpeq; # arm
-    __aeabi_cdcmple; # arm
-    __aeabi_cdrcmple; # arm
-    __aeabi_d2f; # arm
-    __aeabi_d2iz; # arm
-    __aeabi_dadd; # arm
-    __aeabi_dcmpeq; # arm
-    __aeabi_dcmpge; # arm
-    __aeabi_dcmpgt; # arm
-    __aeabi_dcmple; # arm
-    __aeabi_dcmplt; # arm
-    __aeabi_dcmpun; # arm
-    __aeabi_ddiv; # arm
-    __aeabi_dmul; # arm
-    __aeabi_drsub; # arm
-    __aeabi_dsub; # arm
-    __aeabi_f2d; # arm
-    __aeabi_f2iz; # arm
-    __aeabi_f2uiz; # arm
-    __aeabi_fadd; # arm
-    __aeabi_fcmpun; # arm
-    __aeabi_fdiv; # arm
-    __aeabi_fmul; # arm
-    __aeabi_frsub; # arm
-    __aeabi_fsub; # arm
-    __aeabi_i2d; # arm
-    __aeabi_i2f; # arm
-    __aeabi_idiv; # arm
-    __aeabi_idiv0; # arm
-    __aeabi_idivmod; # arm
-    __aeabi_l2d; # arm
-    __aeabi_l2f; # arm
-    __aeabi_lasr; # arm
-    __aeabi_ldiv0; # arm
-    __aeabi_ldivmod; # arm
-    __aeabi_llsl; # arm
-    __aeabi_llsr; # arm
-    __aeabi_lmul; # arm
-    __aeabi_memclr; # arm
-    __aeabi_memclr4; # arm
-    __aeabi_memclr8; # arm
-    __aeabi_memcpy; # arm
-    __aeabi_memcpy4; # arm
-    __aeabi_memcpy8; # arm
-    __aeabi_memmove; # arm
-    __aeabi_memmove4; # arm
-    __aeabi_memmove8; # arm
-    __aeabi_memset; # arm
-    __aeabi_memset4; # arm
-    __aeabi_memset8; # arm
-    __aeabi_ui2d; # arm
-    __aeabi_ui2f; # arm
-    __aeabi_uidiv; # arm
-    __aeabi_uidivmod; # arm
-    __aeabi_ul2d; # arm
-    __aeabi_ul2f; # arm
-    __aeabi_uldivmod; # arm
-    __aeabi_unwind_cpp_pr0; # arm
-    __aeabi_unwind_cpp_pr1; # arm
-    __aeabi_unwind_cpp_pr2; # arm
-    __arm_fadvise64_64; # arm
-    __ashldi3; # arm
-    __ashrdi3; # arm
-    __bionic_brk; # arm x86 mips
-    __bionic_libgcc_compat_symbols; # arm x86
-    __cmpdf2; # arm
-    __divdf3; # arm
-    __divdi3; # arm x86 mips
-    __divsf3; # arm
-    __divsi3; # arm
-    __dso_handle; # arm
-    __eqdf2; # arm
-    __extendsfdf2; # arm
-    __fixdfsi; # arm
-    __fixsfsi; # arm
-    __fixunssfsi; # arm
-    __floatdidf; # arm
-    __floatdisf; # arm
-    __floatsidf; # arm
-    __floatsisf; # arm
-    __floatundidf; # arm
-    __floatundisf; # arm
-    __floatunsidf; # arm
-    __floatunsisf; # arm
-    __gedf2; # arm
-    __getdents64; # arm x86 mips
-    __gnu_ldivmod_helper; # arm
-    __gnu_uldivmod_helper; # arm
-    __gnu_Unwind_Backtrace; # arm
-    __gnu_unwind_execute; # arm
-    __gnu_Unwind_Find_exidx; # arm
-    __gnu_Unwind_ForcedUnwind; # arm
-    __gnu_unwind_frame; # arm
-    __gnu_Unwind_RaiseException; # arm
-    __gnu_Unwind_Restore_VFP; # arm
-    __gnu_Unwind_Restore_VFP_D; # arm
-    __gnu_Unwind_Restore_VFP_D_16_to_31; # arm
-    __gnu_Unwind_Restore_WMMXC; # arm
-    __gnu_Unwind_Restore_WMMXD; # arm
-    __gnu_Unwind_Resume; # arm
-    __gnu_Unwind_Resume_or_Rethrow; # arm
-    __gnu_Unwind_Save_VFP; # arm
-    __gnu_Unwind_Save_VFP_D; # arm
-    __gnu_Unwind_Save_VFP_D_16_to_31; # arm
-    __gnu_Unwind_Save_WMMXC; # arm
-    __gnu_Unwind_Save_WMMXD; # arm
-    __gtdf2; # arm
-    __ledf2; # arm
-    __lshrdi3; # arm
-    __ltdf2; # arm
-    __muldf3; # arm
-    __muldi3; # arm
-    __mulsf3; # arm
-    __nedf2; # arm
-    __popcount_tab; # arm
-    __popcountsi2; # arm x86 mips
-    __restore_core_regs; # arm
-    __sclose; # arm x86 mips
-    __sflags; # arm x86 mips
-    __sflush; # arm x86 mips
-    __sfp; # arm x86 mips
-    __sglue; # arm x86 mips
-    __smakebuf; # arm x86 mips
-    __sread; # arm x86 mips
-    __srefill; # arm x86 mips
-    __srget; # arm x86 mips
-    __sseek; # arm x86 mips
-    __subdf3; # arm
-    __subsf3; # arm
-    __swbuf; # arm x86 mips
-    __swrite; # arm x86 mips
-    __swsetup; # arm x86 mips
-    __truncdfsf2; # arm
-    __udivdi3; # arm x86 mips
-    __udivsi3; # arm
-    __unorddf2; # arm
-    __unordsf2; # arm
-    _fwalk; # arm x86 mips
-    _Unwind_Backtrace; # arm
-    _Unwind_Complete; # arm
-    _Unwind_DeleteException; # arm
-    _Unwind_ForcedUnwind; # arm
-    _Unwind_GetCFA; # arm
-    _Unwind_GetDataRelBase; # arm
-    _Unwind_GetLanguageSpecificData; # arm
-    _Unwind_GetRegionStart; # arm
-    _Unwind_GetTextRelBase; # arm
-    _Unwind_RaiseException; # arm
-    _Unwind_Resume; # arm
-    _Unwind_Resume_or_Rethrow; # arm
-    _Unwind_VRS_Get; # arm
-    _Unwind_VRS_Pop; # arm
-    _Unwind_VRS_Set; # arm
-    android_getaddrinfofornet;
-    android_getaddrinfofornetcontext;
-    android_gethostbyaddrfornet;
-    android_gethostbynamefornet;
-    atexit; # arm
-    free_malloc_leak_info;
-    get_malloc_leak_info;
-    gMallocLeakZygoteChild;
-    restore_core_regs; # arm
-    SHA1Final; # arm x86 mips
-    SHA1Init; # arm x86 mips
-    SHA1Transform; # arm x86 mips
-    SHA1Update; # arm x86 mips
-} LIBC_O;
-
-LIBC_PLATFORM {
-  global:
-    android_net_res_stats_get_info_for_net;
-    android_net_res_stats_aggregate;
-    android_net_res_stats_get_usable_servers;
-    malloc_backtrace;
-    malloc_disable;
-    malloc_enable;
-    malloc_iterate;
-} LIBC_O;
diff --git a/libc/libc.arm.map b/libc/libc.arm.map
index 0ee2308..1cff815 100644
--- a/libc/libc.arm.map
+++ b/libc/libc.arm.map
@@ -1268,7 +1268,7 @@
 
 LIBC_O {
   global:
-    bsd_signal; # arm x86 mips nobrillo versioned=26
+    bsd_signal; # arm x86 mips versioned=26
     catclose; # future
     catgets; # future
     catopen; # future
@@ -1396,11 +1396,11 @@
     __floatundisf; # arm
     __floatunsidf; # arm
     __floatunsisf; # arm
-    __futex_wait; # arm x86 mips nobrillo
-    __futex_wake; # arm x86 mips nobrillo
+    __futex_wait; # arm x86 mips
+    __futex_wake; # arm x86 mips
     __gedf2; # arm
-    __get_thread; # arm x86 mips nobrillo
-    __get_tls; # arm x86 mips nobrillo
+    __get_thread; # arm x86 mips
+    __get_tls; # arm x86 mips
     __getdents64; # arm x86 mips
     __gnu_ldivmod_helper; # arm
     __gnu_uldivmod_helper; # arm
@@ -1430,21 +1430,21 @@
     __muldi3; # arm
     __mulsf3; # arm
     __nedf2; # arm
-    __open; # arm x86 mips nobrillo
-    __page_shift; # arm x86 mips nobrillo
-    __page_size; # arm x86 mips nobrillo
+    __open; # arm x86 mips
+    __page_shift; # arm x86 mips
+    __page_size; # arm x86 mips
     __popcount_tab; # arm
     __popcountsi2; # arm x86 mips
-    __pthread_gettid; # arm x86 mips nobrillo
+    __pthread_gettid; # arm x86 mips
     __restore_core_regs; # arm
     __sclose; # arm x86 mips
-    __sdidinit; # arm x86 mips nobrillo
-    __set_errno; # arm x86 mips nobrillo
+    __sdidinit; # arm x86 mips
+    __set_errno; # arm x86 mips
     __sflags; # arm x86 mips
     __sflush; # arm x86 mips
     __sfp; # arm x86 mips
     __sglue; # arm x86 mips
-    __sinit; # arm x86 mips nobrillo
+    __sinit; # arm x86 mips
     __smakebuf; # arm x86 mips
     __sread; # arm x86 mips
     __srefill; # arm x86 mips
@@ -1460,7 +1460,7 @@
     __udivsi3; # arm
     __unorddf2; # arm
     __unordsf2; # arm
-    __wait4; # arm x86 mips nobrillo
+    __wait4; # arm x86 mips
     _fwalk; # arm x86 mips
     _Unwind_Backtrace; # arm
     _Unwind_Complete; # arm
@@ -1481,40 +1481,40 @@
     android_getaddrinfofornetcontext;
     android_gethostbyaddrfornet;
     android_gethostbynamefornet;
-    arc4random_addrandom; # arm x86 mips nobrillo
-    arc4random_stir; # arm x86 mips nobrillo
+    arc4random_addrandom; # arm x86 mips
+    arc4random_stir; # arm x86 mips
     atexit; # arm
-    bcopy; # arm x86 mips nobrillo
-    bzero; # arm x86 mips nobrillo
-    dlmalloc; # arm x86 mips nobrillo
-    dlmalloc_inspect_all; # arm x86 mips nobrillo
-    dlmalloc_trim; # arm x86 mips nobrillo
-    dlmalloc_usable_size; # arm x86 mips nobrillo
-    fdprintf; # arm x86 mips nobrillo
+    bcopy; # arm x86 mips
+    bzero; # arm x86 mips
+    dlmalloc; # arm x86 mips
+    dlmalloc_inspect_all; # arm x86 mips
+    dlmalloc_trim; # arm x86 mips
+    dlmalloc_usable_size; # arm x86 mips
+    fdprintf; # arm x86 mips
     free_malloc_leak_info;
-    ftime; # arm x86 mips nobrillo
+    ftime; # arm x86 mips
     get_malloc_leak_info;
-    getdents; # arm x86 mips nobrillo
-    getdtablesize; # arm x86 mips nobrillo
+    getdents; # arm x86 mips
+    getdtablesize; # arm x86 mips
     gMallocLeakZygoteChild;
-    index; # arm x86 mips nobrillo
-    issetugid; # arm x86 mips nobrillo
-    memswap; # arm x86 mips nobrillo
-    pthread_attr_getstackaddr; # arm x86 mips nobrillo
-    pthread_attr_setstackaddr; # arm x86 mips nobrillo
+    index; # arm x86 mips
+    issetugid; # arm x86 mips
+    memswap; # arm x86 mips
+    pthread_attr_getstackaddr; # arm x86 mips
+    pthread_attr_setstackaddr; # arm x86 mips
     restore_core_regs; # arm
     SHA1Final; # arm x86 mips
     SHA1Init; # arm x86 mips
     SHA1Transform; # arm x86 mips
     SHA1Update; # arm x86 mips
-    strntoimax; # arm x86 mips nobrillo
-    strntoumax; # arm x86 mips nobrillo
-    strtotimeval; # arm x86 mips nobrillo
-    sysv_signal; # arm x86 mips nobrillo
-    tkill; # arm x86 mips nobrillo
-    vfdprintf; # arm x86 mips nobrillo
-    wait3; # arm x86 mips nobrillo
-    wcswcs; # arm x86 mips nobrillo
+    strntoimax; # arm x86 mips
+    strntoumax; # arm x86 mips
+    strtotimeval; # arm x86 mips
+    sysv_signal; # arm x86 mips
+    tkill; # arm x86 mips
+    vfdprintf; # arm x86 mips
+    wait3; # arm x86 mips
+    wcswcs; # arm x86 mips
 } LIBC_O;
 
 LIBC_PLATFORM {
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 8c3da20..ca02af6 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1293,7 +1293,7 @@
 
 LIBC_O {
   global:
-    bsd_signal; # arm x86 mips nobrillo versioned=26
+    bsd_signal; # arm x86 mips versioned=26
     catclose; # future
     catgets; # future
     catopen; # future
@@ -1421,11 +1421,11 @@
     __floatundisf; # arm
     __floatunsidf; # arm
     __floatunsisf; # arm
-    __futex_wait; # arm x86 mips nobrillo
-    __futex_wake; # arm x86 mips nobrillo
+    __futex_wait; # arm x86 mips
+    __futex_wake; # arm x86 mips
     __gedf2; # arm
-    __get_thread; # arm x86 mips nobrillo
-    __get_tls; # arm x86 mips nobrillo
+    __get_thread; # arm x86 mips
+    __get_tls; # arm x86 mips
     __getdents64; # arm x86 mips
     __gnu_ldivmod_helper; # arm
     __gnu_uldivmod_helper; # arm
@@ -1455,21 +1455,21 @@
     __muldi3; # arm
     __mulsf3; # arm
     __nedf2; # arm
-    __open; # arm x86 mips nobrillo
-    __page_shift; # arm x86 mips nobrillo
-    __page_size; # arm x86 mips nobrillo
+    __open; # arm x86 mips
+    __page_shift; # arm x86 mips
+    __page_size; # arm x86 mips
     __popcount_tab; # arm
     __popcountsi2; # arm x86 mips
-    __pthread_gettid; # arm x86 mips nobrillo
+    __pthread_gettid; # arm x86 mips
     __restore_core_regs; # arm
     __sclose; # arm x86 mips
-    __sdidinit; # arm x86 mips nobrillo
-    __set_errno; # arm x86 mips nobrillo
+    __sdidinit; # arm x86 mips
+    __set_errno; # arm x86 mips
     __sflags; # arm x86 mips
     __sflush; # arm x86 mips
     __sfp; # arm x86 mips
     __sglue; # arm x86 mips
-    __sinit; # arm x86 mips nobrillo
+    __sinit; # arm x86 mips
     __smakebuf; # arm x86 mips
     __sread; # arm x86 mips
     __srefill; # arm x86 mips
@@ -1486,7 +1486,7 @@
     __umoddi3; # x86 mips
     __unorddf2; # arm
     __unordsf2; # arm
-    __wait4; # arm x86 mips nobrillo
+    __wait4; # arm x86 mips
     _fwalk; # arm x86 mips
     _Unwind_Backtrace; # arm
     _Unwind_Complete; # arm
@@ -1507,40 +1507,40 @@
     android_getaddrinfofornetcontext;
     android_gethostbyaddrfornet;
     android_gethostbynamefornet;
-    arc4random_addrandom; # arm x86 mips nobrillo
-    arc4random_stir; # arm x86 mips nobrillo
+    arc4random_addrandom; # arm x86 mips
+    arc4random_stir; # arm x86 mips
     atexit; # arm
-    bcopy; # arm x86 mips nobrillo
-    bzero; # arm x86 mips nobrillo
-    dlmalloc; # arm x86 mips nobrillo
-    dlmalloc_inspect_all; # arm x86 mips nobrillo
-    dlmalloc_trim; # arm x86 mips nobrillo
-    dlmalloc_usable_size; # arm x86 mips nobrillo
-    fdprintf; # arm x86 mips nobrillo
+    bcopy; # arm x86 mips
+    bzero; # arm x86 mips
+    dlmalloc; # arm x86 mips
+    dlmalloc_inspect_all; # arm x86 mips
+    dlmalloc_trim; # arm x86 mips
+    dlmalloc_usable_size; # arm x86 mips
+    fdprintf; # arm x86 mips
     free_malloc_leak_info;
-    ftime; # arm x86 mips nobrillo
+    ftime; # arm x86 mips
     get_malloc_leak_info;
-    getdents; # arm x86 mips nobrillo
-    getdtablesize; # arm x86 mips nobrillo
+    getdents; # arm x86 mips
+    getdtablesize; # arm x86 mips
     gMallocLeakZygoteChild;
-    index; # arm x86 mips nobrillo
-    issetugid; # arm x86 mips nobrillo
-    memswap; # arm x86 mips nobrillo
-    pthread_attr_getstackaddr; # arm x86 mips nobrillo
-    pthread_attr_setstackaddr; # arm x86 mips nobrillo
+    index; # arm x86 mips
+    issetugid; # arm x86 mips
+    memswap; # arm x86 mips
+    pthread_attr_getstackaddr; # arm x86 mips
+    pthread_attr_setstackaddr; # arm x86 mips
     restore_core_regs; # arm
     SHA1Final; # arm x86 mips
     SHA1Init; # arm x86 mips
     SHA1Transform; # arm x86 mips
     SHA1Update; # arm x86 mips
-    strntoimax; # arm x86 mips nobrillo
-    strntoumax; # arm x86 mips nobrillo
-    strtotimeval; # arm x86 mips nobrillo
-    sysv_signal; # arm x86 mips nobrillo
-    tkill; # arm x86 mips nobrillo
-    vfdprintf; # arm x86 mips nobrillo
-    wait3; # arm x86 mips nobrillo
-    wcswcs; # arm x86 mips nobrillo
+    strntoimax; # arm x86 mips
+    strntoumax; # arm x86 mips
+    strtotimeval; # arm x86 mips
+    sysv_signal; # arm x86 mips
+    tkill; # arm x86 mips
+    vfdprintf; # arm x86 mips
+    wait3; # arm x86 mips
+    wcswcs; # arm x86 mips
 } LIBC_O;
 
 LIBC_PLATFORM {
diff --git a/libc/libc.mips.brillo.map b/libc/libc.mips.brillo.map
deleted file mode 100644
index 3911b20..0000000
--- a/libc/libc.mips.brillo.map
+++ /dev/null
@@ -1,1332 +0,0 @@
-# Generated by genversion-scripts.py. Do not edit.
-LIBC {
-  global:
-    __assert;
-    __assert2;
-    __b64_ntop;
-    __b64_pton;
-    __cmsg_nxthdr; # introduced=21
-    __connect; # arm x86 mips introduced=21
-    __ctype_get_mb_cur_max; # introduced=21
-    __cxa_atexit;
-    __cxa_finalize;
-    __cxa_thread_atexit_impl; # introduced=23
-    __dn_comp;
-    __dn_count_labels;
-    __dn_skipname;
-    __epoll_pwait; # arm x86 mips introduced=21
-    __errno;
-    __exit; # arm x86 mips introduced=21
-    __fadvise64; # x86 mips introduced=21
-    __fbufsize; # introduced=23
-    __fcntl64; # arm x86 mips
-    __FD_CLR_chk; # introduced=21
-    __FD_ISSET_chk; # introduced=21
-    __FD_SET_chk; # introduced=21
-    __fgets_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __flbf; # introduced=23
-    __fp_nquery;
-    __fp_query;
-    __fpclassify; # introduced=21
-    __fpclassifyd;
-    __fpclassifyf;
-    __fpclassifyl;
-    __fpending; # introduced=23
-    __fpurge; # introduced=23
-    __freadable; # introduced=23
-    __fsetlocking; # introduced=23
-    __fstatfs64; # arm x86 mips
-    __fwritable; # introduced=23
-    __get_h_errno;
-    __getcpu; # arm x86 mips introduced-arm=12 introduced-mips=16 introduced-x86=12
-    __getcwd; # arm x86 mips
-    __getpid; # arm x86 mips introduced=21
-    __getpriority; # arm x86 mips
-    __gnu_basename; # introduced=23
-    __gnu_strerror_r; # introduced=23
-    __hostalias;
-    __ioctl; # arm x86 mips
-    __isfinite;
-    __isfinitef;
-    __isfinitel;
-    __isinf;
-    __isinff;
-    __isinfl;
-    __isnan; # introduced=21
-    __isnanf; # introduced=21
-    __isnanl;
-    __isnormal;
-    __isnormalf;
-    __isnormall;
-    __isthreaded; # arm x86 mips var
-    __libc_current_sigrtmax; # introduced=21
-    __libc_current_sigrtmin; # introduced=21
-    __libc_init;
-    __llseek; # arm x86 mips
-    __loc_aton;
-    __loc_ntoa;
-    __memchr_chk; # introduced=23
-    __memcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __memmove_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __memrchr_chk; # introduced=23
-    __memset_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __mmap2; # arm x86 mips
-    __ns_format_ttl; # arm x86 mips
-    __ns_get16; # arm x86 mips
-    __ns_get32; # arm x86 mips
-    __ns_initparse; # arm x86 mips
-    __ns_makecanon; # arm x86 mips
-    __ns_msg_getflag; # arm x86 mips
-    __ns_name_compress; # arm x86 mips
-    __ns_name_ntol; # arm x86 mips
-    __ns_name_ntop; # arm x86 mips
-    __ns_name_pack; # arm x86 mips
-    __ns_name_pton; # arm x86 mips
-    __ns_name_rollback; # arm x86 mips
-    __ns_name_skip; # arm x86 mips
-    __ns_name_uncompress; # arm x86 mips
-    __ns_name_unpack; # arm x86 mips
-    __ns_parserr; # arm x86 mips
-    __ns_put16; # arm x86 mips
-    __ns_put32; # arm x86 mips
-    __ns_samename; # arm x86 mips
-    __ns_skiprr; # arm x86 mips
-    __ns_sprintrr; # arm x86 mips
-    __ns_sprintrrf; # arm x86 mips
-    __open_2; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __openat; # arm x86 mips
-    __openat_2; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __p_cdname;
-    __p_cdnname;
-    __p_class;
-    __p_class_syms; # var
-    __p_fqname;
-    __p_fqnname;
-    __p_option;
-    __p_query;
-    __p_rcode;
-    __p_secstodate;
-    __p_time;
-    __p_type;
-    __p_type_syms; # var
-    __poll_chk; # introduced=23
-    __ppoll; # arm x86 mips introduced=21
-    __ppoll_chk; # introduced=23
-    __pread64_chk; # introduced=23
-    __pread_chk; # introduced=23
-    __progname; # var
-    __pselect6; # arm x86 mips introduced=21
-    __pthread_cleanup_pop;
-    __pthread_cleanup_push;
-    __ptrace; # arm x86 mips
-    __putlong;
-    __putshort;
-    __read_chk; # introduced=21
-    __readlink_chk; # introduced=23
-    __readlinkat_chk; # introduced=23
-    __reboot; # arm x86 mips
-    __recvfrom_chk; # introduced=21
-    __register_atfork; # introduced=23
-    __res_close;
-    __res_dnok;
-    __res_hnok;
-    __res_hostalias;
-    __res_isourserver;
-    __res_mailok;
-    __res_nameinquery;
-    __res_nclose;
-    __res_ninit;
-    __res_nmkquery;
-    __res_nquery;
-    __res_nquerydomain;
-    __res_nsearch;
-    __res_nsend;
-    __res_ownok;
-    __res_queriesmatch;
-    __res_querydomain;
-    __res_send;
-    __res_send_setqhook;
-    __res_send_setrhook;
-    __rt_sigaction; # arm x86 mips
-    __rt_sigpending; # arm x86 mips introduced=21
-    __rt_sigprocmask; # arm x86 mips
-    __rt_sigsuspend; # arm x86 mips introduced=21
-    __rt_sigtimedwait; # arm x86 mips
-    __sched_cpualloc; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __sched_cpucount; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __sched_cpufree; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __sched_getaffinity; # arm x86 mips introduced=12
-    __set_tid_address; # arm x86 mips introduced=21
-    __set_tls; # arm mips
-    __sF; # var
-    __sigaction; # arm x86 mips introduced=21
-    __snprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __socket; # arm x86 mips introduced=21
-    __sprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __stack_chk_fail;
-    __stack_chk_guard; # var
-    __statfs64; # arm x86 mips
-    __stpcpy_chk; # introduced=21
-    __stpncpy_chk; # introduced=21
-    __stpncpy_chk2; # introduced=21
-    __strcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    __strcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strlcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strlcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strlen_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strncat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strncpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strncpy_chk2; # introduced=21
-    __strrchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    __sym_ntop;
-    __sym_ntos;
-    __sym_ston;
-    __system_properties_init;
-    __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_area__; # var
-    __system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_area_serial; # introduced=23
-    __system_property_find;
-    __system_property_find_nth;
-    __system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_get;
-    __system_property_read;
-    __system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __timer_create; # arm x86 mips
-    __timer_delete; # arm x86 mips
-    __timer_getoverrun; # arm x86 mips
-    __timer_gettime; # arm x86 mips
-    __timer_settime; # arm x86 mips
-    __umask_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    __vsnprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __vsprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __waitid; # arm x86 mips
-    _ctype_; # var
-    _Exit; # introduced=21
-    _exit;
-    _flush_cache; # mips
-    _flushlbf; # introduced=23
-    _getlong;
-    _getshort;
-    _longjmp;
-    _resolv_delete_cache_for_net; # introduced=21
-    _resolv_flush_cache_for_net; # introduced=21
-    _resolv_set_nameservers_for_net; # introduced=21
-    _setjmp;
-    _tolower; # introduced=21
-    _tolower_tab_; # arm x86 mips var
-    _toupper; # introduced=21
-    _toupper_tab_; # arm x86 mips var
-    abort;
-    abs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    accept;
-    accept4; # introduced=21
-    access;
-    acct;
-    alarm;
-    alphasort;
-    alphasort64; # introduced=21
-    android_set_abort_message; # introduced=21
-    arc4random;
-    arc4random_buf;
-    arc4random_uniform;
-    asctime;
-    asctime64; # arm x86 mips
-    asctime64_r; # arm x86 mips
-    asctime_r;
-    asprintf;
-    at_quick_exit; # introduced=21
-    atof; # introduced=21
-    atoi;
-    atol;
-    atoll;
-    basename;
-    basename_r; # arm x86 mips
-    bind;
-    bindresvport;
-    brk;
-    bsearch;
-    btowc;
-    c16rtomb; # introduced=21
-    c32rtomb; # introduced=21
-    cacheflush; # arm mips
-    calloc;
-    capget;
-    capset;
-    cfgetispeed; # introduced=21
-    cfgetospeed; # introduced=21
-    cfmakeraw; # introduced=21
-    cfsetispeed; # introduced=21
-    cfsetospeed; # introduced=21
-    cfsetspeed; # introduced=21
-    chdir;
-    chmod;
-    chown;
-    chroot;
-    clearenv;
-    clearerr;
-    clearerr_unlocked; # introduced=23
-    clock;
-    clock_getcpuclockid; # introduced=23
-    clock_getres;
-    clock_gettime;
-    clock_nanosleep;
-    clock_settime;
-    clone; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    close;
-    closedir;
-    closelog;
-    connect;
-    creat;
-    creat64; # introduced=21
-    ctime;
-    ctime64; # arm x86 mips
-    ctime64_r; # arm x86 mips
-    ctime_r;
-    daemon;
-    daylight; # var
-    delete_module;
-    difftime;
-    dirfd;
-    dirname;
-    dirname_r; # arm x86 mips
-    div;
-    dn_expand;
-    dprintf; # introduced=21
-    drand48;
-    dup;
-    dup2;
-    dup3; # introduced=21
-    duplocale; # introduced=21
-    endmntent; # introduced=21
-    endservent;
-    endutent;
-    environ; # var
-    epoll_create;
-    epoll_create1; # introduced=21
-    epoll_ctl;
-    epoll_pwait; # introduced=21
-    epoll_wait;
-    erand48;
-    err;
-    error; # introduced=23
-    error_at_line; # introduced=23
-    error_message_count; # var introduced=23
-    error_one_per_line; # var introduced=23
-    error_print_progname; # var introduced=23
-    errx;
-    ether_aton; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ether_aton_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ether_ntoa; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ether_ntoa_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    eventfd;
-    eventfd_read;
-    eventfd_write;
-    execl;
-    execle;
-    execlp;
-    execv;
-    execve;
-    execvp;
-    execvpe; # introduced=21
-    exit;
-    faccessat; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    fallocate; # introduced=21
-    fallocate64; # introduced=21
-    fchdir;
-    fchmod;
-    fchmodat;
-    fchown;
-    fchownat;
-    fclose;
-    fcntl;
-    fdatasync;
-    fdopen;
-    fdopendir;
-    feof;
-    feof_unlocked; # introduced=23
-    ferror;
-    ferror_unlocked; # introduced=23
-    fflush;
-    ffs; # introduced-arm=9 introduced-arm64=21 introduced-mips=9 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    fgetc;
-    fgetln;
-    fgetpos;
-    fgets;
-    fgetwc;
-    fgetws;
-    fgetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    fileno;
-    flistxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    flock;
-    flockfile;
-    fmemopen; # introduced=23
-    fnmatch;
-    fopen;
-    fork;
-    forkpty; # introduced=23
-    fpathconf;
-    fprintf;
-    fpurge;
-    fputc;
-    fputs;
-    fputwc;
-    fputws;
-    fread;
-    free;
-    freeaddrinfo;
-    freelocale; # introduced=21
-    fremovexattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    freopen;
-    fscanf;
-    fseek;
-    fseeko;
-    fsetpos;
-    fsetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    fstat;
-    fstat64; # introduced=21
-    fstatat;
-    fstatat64; # introduced=21
-    fstatfs;
-    fstatfs64; # introduced=21
-    fstatvfs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    fstatvfs64; # introduced=21
-    fsync;
-    ftell;
-    ftello;
-    ftok;
-    ftruncate;
-    ftruncate64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ftrylockfile;
-    fts_children;
-    fts_close;
-    fts_open;
-    fts_read;
-    fts_set;
-    ftw; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    ftw64; # introduced=21
-    funlockfile;
-    funopen;
-    futimens; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    fwide;
-    fwprintf;
-    fwrite;
-    fwscanf;
-    gai_strerror;
-    get_avphys_pages; # introduced=23
-    get_nprocs; # introduced=23
-    get_nprocs_conf; # introduced=23
-    get_phys_pages; # introduced=23
-    getaddrinfo;
-    getauxval; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    getc;
-    getc_unlocked;
-    getchar;
-    getchar_unlocked;
-    getcwd;
-    getdelim; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    getegid;
-    getenv;
-    geteuid;
-    getgid;
-    getgrgid;
-    getgrnam;
-    getgrouplist;
-    getgroups;
-    gethostbyaddr;
-    gethostbyaddr_r; # introduced=23
-    gethostbyname;
-    gethostbyname2;
-    gethostbyname2_r; # introduced=23
-    gethostbyname_r;
-    gethostent;
-    gethostname;
-    getitimer;
-    getline; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    getlogin;
-    getmntent;
-    getmntent_r; # introduced=21
-    getnameinfo;
-    getnetbyaddr;
-    getnetbyname;
-    getopt;
-    getopt_long;
-    getopt_long_only;
-    getpagesize; # introduced=21
-    getpeername;
-    getpgid;
-    getpgrp;
-    getpid;
-    getppid;
-    getpriority;
-    getprogname; # introduced=21
-    getprotobyname;
-    getprotobynumber;
-    getpt;
-    getpwnam;
-    getpwnam_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    getpwuid;
-    getpwuid_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    getresgid;
-    getresuid;
-    getrlimit;
-    getrlimit64; # introduced=21
-    getrusage;
-    gets;
-    getservbyname;
-    getservbyport;
-    getservent;
-    getsid; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    getsockname;
-    getsockopt;
-    gettid;
-    gettimeofday;
-    getuid;
-    getutent;
-    getwc;
-    getwchar;
-    getxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    gmtime;
-    gmtime64; # arm x86 mips
-    gmtime64_r; # arm x86 mips
-    gmtime_r;
-    grantpt; # introduced=21
-    herror;
-    hstrerror;
-    htonl; # introduced=21
-    htons; # introduced=21
-    if_indextoname;
-    if_nametoindex;
-    imaxabs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    imaxdiv; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    inet_addr;
-    inet_aton;
-    inet_lnaof; # introduced=21
-    inet_makeaddr; # introduced=21
-    inet_netof; # introduced=21
-    inet_network; # introduced=21
-    inet_nsap_addr;
-    inet_nsap_ntoa;
-    inet_ntoa;
-    inet_ntop;
-    inet_pton;
-    init_module;
-    initgroups;
-    initstate; # introduced=21
-    inotify_add_watch;
-    inotify_init;
-    inotify_init1; # introduced=21
-    inotify_rm_watch;
-    insque; # introduced=21
-    ioctl;
-    isalnum;
-    isalnum_l; # introduced=21
-    isalpha;
-    isalpha_l; # introduced=21
-    isascii;
-    isatty;
-    isblank;
-    isblank_l; # introduced=21
-    iscntrl;
-    iscntrl_l; # introduced=21
-    isdigit;
-    isdigit_l; # introduced=21
-    isfinite; # introduced=21
-    isfinitef; # introduced=21
-    isfinitel; # introduced=21
-    isgraph;
-    isgraph_l; # introduced=21
-    isinf; # introduced=21
-    isinff; # introduced=21
-    isinfl; # introduced=21
-    islower;
-    islower_l; # introduced=21
-    isnan;
-    isnanf;
-    isnanl; # introduced=21
-    isnormal; # introduced=21
-    isnormalf; # introduced=21
-    isnormall; # introduced=21
-    isprint;
-    isprint_l; # introduced=21
-    ispunct;
-    ispunct_l; # introduced=21
-    isspace;
-    isspace_l; # introduced=21
-    isupper;
-    isupper_l; # introduced=21
-    iswalnum;
-    iswalnum_l; # introduced=21
-    iswalpha;
-    iswalpha_l; # introduced=21
-    iswblank; # introduced=21
-    iswblank_l; # introduced=21
-    iswcntrl;
-    iswcntrl_l; # introduced=21
-    iswctype;
-    iswctype_l; # introduced=21
-    iswdigit;
-    iswdigit_l; # introduced=21
-    iswgraph;
-    iswgraph_l; # introduced=21
-    iswlower;
-    iswlower_l; # introduced=21
-    iswprint;
-    iswprint_l; # introduced=21
-    iswpunct;
-    iswpunct_l; # introduced=21
-    iswspace;
-    iswspace_l; # introduced=21
-    iswupper;
-    iswupper_l; # introduced=21
-    iswxdigit;
-    iswxdigit_l; # introduced=21
-    isxdigit;
-    isxdigit_l; # introduced=21
-    jrand48;
-    kill;
-    killpg;
-    klogctl;
-    labs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    lchown;
-    lcong48; # introduced=23
-    ldexp;
-    ldiv;
-    lfind; # introduced=21
-    lgetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    link;
-    linkat; # introduced=21
-    listen;
-    listxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    llabs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    lldiv;
-    llistxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    localeconv; # introduced=21
-    localtime;
-    localtime64; # arm x86 mips
-    localtime64_r; # arm x86 mips
-    localtime_r;
-    login_tty; # introduced=23
-    longjmp;
-    lrand48;
-    lremovexattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    lsearch; # introduced=21
-    lseek;
-    lseek64;
-    lsetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    lstat;
-    lstat64; # introduced=21
-    madvise;
-    mallinfo;
-    malloc;
-    malloc_info; # introduced=23
-    malloc_usable_size; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    mbrlen;
-    mbrtoc16; # introduced=21
-    mbrtoc32; # introduced=21
-    mbrtowc;
-    mbsinit;
-    mbsnrtowcs; # introduced=21
-    mbsrtowcs;
-    mbstowcs;
-    mbtowc; # introduced=21
-    memalign;
-    memccpy;
-    memchr;
-    memcmp;
-    memcpy;
-    memmem;
-    memmove;
-    mempcpy; # introduced=23
-    memrchr;
-    memset;
-    mincore;
-    mkdir;
-    mkdirat;
-    mkdtemp;
-    mkfifo; # introduced=21
-    mkfifoat; # introduced=23
-    mknod;
-    mknodat; # introduced=21
-    mkostemp; # introduced=23
-    mkostemp64; # introduced=23
-    mkostemps; # introduced=23
-    mkostemps64; # introduced=23
-    mkstemp;
-    mkstemp64; # introduced=21
-    mkstemps;
-    mkstemps64; # introduced=23
-    mktemp;
-    mktime;
-    mktime64; # arm x86 mips
-    mlock;
-    mlockall; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    mmap;
-    mmap64; # introduced=21
-    mount;
-    mprotect;
-    mrand48;
-    mremap;
-    msync;
-    munlock;
-    munlockall; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    munmap;
-    nanosleep;
-    newlocale; # introduced=21
-    nftw; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    nftw64; # introduced=21
-    nice;
-    nrand48;
-    nsdispatch;
-    ntohl; # introduced=21
-    ntohs; # introduced=21
-    open;
-    open64; # introduced=21
-    open_memstream; # introduced=23
-    open_wmemstream; # introduced=23
-    openat;
-    openat64; # introduced=21
-    opendir;
-    openlog;
-    openpty; # introduced=23
-    optarg; # var
-    opterr; # var
-    optind; # var
-    optopt; # var
-    optreset; # var
-    pathconf;
-    pause;
-    pclose;
-    perror;
-    personality; # introduced-arm=15 introduced-arm64=21 introduced-mips=15 introduced-mips64=21 introduced-x86=15 introduced-x86_64=21
-    pipe;
-    pipe2;
-    poll;
-    popen;
-    posix_fadvise; # introduced=21
-    posix_fadvise64; # introduced=21
-    posix_fallocate; # introduced=21
-    posix_fallocate64; # introduced=21
-    posix_madvise; # introduced=23
-    posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    posix_openpt; # introduced=21
-    ppoll; # introduced=21
-    prctl;
-    pread;
-    pread64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    printf;
-    prlimit64; # introduced=21
-    process_vm_readv; # introduced=23
-    process_vm_writev; # introduced=23
-    pselect;
-    psiginfo; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    psignal; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    pthread_atfork; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    pthread_attr_destroy;
-    pthread_attr_getdetachstate;
-    pthread_attr_getguardsize;
-    pthread_attr_getschedparam;
-    pthread_attr_getschedpolicy;
-    pthread_attr_getscope;
-    pthread_attr_getstack;
-    pthread_attr_getstacksize;
-    pthread_attr_init;
-    pthread_attr_setdetachstate;
-    pthread_attr_setguardsize;
-    pthread_attr_setschedparam;
-    pthread_attr_setschedpolicy;
-    pthread_attr_setscope;
-    pthread_attr_setstack;
-    pthread_attr_setstacksize;
-    pthread_cond_broadcast;
-    pthread_cond_destroy;
-    pthread_cond_init;
-    pthread_cond_signal;
-    pthread_cond_timedwait;
-    pthread_cond_timedwait_monotonic; # arm x86 mips
-    pthread_cond_timedwait_monotonic_np; # arm x86 mips
-    pthread_cond_timedwait_relative_np; # arm x86 mips
-    pthread_cond_timeout_np; # arm x86 mips
-    pthread_cond_wait;
-    pthread_condattr_destroy;
-    pthread_condattr_getclock; # introduced=21
-    pthread_condattr_getpshared;
-    pthread_condattr_init;
-    pthread_condattr_setclock; # introduced=21
-    pthread_condattr_setpshared;
-    pthread_create;
-    pthread_detach;
-    pthread_equal;
-    pthread_exit;
-    pthread_getattr_np;
-    pthread_getcpuclockid;
-    pthread_getschedparam;
-    pthread_getspecific;
-    pthread_gettid_np; # introduced=21
-    pthread_join;
-    pthread_key_create;
-    pthread_key_delete;
-    pthread_kill;
-    pthread_mutex_destroy;
-    pthread_mutex_init;
-    pthread_mutex_lock;
-    pthread_mutex_lock_timeout_np; # arm x86 mips
-    pthread_mutex_timedlock; # introduced=21
-    pthread_mutex_trylock;
-    pthread_mutex_unlock;
-    pthread_mutexattr_destroy;
-    pthread_mutexattr_getpshared;
-    pthread_mutexattr_gettype;
-    pthread_mutexattr_init;
-    pthread_mutexattr_setpshared;
-    pthread_mutexattr_settype;
-    pthread_once;
-    pthread_rwlock_destroy;
-    pthread_rwlock_init;
-    pthread_rwlock_rdlock;
-    pthread_rwlock_timedrdlock;
-    pthread_rwlock_timedwrlock;
-    pthread_rwlock_tryrdlock;
-    pthread_rwlock_trywrlock;
-    pthread_rwlock_unlock;
-    pthread_rwlock_wrlock;
-    pthread_rwlockattr_destroy;
-    pthread_rwlockattr_getkind_np; # introduced=23
-    pthread_rwlockattr_getpshared;
-    pthread_rwlockattr_init;
-    pthread_rwlockattr_setkind_np; # introduced=23
-    pthread_rwlockattr_setpshared;
-    pthread_self;
-    pthread_setname_np;
-    pthread_setschedparam;
-    pthread_setspecific;
-    pthread_sigmask;
-    ptrace;
-    ptsname;
-    ptsname_r;
-    putc;
-    putc_unlocked;
-    putchar;
-    putchar_unlocked;
-    putenv;
-    puts;
-    pututline;
-    putw; # arm x86 mips
-    putwc;
-    putwchar;
-    pvalloc; # arm x86 mips introduced=17
-    pwrite;
-    pwrite64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    qsort;
-    quick_exit; # introduced=21
-    raise;
-    rand; # introduced=21
-    rand_r; # introduced=21
-    random; # introduced=21
-    read;
-    readahead; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    readdir;
-    readdir64; # introduced=21
-    readdir64_r; # introduced=21
-    readdir_r;
-    readlink;
-    readlinkat; # introduced=21
-    readv;
-    realloc;
-    realpath;
-    reboot;
-    recv;
-    recvfrom;
-    recvmmsg; # introduced=21
-    recvmsg;
-    regcomp;
-    regerror;
-    regexec;
-    regfree;
-    remove;
-    removexattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    remque; # introduced=21
-    rename;
-    renameat;
-    res_init;
-    res_mkquery;
-    res_query;
-    res_search;
-    rewind;
-    rewinddir;
-    rmdir;
-    sbrk;
-    scandir;
-    scandir64; # introduced=21
-    scanf;
-    sched_get_priority_max;
-    sched_get_priority_min;
-    sched_getaffinity; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sched_getcpu; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sched_getparam;
-    sched_getscheduler;
-    sched_rr_get_interval;
-    sched_setaffinity; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sched_setparam;
-    sched_setscheduler;
-    sched_yield;
-    seed48;
-    seekdir; # introduced=23
-    select;
-    sem_close;
-    sem_destroy;
-    sem_getvalue;
-    sem_init;
-    sem_open;
-    sem_post;
-    sem_timedwait;
-    sem_trywait;
-    sem_unlink;
-    sem_wait;
-    send;
-    sendfile;
-    sendfile64; # introduced=21
-    sendmmsg; # introduced=21
-    sendmsg;
-    sendto;
-    setbuf;
-    setbuffer;
-    setegid;
-    setenv;
-    seteuid;
-    setfsgid; # introduced=21
-    setfsuid; # introduced=21
-    setgid;
-    setgroups;
-    sethostname; # introduced=23
-    setitimer;
-    setjmp;
-    setlinebuf;
-    setlocale;
-    setlogmask;
-    setmntent; # introduced=21
-    setns; # introduced=21
-    setpgid;
-    setpgrp;
-    setpriority;
-    setprogname; # introduced=21
-    setregid;
-    setresgid;
-    setresuid;
-    setreuid;
-    setrlimit;
-    setrlimit64; # introduced=21
-    setservent;
-    setsid;
-    setsockopt;
-    setstate; # introduced=21
-    settimeofday;
-    setuid;
-    setutent;
-    setvbuf;
-    setxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    shutdown;
-    sigaction;
-    sigaddset; # introduced=21
-    sigaltstack;
-    sigblock;
-    sigdelset; # introduced=21
-    sigemptyset; # introduced=21
-    sigfillset; # introduced=21
-    siginterrupt;
-    sigismember; # introduced=21
-    siglongjmp; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    signal; # introduced=21
-    signalfd; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    sigpending;
-    sigprocmask;
-    sigqueue; # introduced=23
-    sigsetjmp; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sigsetmask;
-    sigsuspend;
-    sigtimedwait; # introduced=23
-    sigwait;
-    sigwaitinfo; # introduced=23
-    sleep;
-    snprintf;
-    socket;
-    socketpair;
-    splice; # introduced=21
-    sprintf;
-    srand; # introduced=21
-    srand48;
-    srandom; # introduced=21
-    sscanf;
-    stat;
-    stat64; # introduced=21
-    statfs;
-    statfs64; # introduced=21
-    statvfs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    statvfs64; # introduced=21
-    stderr; # var introduced=23
-    stdin; # var introduced=23
-    stdout; # var introduced=23
-    stpcpy; # introduced=21
-    stpncpy; # introduced=21
-    strcasecmp;
-    strcasecmp_l; # introduced=23
-    strcasestr;
-    strcat;
-    strchr;
-    strcmp;
-    strcoll;
-    strcoll_l; # introduced=21
-    strcpy;
-    strcspn;
-    strdup;
-    strerror;
-    strerror_l; # introduced=23
-    strerror_r;
-    strftime;
-    strftime_l; # introduced=21
-    strlcat;
-    strlcpy;
-    strlen;
-    strncasecmp;
-    strncasecmp_l; # introduced=23
-    strncat;
-    strncmp;
-    strncpy;
-    strndup;
-    strnlen;
-    strpbrk;
-    strptime;
-    strrchr;
-    strsep;
-    strsignal;
-    strspn;
-    strstr;
-    strtod;
-    strtof; # introduced=21
-    strtoimax;
-    strtok;
-    strtok_r;
-    strtol;
-    strtold; # introduced=21
-    strtold_l; # introduced=21
-    strtoll;
-    strtoll_l; # introduced=21
-    strtoq; # introduced=21
-    strtoul;
-    strtoull;
-    strtoull_l; # introduced=21
-    strtoumax;
-    strtouq; # introduced=21
-    strxfrm;
-    strxfrm_l; # introduced=21
-    swapoff; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    swapon; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    swprintf;
-    swscanf;
-    symlink;
-    symlinkat; # introduced=21
-    sync;
-    sys_siglist; # var
-    sys_signame; # var
-    syscall;
-    sysconf;
-    sysinfo;
-    syslog;
-    system;
-    tcdrain; # introduced=21
-    tcflow; # introduced=21
-    tcflush; # introduced=21
-    tcgetattr; # introduced=21
-    tcgetpgrp;
-    tcgetsid; # introduced=21
-    tcsendbreak; # introduced=21
-    tcsetattr; # introduced=21
-    tcsetpgrp;
-    tdelete; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    tdestroy; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    tee; # introduced=21
-    telldir; # introduced=23
-    tempnam;
-    tfind; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    tgkill; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    time;
-    timegm; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    timegm64; # arm x86 mips
-    timelocal; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    timelocal64; # arm x86 mips
-    timer_create;
-    timer_delete;
-    timer_getoverrun;
-    timer_gettime;
-    timer_settime;
-    timerfd_create; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    timerfd_gettime; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    timerfd_settime; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    times;
-    timezone; # var
-    tmpfile;
-    tmpnam;
-    toascii;
-    tolower;
-    tolower_l; # introduced=21
-    toupper;
-    toupper_l; # introduced=21
-    towlower;
-    towlower_l; # introduced=21
-    towupper;
-    towupper_l; # introduced=21
-    truncate;
-    truncate64; # introduced=21
-    tsearch; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    ttyname;
-    ttyname_r;
-    twalk; # introduced=21
-    tzname; # var
-    tzset;
-    umask;
-    umount;
-    umount2;
-    uname;
-    ungetc;
-    ungetwc;
-    unlink;
-    unlinkat;
-    unlockpt;
-    unsetenv;
-    unshare; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    uselocale; # introduced=21
-    usleep;
-    utime;
-    utimensat; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    utimes;
-    utmpname;
-    valloc; # arm x86 mips
-    vasprintf;
-    vdprintf; # introduced=21
-    verr;
-    verrx;
-    vfork;
-    vfprintf;
-    vfscanf;
-    vfwprintf;
-    vfwscanf; # introduced=21
-    vmsplice; # introduced=21
-    vprintf;
-    vscanf;
-    vsnprintf;
-    vsprintf;
-    vsscanf;
-    vswprintf;
-    vswscanf; # introduced=21
-    vsyslog;
-    vwarn;
-    vwarnx;
-    vwprintf;
-    vwscanf; # introduced=21
-    wait;
-    wait4; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    waitid;
-    waitpid;
-    warn;
-    warnx;
-    wcpcpy;
-    wcpncpy;
-    wcrtomb;
-    wcscasecmp;
-    wcscasecmp_l; # introduced=23
-    wcscat;
-    wcschr;
-    wcscmp;
-    wcscoll;
-    wcscoll_l; # introduced=21
-    wcscpy;
-    wcscspn;
-    wcsdup;
-    wcsftime;
-    wcslcat;
-    wcslcpy;
-    wcslen;
-    wcsncasecmp;
-    wcsncasecmp_l; # introduced=23
-    wcsncat;
-    wcsncmp;
-    wcsncpy;
-    wcsnlen;
-    wcsnrtombs; # introduced=21
-    wcspbrk;
-    wcsrchr;
-    wcsrtombs;
-    wcsspn;
-    wcsstr;
-    wcstod;
-    wcstof; # introduced=21
-    wcstoimax; # introduced=21
-    wcstok;
-    wcstol;
-    wcstold; # introduced=21
-    wcstold_l; # introduced=21
-    wcstoll; # introduced=21
-    wcstoll_l; # introduced=21
-    wcstombs;
-    wcstoul;
-    wcstoull; # introduced=21
-    wcstoull_l; # introduced=21
-    wcstoumax; # introduced=21
-    wcswidth;
-    wcsxfrm;
-    wcsxfrm_l; # introduced=21
-    wctob;
-    wctomb; # introduced=21
-    wctype;
-    wctype_l; # introduced=21
-    wcwidth;
-    wmemchr;
-    wmemcmp;
-    wmemcpy;
-    wmemmove;
-    wmempcpy; # introduced=23
-    wmemset;
-    wprintf;
-    write;
-    writev;
-    wscanf;
-  local:
-    *;
-};
-
-LIBC_N { # introduced-arm64=24 introduced-mips=24 introduced-mips64=24 introduced-x86=24 introduced-x86_64=24
-  global:
-    __fread_chk; # introduced=24
-    __fwrite_chk; # introduced=24
-    __getcwd_chk; # introduced=24
-    __pwrite_chk; # introduced=24
-    __pwrite64_chk; # introduced=24
-    __write_chk; # introduced=24
-    adjtimex; # introduced=24
-    clock_adjtime; # introduced=24
-    fgetpos64; # introduced=24
-    fileno_unlocked; # introduced=24
-    fopen64; # introduced=24
-    freeifaddrs; # introduced=24
-    freopen64; # introduced=24
-    fseeko64; # introduced=24
-    fsetpos64; # introduced=24
-    ftello64; # introduced=24
-    funopen64; # introduced=24
-    getgrgid_r; # introduced=24
-    getgrnam_r; # introduced=24
-    getifaddrs; # introduced=24
-    if_freenameindex; # introduced=24
-    if_nameindex; # introduced=24
-    in6addr_any; # var introduced=24
-    in6addr_loopback; # var introduced=24
-    lockf; # introduced=24
-    lockf64; # introduced=24
-    preadv; # introduced=24
-    preadv64; # introduced=24
-    prlimit; # arm mips x86 introduced=24
-    pthread_barrierattr_destroy; # introduced=24
-    pthread_barrierattr_getpshared; # introduced=24
-    pthread_barrierattr_init; # introduced=24
-    pthread_barrierattr_setpshared; # introduced=24
-    pthread_barrier_destroy; # introduced=24
-    pthread_barrier_init; # introduced=24
-    pthread_barrier_wait; # introduced=24
-    pthread_spin_destroy; # introduced=24
-    pthread_spin_init; # introduced=24
-    pthread_spin_lock; # introduced=24
-    pthread_spin_trylock; # introduced=24
-    pthread_spin_unlock; # introduced=24
-    pwritev; # introduced=24
-    pwritev64; # introduced=24
-    scandirat; # introduced=24
-    scandirat64; # introduced=24
-    strchrnul; # introduced=24
-    tmpfile64; # introduced=24
-} LIBC;
-
-LIBC_O {
-  global:
-    catclose; # future
-    catgets; # future
-    catopen; # future
-    ctermid; # future
-    endgrent; # future
-    endpwent; # future
-    futimes; # future
-    futimesat; # future
-    getdomainname; # future
-    getgrent; # future
-    getpwent; # future
-    getsubopt; # future
-    hasmntopt; # future
-    lutimes; # future
-    mblen; # future
-    pthread_getname_np; # future
-    quotactl; # future
-    setdomainname; # future
-    setgrent; # future
-    setpwent; # future
-    sighold; # future
-    sigignore; # future
-    sigpause; # future
-    sigrelse; # future
-    sigset; # future
-    sync_file_range; # future
-    towctrans; # future
-    towctrans_l; # future
-    wctrans; # future
-    wctrans_l; # future
-} LIBC_N;
-
-LIBC_PRIVATE {
-  global:
-    __accept4; # arm x86 mips
-    __bionic_brk; # arm x86 mips
-    __divdi3; # arm x86 mips
-    __getdents64; # arm x86 mips
-    __popcountsi2; # arm x86 mips
-    __sclose; # arm x86 mips
-    __sflags; # arm x86 mips
-    __sflush; # arm x86 mips
-    __sfp; # arm x86 mips
-    __sglue; # arm x86 mips
-    __smakebuf; # arm x86 mips
-    __sread; # arm x86 mips
-    __srefill; # arm x86 mips
-    __srget; # arm x86 mips
-    __sseek; # arm x86 mips
-    __swbuf; # arm x86 mips
-    __swrite; # arm x86 mips
-    __swsetup; # arm x86 mips
-    __udivdi3; # arm x86 mips
-    __umoddi3; # x86 mips
-    _fwalk; # arm x86 mips
-    android_getaddrinfofornet;
-    android_getaddrinfofornetcontext;
-    android_gethostbyaddrfornet;
-    android_gethostbynamefornet;
-    free_malloc_leak_info;
-    get_malloc_leak_info;
-    gMallocLeakZygoteChild;
-    SHA1Final; # arm x86 mips
-    SHA1Init; # arm x86 mips
-    SHA1Transform; # arm x86 mips
-    SHA1Update; # arm x86 mips
-} LIBC_O;
-
-LIBC_PLATFORM {
-  global:
-    android_net_res_stats_get_info_for_net;
-    android_net_res_stats_aggregate;
-    android_net_res_stats_get_usable_servers;
-    malloc_backtrace;
-    malloc_disable;
-    malloc_enable;
-    malloc_iterate;
-} LIBC_O;
diff --git a/libc/libc.mips.map b/libc/libc.mips.map
index cc143c8..66cbf81 100644
--- a/libc/libc.mips.map
+++ b/libc/libc.mips.map
@@ -1252,7 +1252,7 @@
 
 LIBC_O {
   global:
-    bsd_signal; # arm x86 mips nobrillo versioned=26
+    bsd_signal; # arm x86 mips versioned=26
     catclose; # future
     catgets; # future
     catopen; # future
@@ -1290,24 +1290,24 @@
     __accept4; # arm x86 mips
     __bionic_brk; # arm x86 mips
     __divdi3; # arm x86 mips
-    __futex_wait; # arm x86 mips nobrillo
-    __futex_wake; # arm x86 mips nobrillo
-    __get_thread; # arm x86 mips nobrillo
-    __get_tls; # arm x86 mips nobrillo
+    __futex_wait; # arm x86 mips
+    __futex_wake; # arm x86 mips
+    __get_thread; # arm x86 mips
+    __get_tls; # arm x86 mips
     __getdents64; # arm x86 mips
-    __open; # arm x86 mips nobrillo
-    __page_shift; # arm x86 mips nobrillo
-    __page_size; # arm x86 mips nobrillo
+    __open; # arm x86 mips
+    __page_shift; # arm x86 mips
+    __page_size; # arm x86 mips
     __popcountsi2; # arm x86 mips
-    __pthread_gettid; # arm x86 mips nobrillo
+    __pthread_gettid; # arm x86 mips
     __sclose; # arm x86 mips
-    __sdidinit; # arm x86 mips nobrillo
-    __set_errno; # arm x86 mips nobrillo
+    __sdidinit; # arm x86 mips
+    __set_errno; # arm x86 mips
     __sflags; # arm x86 mips
     __sflush; # arm x86 mips
     __sfp; # arm x86 mips
     __sglue; # arm x86 mips
-    __sinit; # arm x86 mips nobrillo
+    __sinit; # arm x86 mips
     __smakebuf; # arm x86 mips
     __sread; # arm x86 mips
     __srefill; # arm x86 mips
@@ -1318,44 +1318,44 @@
     __swsetup; # arm x86 mips
     __udivdi3; # arm x86 mips
     __umoddi3; # x86 mips
-    __wait4; # arm x86 mips nobrillo
+    __wait4; # arm x86 mips
     _fwalk; # arm x86 mips
     android_getaddrinfofornet;
     android_getaddrinfofornetcontext;
     android_gethostbyaddrfornet;
     android_gethostbynamefornet;
-    arc4random_addrandom; # arm x86 mips nobrillo
-    arc4random_stir; # arm x86 mips nobrillo
-    bcopy; # arm x86 mips nobrillo
-    bzero; # arm x86 mips nobrillo
-    dlmalloc; # arm x86 mips nobrillo
-    dlmalloc_inspect_all; # arm x86 mips nobrillo
-    dlmalloc_trim; # arm x86 mips nobrillo
-    dlmalloc_usable_size; # arm x86 mips nobrillo
-    fdprintf; # arm x86 mips nobrillo
+    arc4random_addrandom; # arm x86 mips
+    arc4random_stir; # arm x86 mips
+    bcopy; # arm x86 mips
+    bzero; # arm x86 mips
+    dlmalloc; # arm x86 mips
+    dlmalloc_inspect_all; # arm x86 mips
+    dlmalloc_trim; # arm x86 mips
+    dlmalloc_usable_size; # arm x86 mips
+    fdprintf; # arm x86 mips
     free_malloc_leak_info;
-    ftime; # arm x86 mips nobrillo
+    ftime; # arm x86 mips
     get_malloc_leak_info;
-    getdents; # arm x86 mips nobrillo
-    getdtablesize; # arm x86 mips nobrillo
+    getdents; # arm x86 mips
+    getdtablesize; # arm x86 mips
     gMallocLeakZygoteChild;
-    index; # arm x86 mips nobrillo
-    issetugid; # arm x86 mips nobrillo
-    memswap; # arm x86 mips nobrillo
-    pthread_attr_getstackaddr; # arm x86 mips nobrillo
-    pthread_attr_setstackaddr; # arm x86 mips nobrillo
+    index; # arm x86 mips
+    issetugid; # arm x86 mips
+    memswap; # arm x86 mips
+    pthread_attr_getstackaddr; # arm x86 mips
+    pthread_attr_setstackaddr; # arm x86 mips
     SHA1Final; # arm x86 mips
     SHA1Init; # arm x86 mips
     SHA1Transform; # arm x86 mips
     SHA1Update; # arm x86 mips
-    strntoimax; # arm x86 mips nobrillo
-    strntoumax; # arm x86 mips nobrillo
-    strtotimeval; # arm x86 mips nobrillo
-    sysv_signal; # arm x86 mips nobrillo
-    tkill; # arm x86 mips nobrillo
-    vfdprintf; # arm x86 mips nobrillo
-    wait3; # arm x86 mips nobrillo
-    wcswcs; # arm x86 mips nobrillo
+    strntoimax; # arm x86 mips
+    strntoumax; # arm x86 mips
+    strtotimeval; # arm x86 mips
+    sysv_signal; # arm x86 mips
+    tkill; # arm x86 mips
+    vfdprintf; # arm x86 mips
+    wait3; # arm x86 mips
+    wcswcs; # arm x86 mips
 } LIBC_O;
 
 LIBC_PLATFORM {
diff --git a/libc/libc.x86.brillo.map b/libc/libc.x86.brillo.map
deleted file mode 100644
index a02d358..0000000
--- a/libc/libc.x86.brillo.map
+++ /dev/null
@@ -1,1331 +0,0 @@
-# Generated by genversion-scripts.py. Do not edit.
-LIBC {
-  global:
-    __assert;
-    __assert2;
-    __b64_ntop;
-    __b64_pton;
-    __cmsg_nxthdr; # introduced=21
-    __connect; # arm x86 mips introduced=21
-    __ctype_get_mb_cur_max; # introduced=21
-    __cxa_atexit;
-    __cxa_finalize;
-    __cxa_thread_atexit_impl; # introduced=23
-    __dn_comp;
-    __dn_count_labels;
-    __dn_skipname;
-    __epoll_pwait; # arm x86 mips introduced=21
-    __errno;
-    __exit; # arm x86 mips introduced=21
-    __fadvise64; # x86 mips introduced=21
-    __fbufsize; # introduced=23
-    __fcntl64; # arm x86 mips
-    __FD_CLR_chk; # introduced=21
-    __FD_ISSET_chk; # introduced=21
-    __FD_SET_chk; # introduced=21
-    __fgets_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __flbf; # introduced=23
-    __fp_nquery;
-    __fp_query;
-    __fpclassify; # introduced=21
-    __fpclassifyd;
-    __fpclassifyf;
-    __fpclassifyl;
-    __fpending; # introduced=23
-    __fpurge; # introduced=23
-    __freadable; # introduced=23
-    __fsetlocking; # introduced=23
-    __fstatfs64; # arm x86 mips
-    __fwritable; # introduced=23
-    __get_h_errno;
-    __getcpu; # arm x86 mips introduced-arm=12 introduced-mips=16 introduced-x86=12
-    __getcwd; # arm x86 mips
-    __getpid; # arm x86 mips introduced=21
-    __getpriority; # arm x86 mips
-    __gnu_basename; # introduced=23
-    __gnu_strerror_r; # introduced=23
-    __hostalias;
-    __ioctl; # arm x86 mips
-    __isfinite;
-    __isfinitef;
-    __isfinitel;
-    __isinf;
-    __isinff;
-    __isinfl;
-    __isnan; # introduced=21
-    __isnanf; # introduced=21
-    __isnanl;
-    __isnormal;
-    __isnormalf;
-    __isnormall;
-    __isthreaded; # arm x86 mips var
-    __libc_current_sigrtmax; # introduced=21
-    __libc_current_sigrtmin; # introduced=21
-    __libc_init;
-    __llseek; # arm x86 mips
-    __loc_aton;
-    __loc_ntoa;
-    __memchr_chk; # introduced=23
-    __memcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __memmove_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __memrchr_chk; # introduced=23
-    __memset_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __mmap2; # arm x86 mips
-    __ns_format_ttl; # arm x86 mips
-    __ns_get16; # arm x86 mips
-    __ns_get32; # arm x86 mips
-    __ns_initparse; # arm x86 mips
-    __ns_makecanon; # arm x86 mips
-    __ns_msg_getflag; # arm x86 mips
-    __ns_name_compress; # arm x86 mips
-    __ns_name_ntol; # arm x86 mips
-    __ns_name_ntop; # arm x86 mips
-    __ns_name_pack; # arm x86 mips
-    __ns_name_pton; # arm x86 mips
-    __ns_name_rollback; # arm x86 mips
-    __ns_name_skip; # arm x86 mips
-    __ns_name_uncompress; # arm x86 mips
-    __ns_name_unpack; # arm x86 mips
-    __ns_parserr; # arm x86 mips
-    __ns_put16; # arm x86 mips
-    __ns_put32; # arm x86 mips
-    __ns_samename; # arm x86 mips
-    __ns_skiprr; # arm x86 mips
-    __ns_sprintrr; # arm x86 mips
-    __ns_sprintrrf; # arm x86 mips
-    __open_2; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __openat; # arm x86 mips
-    __openat_2; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __p_cdname;
-    __p_cdnname;
-    __p_class;
-    __p_class_syms; # var
-    __p_fqname;
-    __p_fqnname;
-    __p_option;
-    __p_query;
-    __p_rcode;
-    __p_secstodate;
-    __p_time;
-    __p_type;
-    __p_type_syms; # var
-    __poll_chk; # introduced=23
-    __ppoll; # arm x86 mips introduced=21
-    __ppoll_chk; # introduced=23
-    __pread64_chk; # introduced=23
-    __pread_chk; # introduced=23
-    __progname; # var
-    __pselect6; # arm x86 mips introduced=21
-    __pthread_cleanup_pop;
-    __pthread_cleanup_push;
-    __ptrace; # arm x86 mips
-    __putlong;
-    __putshort;
-    __read_chk; # introduced=21
-    __readlink_chk; # introduced=23
-    __readlinkat_chk; # introduced=23
-    __reboot; # arm x86 mips
-    __recvfrom_chk; # introduced=21
-    __register_atfork; # introduced=23
-    __res_close;
-    __res_dnok;
-    __res_hnok;
-    __res_hostalias;
-    __res_isourserver;
-    __res_mailok;
-    __res_nameinquery;
-    __res_nclose;
-    __res_ninit;
-    __res_nmkquery;
-    __res_nquery;
-    __res_nquerydomain;
-    __res_nsearch;
-    __res_nsend;
-    __res_ownok;
-    __res_queriesmatch;
-    __res_querydomain;
-    __res_send;
-    __res_send_setqhook;
-    __res_send_setrhook;
-    __rt_sigaction; # arm x86 mips
-    __rt_sigpending; # arm x86 mips introduced=21
-    __rt_sigprocmask; # arm x86 mips
-    __rt_sigsuspend; # arm x86 mips introduced=21
-    __rt_sigtimedwait; # arm x86 mips
-    __sched_cpualloc; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __sched_cpucount; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __sched_cpufree; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __sched_getaffinity; # arm x86 mips introduced=12
-    __set_thread_area; # x86
-    __set_tid_address; # arm x86 mips introduced=21
-    __sF; # var
-    __sigaction; # arm x86 mips introduced=21
-    __snprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __socket; # arm x86 mips introduced=21
-    __sprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __stack_chk_fail;
-    __stack_chk_guard; # var
-    __statfs64; # arm x86 mips
-    __stpcpy_chk; # introduced=21
-    __stpncpy_chk; # introduced=21
-    __stpncpy_chk2; # introduced=21
-    __strcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    __strcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strlcat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strlcpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strlen_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strncat_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strncpy_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __strncpy_chk2; # introduced=21
-    __strrchr_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    __sym_ntop;
-    __sym_ntos;
-    __sym_ston;
-    __system_properties_init;
-    __system_property_add; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_area__; # var
-    __system_property_area_init; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_area_serial; # introduced=23
-    __system_property_find;
-    __system_property_find_nth;
-    __system_property_foreach; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_get;
-    __system_property_read;
-    __system_property_serial; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_set; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    __system_property_set_filename; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_update; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __system_property_wait_any; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    __timer_create; # arm x86 mips
-    __timer_delete; # arm x86 mips
-    __timer_getoverrun; # arm x86 mips
-    __timer_gettime; # arm x86 mips
-    __timer_settime; # arm x86 mips
-    __umask_chk; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    __vsnprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __vsprintf_chk; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    __waitid; # arm x86 mips
-    _ctype_; # var
-    _Exit; # introduced=21
-    _exit;
-    _flushlbf; # introduced=23
-    _getlong;
-    _getshort;
-    _longjmp;
-    _resolv_delete_cache_for_net; # introduced=21
-    _resolv_flush_cache_for_net; # introduced=21
-    _resolv_set_nameservers_for_net; # introduced=21
-    _setjmp;
-    _tolower; # introduced=21
-    _tolower_tab_; # arm x86 mips var
-    _toupper; # introduced=21
-    _toupper_tab_; # arm x86 mips var
-    abort;
-    abs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    accept;
-    accept4; # introduced=21
-    access;
-    acct;
-    alarm;
-    alphasort;
-    alphasort64; # introduced=21
-    android_set_abort_message; # introduced=21
-    arc4random;
-    arc4random_buf;
-    arc4random_uniform;
-    asctime;
-    asctime64; # arm x86 mips
-    asctime64_r; # arm x86 mips
-    asctime_r;
-    asprintf;
-    at_quick_exit; # introduced=21
-    atof; # introduced=21
-    atoi;
-    atol;
-    atoll;
-    basename;
-    basename_r; # arm x86 mips
-    bind;
-    bindresvport;
-    brk;
-    bsearch;
-    btowc;
-    c16rtomb; # introduced=21
-    c32rtomb; # introduced=21
-    calloc;
-    capget;
-    capset;
-    cfgetispeed; # introduced=21
-    cfgetospeed; # introduced=21
-    cfmakeraw; # introduced=21
-    cfsetispeed; # introduced=21
-    cfsetospeed; # introduced=21
-    cfsetspeed; # introduced=21
-    chdir;
-    chmod;
-    chown;
-    chroot;
-    clearenv;
-    clearerr;
-    clearerr_unlocked; # introduced=23
-    clock;
-    clock_getcpuclockid; # introduced=23
-    clock_getres;
-    clock_gettime;
-    clock_nanosleep;
-    clock_settime;
-    clone; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    close;
-    closedir;
-    closelog;
-    connect;
-    creat;
-    creat64; # introduced=21
-    ctime;
-    ctime64; # arm x86 mips
-    ctime64_r; # arm x86 mips
-    ctime_r;
-    daemon;
-    daylight; # var
-    delete_module;
-    difftime;
-    dirfd;
-    dirname;
-    dirname_r; # arm x86 mips
-    div;
-    dn_expand;
-    dprintf; # introduced=21
-    drand48;
-    dup;
-    dup2;
-    dup3; # introduced=21
-    duplocale; # introduced=21
-    endmntent; # introduced=21
-    endservent;
-    endutent;
-    environ; # var
-    epoll_create;
-    epoll_create1; # introduced=21
-    epoll_ctl;
-    epoll_pwait; # introduced=21
-    epoll_wait;
-    erand48;
-    err;
-    error; # introduced=23
-    error_at_line; # introduced=23
-    error_message_count; # var introduced=23
-    error_one_per_line; # var introduced=23
-    error_print_progname; # var introduced=23
-    errx;
-    ether_aton; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ether_aton_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ether_ntoa; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ether_ntoa_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    eventfd;
-    eventfd_read;
-    eventfd_write;
-    execl;
-    execle;
-    execlp;
-    execv;
-    execve;
-    execvp;
-    execvpe; # introduced=21
-    exit;
-    faccessat; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    fallocate; # introduced=21
-    fallocate64; # introduced=21
-    fchdir;
-    fchmod;
-    fchmodat;
-    fchown;
-    fchownat;
-    fclose;
-    fcntl;
-    fdatasync;
-    fdopen;
-    fdopendir;
-    feof;
-    feof_unlocked; # introduced=23
-    ferror;
-    ferror_unlocked; # introduced=23
-    fflush;
-    ffs; # introduced-arm=9 introduced-arm64=21 introduced-mips=9 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    fgetc;
-    fgetln;
-    fgetpos;
-    fgets;
-    fgetwc;
-    fgetws;
-    fgetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    fileno;
-    flistxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    flock;
-    flockfile;
-    fmemopen; # introduced=23
-    fnmatch;
-    fopen;
-    fork;
-    forkpty; # introduced=23
-    fpathconf;
-    fprintf;
-    fpurge;
-    fputc;
-    fputs;
-    fputwc;
-    fputws;
-    fread;
-    free;
-    freeaddrinfo;
-    freelocale; # introduced=21
-    fremovexattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    freopen;
-    fscanf;
-    fseek;
-    fseeko;
-    fsetpos;
-    fsetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    fstat;
-    fstat64; # introduced=21
-    fstatat;
-    fstatat64; # introduced=21
-    fstatfs;
-    fstatfs64; # introduced=21
-    fstatvfs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    fstatvfs64; # introduced=21
-    fsync;
-    ftell;
-    ftello;
-    ftok;
-    ftruncate;
-    ftruncate64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    ftrylockfile;
-    fts_children;
-    fts_close;
-    fts_open;
-    fts_read;
-    fts_set;
-    ftw; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    ftw64; # introduced=21
-    funlockfile;
-    funopen;
-    futimens; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    fwide;
-    fwprintf;
-    fwrite;
-    fwscanf;
-    gai_strerror;
-    get_avphys_pages; # introduced=23
-    get_nprocs; # introduced=23
-    get_nprocs_conf; # introduced=23
-    get_phys_pages; # introduced=23
-    getaddrinfo;
-    getauxval; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    getc;
-    getc_unlocked;
-    getchar;
-    getchar_unlocked;
-    getcwd;
-    getdelim; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    getegid;
-    getenv;
-    geteuid;
-    getgid;
-    getgrgid;
-    getgrnam;
-    getgrouplist;
-    getgroups;
-    gethostbyaddr;
-    gethostbyaddr_r; # introduced=23
-    gethostbyname;
-    gethostbyname2;
-    gethostbyname2_r; # introduced=23
-    gethostbyname_r;
-    gethostent;
-    gethostname;
-    getitimer;
-    getline; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    getlogin;
-    getmntent;
-    getmntent_r; # introduced=21
-    getnameinfo;
-    getnetbyaddr;
-    getnetbyname;
-    getopt;
-    getopt_long;
-    getopt_long_only;
-    getpagesize; # introduced=21
-    getpeername;
-    getpgid;
-    getpgrp;
-    getpid;
-    getppid;
-    getpriority;
-    getprogname; # introduced=21
-    getprotobyname;
-    getprotobynumber;
-    getpt;
-    getpwnam;
-    getpwnam_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    getpwuid;
-    getpwuid_r; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    getresgid;
-    getresuid;
-    getrlimit;
-    getrlimit64; # introduced=21
-    getrusage;
-    gets;
-    getservbyname;
-    getservbyport;
-    getservent;
-    getsid; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    getsockname;
-    getsockopt;
-    gettid;
-    gettimeofday;
-    getuid;
-    getutent;
-    getwc;
-    getwchar;
-    getxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    gmtime;
-    gmtime64; # arm x86 mips
-    gmtime64_r; # arm x86 mips
-    gmtime_r;
-    grantpt; # introduced=21
-    herror;
-    hstrerror;
-    htonl; # introduced=21
-    htons; # introduced=21
-    if_indextoname;
-    if_nametoindex;
-    imaxabs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    imaxdiv; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    inet_addr;
-    inet_aton;
-    inet_lnaof; # introduced=21
-    inet_makeaddr; # introduced=21
-    inet_netof; # introduced=21
-    inet_network; # introduced=21
-    inet_nsap_addr;
-    inet_nsap_ntoa;
-    inet_ntoa;
-    inet_ntop;
-    inet_pton;
-    init_module;
-    initgroups;
-    initstate; # introduced=21
-    inotify_add_watch;
-    inotify_init;
-    inotify_init1; # introduced=21
-    inotify_rm_watch;
-    insque; # introduced=21
-    ioctl;
-    isalnum;
-    isalnum_l; # introduced=21
-    isalpha;
-    isalpha_l; # introduced=21
-    isascii;
-    isatty;
-    isblank;
-    isblank_l; # introduced=21
-    iscntrl;
-    iscntrl_l; # introduced=21
-    isdigit;
-    isdigit_l; # introduced=21
-    isfinite; # introduced=21
-    isfinitef; # introduced=21
-    isfinitel; # introduced=21
-    isgraph;
-    isgraph_l; # introduced=21
-    isinf; # introduced=21
-    isinff; # introduced=21
-    isinfl; # introduced=21
-    islower;
-    islower_l; # introduced=21
-    isnan;
-    isnanf;
-    isnanl; # introduced=21
-    isnormal; # introduced=21
-    isnormalf; # introduced=21
-    isnormall; # introduced=21
-    isprint;
-    isprint_l; # introduced=21
-    ispunct;
-    ispunct_l; # introduced=21
-    isspace;
-    isspace_l; # introduced=21
-    isupper;
-    isupper_l; # introduced=21
-    iswalnum;
-    iswalnum_l; # introduced=21
-    iswalpha;
-    iswalpha_l; # introduced=21
-    iswblank; # introduced=21
-    iswblank_l; # introduced=21
-    iswcntrl;
-    iswcntrl_l; # introduced=21
-    iswctype;
-    iswctype_l; # introduced=21
-    iswdigit;
-    iswdigit_l; # introduced=21
-    iswgraph;
-    iswgraph_l; # introduced=21
-    iswlower;
-    iswlower_l; # introduced=21
-    iswprint;
-    iswprint_l; # introduced=21
-    iswpunct;
-    iswpunct_l; # introduced=21
-    iswspace;
-    iswspace_l; # introduced=21
-    iswupper;
-    iswupper_l; # introduced=21
-    iswxdigit;
-    iswxdigit_l; # introduced=21
-    isxdigit;
-    isxdigit_l; # introduced=21
-    jrand48;
-    kill;
-    killpg;
-    klogctl;
-    labs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    lchown;
-    lcong48; # introduced=23
-    ldexp;
-    ldiv;
-    lfind; # introduced=21
-    lgetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    link;
-    linkat; # introduced=21
-    listen;
-    listxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    llabs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    lldiv;
-    llistxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    localeconv; # introduced=21
-    localtime;
-    localtime64; # arm x86 mips
-    localtime64_r; # arm x86 mips
-    localtime_r;
-    login_tty; # introduced=23
-    longjmp;
-    lrand48;
-    lremovexattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    lsearch; # introduced=21
-    lseek;
-    lseek64;
-    lsetxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    lstat;
-    lstat64; # introduced=21
-    madvise;
-    mallinfo;
-    malloc;
-    malloc_info; # introduced=23
-    malloc_usable_size; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    mbrlen;
-    mbrtoc16; # introduced=21
-    mbrtoc32; # introduced=21
-    mbrtowc;
-    mbsinit;
-    mbsnrtowcs; # introduced=21
-    mbsrtowcs;
-    mbstowcs;
-    mbtowc; # introduced=21
-    memalign;
-    memccpy;
-    memchr;
-    memcmp;
-    memcpy;
-    memmem;
-    memmove;
-    mempcpy; # introduced=23
-    memrchr;
-    memset;
-    mincore;
-    mkdir;
-    mkdirat;
-    mkdtemp;
-    mkfifo; # introduced=21
-    mkfifoat; # introduced=23
-    mknod;
-    mknodat; # introduced=21
-    mkostemp; # introduced=23
-    mkostemp64; # introduced=23
-    mkostemps; # introduced=23
-    mkostemps64; # introduced=23
-    mkstemp;
-    mkstemp64; # introduced=21
-    mkstemps;
-    mkstemps64; # introduced=23
-    mktemp;
-    mktime;
-    mktime64; # arm x86 mips
-    mlock;
-    mlockall; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    mmap;
-    mmap64; # introduced=21
-    mount;
-    mprotect;
-    mrand48;
-    mremap;
-    msync;
-    munlock;
-    munlockall; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    munmap;
-    nanosleep;
-    newlocale; # introduced=21
-    nftw; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    nftw64; # introduced=21
-    nice;
-    nrand48;
-    nsdispatch;
-    ntohl; # introduced=21
-    ntohs; # introduced=21
-    open;
-    open64; # introduced=21
-    open_memstream; # introduced=23
-    open_wmemstream; # introduced=23
-    openat;
-    openat64; # introduced=21
-    opendir;
-    openlog;
-    openpty; # introduced=23
-    optarg; # var
-    opterr; # var
-    optind; # var
-    optopt; # var
-    optreset; # var
-    pathconf;
-    pause;
-    pclose;
-    perror;
-    personality; # introduced-arm=15 introduced-arm64=21 introduced-mips=15 introduced-mips64=21 introduced-x86=15 introduced-x86_64=21
-    pipe;
-    pipe2;
-    poll;
-    popen;
-    posix_fadvise; # introduced=21
-    posix_fadvise64; # introduced=21
-    posix_fallocate; # introduced=21
-    posix_fallocate64; # introduced=21
-    posix_madvise; # introduced=23
-    posix_memalign; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    posix_openpt; # introduced=21
-    ppoll; # introduced=21
-    prctl;
-    pread;
-    pread64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    printf;
-    prlimit64; # introduced=21
-    process_vm_readv; # introduced=23
-    process_vm_writev; # introduced=23
-    pselect;
-    psiginfo; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    psignal; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    pthread_atfork; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    pthread_attr_destroy;
-    pthread_attr_getdetachstate;
-    pthread_attr_getguardsize;
-    pthread_attr_getschedparam;
-    pthread_attr_getschedpolicy;
-    pthread_attr_getscope;
-    pthread_attr_getstack;
-    pthread_attr_getstacksize;
-    pthread_attr_init;
-    pthread_attr_setdetachstate;
-    pthread_attr_setguardsize;
-    pthread_attr_setschedparam;
-    pthread_attr_setschedpolicy;
-    pthread_attr_setscope;
-    pthread_attr_setstack;
-    pthread_attr_setstacksize;
-    pthread_cond_broadcast;
-    pthread_cond_destroy;
-    pthread_cond_init;
-    pthread_cond_signal;
-    pthread_cond_timedwait;
-    pthread_cond_timedwait_monotonic; # arm x86 mips
-    pthread_cond_timedwait_monotonic_np; # arm x86 mips
-    pthread_cond_timedwait_relative_np; # arm x86 mips
-    pthread_cond_timeout_np; # arm x86 mips
-    pthread_cond_wait;
-    pthread_condattr_destroy;
-    pthread_condattr_getclock; # introduced=21
-    pthread_condattr_getpshared;
-    pthread_condattr_init;
-    pthread_condattr_setclock; # introduced=21
-    pthread_condattr_setpshared;
-    pthread_create;
-    pthread_detach;
-    pthread_equal;
-    pthread_exit;
-    pthread_getattr_np;
-    pthread_getcpuclockid;
-    pthread_getschedparam;
-    pthread_getspecific;
-    pthread_gettid_np; # introduced=21
-    pthread_join;
-    pthread_key_create;
-    pthread_key_delete;
-    pthread_kill;
-    pthread_mutex_destroy;
-    pthread_mutex_init;
-    pthread_mutex_lock;
-    pthread_mutex_lock_timeout_np; # arm x86 mips
-    pthread_mutex_timedlock; # introduced=21
-    pthread_mutex_trylock;
-    pthread_mutex_unlock;
-    pthread_mutexattr_destroy;
-    pthread_mutexattr_getpshared;
-    pthread_mutexattr_gettype;
-    pthread_mutexattr_init;
-    pthread_mutexattr_setpshared;
-    pthread_mutexattr_settype;
-    pthread_once;
-    pthread_rwlock_destroy;
-    pthread_rwlock_init;
-    pthread_rwlock_rdlock;
-    pthread_rwlock_timedrdlock;
-    pthread_rwlock_timedwrlock;
-    pthread_rwlock_tryrdlock;
-    pthread_rwlock_trywrlock;
-    pthread_rwlock_unlock;
-    pthread_rwlock_wrlock;
-    pthread_rwlockattr_destroy;
-    pthread_rwlockattr_getkind_np; # introduced=23
-    pthread_rwlockattr_getpshared;
-    pthread_rwlockattr_init;
-    pthread_rwlockattr_setkind_np; # introduced=23
-    pthread_rwlockattr_setpshared;
-    pthread_self;
-    pthread_setname_np;
-    pthread_setschedparam;
-    pthread_setspecific;
-    pthread_sigmask;
-    ptrace;
-    ptsname;
-    ptsname_r;
-    putc;
-    putc_unlocked;
-    putchar;
-    putchar_unlocked;
-    putenv;
-    puts;
-    pututline;
-    putw; # arm x86 mips
-    putwc;
-    putwchar;
-    pvalloc; # arm x86 mips introduced=17
-    pwrite;
-    pwrite64; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    qsort;
-    quick_exit; # introduced=21
-    raise;
-    rand; # introduced=21
-    rand_r; # introduced=21
-    random; # introduced=21
-    read;
-    readahead; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    readdir;
-    readdir64; # introduced=21
-    readdir64_r; # introduced=21
-    readdir_r;
-    readlink;
-    readlinkat; # introduced=21
-    readv;
-    realloc;
-    realpath;
-    reboot;
-    recv;
-    recvfrom;
-    recvmmsg; # introduced=21
-    recvmsg;
-    regcomp;
-    regerror;
-    regexec;
-    regfree;
-    remove;
-    removexattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    remque; # introduced=21
-    rename;
-    renameat;
-    res_init;
-    res_mkquery;
-    res_query;
-    res_search;
-    rewind;
-    rewinddir;
-    rmdir;
-    sbrk;
-    scandir;
-    scandir64; # introduced=21
-    scanf;
-    sched_get_priority_max;
-    sched_get_priority_min;
-    sched_getaffinity; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sched_getcpu; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sched_getparam;
-    sched_getscheduler;
-    sched_rr_get_interval;
-    sched_setaffinity; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sched_setparam;
-    sched_setscheduler;
-    sched_yield;
-    seed48;
-    seekdir; # introduced=23
-    select;
-    sem_close;
-    sem_destroy;
-    sem_getvalue;
-    sem_init;
-    sem_open;
-    sem_post;
-    sem_timedwait;
-    sem_trywait;
-    sem_unlink;
-    sem_wait;
-    send;
-    sendfile;
-    sendfile64; # introduced=21
-    sendmmsg; # introduced=21
-    sendmsg;
-    sendto;
-    setbuf;
-    setbuffer;
-    setegid;
-    setenv;
-    seteuid;
-    setfsgid; # introduced=21
-    setfsuid; # introduced=21
-    setgid;
-    setgroups;
-    sethostname; # introduced=23
-    setitimer;
-    setjmp;
-    setlinebuf;
-    setlocale;
-    setlogmask;
-    setmntent; # introduced=21
-    setns; # introduced=21
-    setpgid;
-    setpgrp;
-    setpriority;
-    setprogname; # introduced=21
-    setregid;
-    setresgid;
-    setresuid;
-    setreuid;
-    setrlimit;
-    setrlimit64; # introduced=21
-    setservent;
-    setsid;
-    setsockopt;
-    setstate; # introduced=21
-    settimeofday;
-    setuid;
-    setutent;
-    setvbuf;
-    setxattr; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    shutdown;
-    sigaction;
-    sigaddset; # introduced=21
-    sigaltstack;
-    sigblock;
-    sigdelset; # introduced=21
-    sigemptyset; # introduced=21
-    sigfillset; # introduced=21
-    siginterrupt;
-    sigismember; # introduced=21
-    siglongjmp; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    signal; # introduced=21
-    signalfd; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    sigpending;
-    sigprocmask;
-    sigqueue; # introduced=23
-    sigsetjmp; # introduced-arm=9 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    sigsetmask;
-    sigsuspend;
-    sigtimedwait; # introduced=23
-    sigwait;
-    sigwaitinfo; # introduced=23
-    sleep;
-    snprintf;
-    socket;
-    socketpair;
-    splice; # introduced=21
-    sprintf;
-    srand; # introduced=21
-    srand48;
-    srandom; # introduced=21
-    sscanf;
-    stat;
-    stat64; # introduced=21
-    statfs;
-    statfs64; # introduced=21
-    statvfs; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    statvfs64; # introduced=21
-    stderr; # var introduced=23
-    stdin; # var introduced=23
-    stdout; # var introduced=23
-    stpcpy; # introduced=21
-    stpncpy; # introduced=21
-    strcasecmp;
-    strcasecmp_l; # introduced=23
-    strcasestr;
-    strcat;
-    strchr;
-    strcmp;
-    strcoll;
-    strcoll_l; # introduced=21
-    strcpy;
-    strcspn;
-    strdup;
-    strerror;
-    strerror_l; # introduced=23
-    strerror_r;
-    strftime;
-    strftime_l; # introduced=21
-    strlcat;
-    strlcpy;
-    strlen;
-    strncasecmp;
-    strncasecmp_l; # introduced=23
-    strncat;
-    strncmp;
-    strncpy;
-    strndup;
-    strnlen;
-    strpbrk;
-    strptime;
-    strrchr;
-    strsep;
-    strsignal;
-    strspn;
-    strstr;
-    strtod;
-    strtof; # introduced=21
-    strtoimax;
-    strtok;
-    strtok_r;
-    strtol;
-    strtold; # introduced=21
-    strtold_l; # introduced=21
-    strtoll;
-    strtoll_l; # introduced=21
-    strtoq; # introduced=21
-    strtoul;
-    strtoull;
-    strtoull_l; # introduced=21
-    strtoumax;
-    strtouq; # introduced=21
-    strxfrm;
-    strxfrm_l; # introduced=21
-    swapoff; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    swapon; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    swprintf;
-    swscanf;
-    symlink;
-    symlinkat; # introduced=21
-    sync;
-    sys_siglist; # var
-    sys_signame; # var
-    syscall;
-    sysconf;
-    sysinfo;
-    syslog;
-    system;
-    tcdrain; # introduced=21
-    tcflow; # introduced=21
-    tcflush; # introduced=21
-    tcgetattr; # introduced=21
-    tcgetpgrp;
-    tcgetsid; # introduced=21
-    tcsendbreak; # introduced=21
-    tcsetattr; # introduced=21
-    tcsetpgrp;
-    tdelete; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    tdestroy; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    tee; # introduced=21
-    telldir; # introduced=23
-    tempnam;
-    tfind; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    tgkill; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    time;
-    timegm; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    timegm64; # arm x86 mips
-    timelocal; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    timelocal64; # arm x86 mips
-    timer_create;
-    timer_delete;
-    timer_getoverrun;
-    timer_gettime;
-    timer_settime;
-    timerfd_create; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    timerfd_gettime; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    timerfd_settime; # introduced-arm=19 introduced-arm64=21 introduced-mips=19 introduced-mips64=21 introduced-x86=19 introduced-x86_64=21
-    times;
-    timezone; # var
-    tmpfile;
-    tmpnam;
-    toascii;
-    tolower;
-    tolower_l; # introduced=21
-    toupper;
-    toupper_l; # introduced=21
-    towlower;
-    towlower_l; # introduced=21
-    towupper;
-    towupper_l; # introduced=21
-    truncate;
-    truncate64; # introduced=21
-    tsearch; # introduced-arm=16 introduced-arm64=21 introduced-mips=16 introduced-mips64=21 introduced-x86=16 introduced-x86_64=21
-    ttyname;
-    ttyname_r;
-    twalk; # introduced=21
-    tzname; # var
-    tzset;
-    umask;
-    umount;
-    umount2;
-    uname;
-    ungetc;
-    ungetwc;
-    unlink;
-    unlinkat;
-    unlockpt;
-    unsetenv;
-    unshare; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21
-    uselocale; # introduced=21
-    usleep;
-    utime;
-    utimensat; # introduced-arm=12 introduced-arm64=21 introduced-mips=12 introduced-mips64=21 introduced-x86=12 introduced-x86_64=21
-    utimes;
-    utmpname;
-    valloc; # arm x86 mips
-    vasprintf;
-    vdprintf; # introduced=21
-    verr;
-    verrx;
-    vfork;
-    vfprintf;
-    vfscanf;
-    vfwprintf;
-    vfwscanf; # introduced=21
-    vmsplice; # introduced=21
-    vprintf;
-    vscanf;
-    vsnprintf;
-    vsprintf;
-    vsscanf;
-    vswprintf;
-    vswscanf; # introduced=21
-    vsyslog;
-    vwarn;
-    vwarnx;
-    vwprintf;
-    vwscanf; # introduced=21
-    wait;
-    wait4; # introduced-arm=18 introduced-arm64=21 introduced-mips=18 introduced-mips64=21 introduced-x86=18 introduced-x86_64=21
-    waitid;
-    waitpid;
-    warn;
-    warnx;
-    wcpcpy;
-    wcpncpy;
-    wcrtomb;
-    wcscasecmp;
-    wcscasecmp_l; # introduced=23
-    wcscat;
-    wcschr;
-    wcscmp;
-    wcscoll;
-    wcscoll_l; # introduced=21
-    wcscpy;
-    wcscspn;
-    wcsdup;
-    wcsftime;
-    wcslcat;
-    wcslcpy;
-    wcslen;
-    wcsncasecmp;
-    wcsncasecmp_l; # introduced=23
-    wcsncat;
-    wcsncmp;
-    wcsncpy;
-    wcsnlen;
-    wcsnrtombs; # introduced=21
-    wcspbrk;
-    wcsrchr;
-    wcsrtombs;
-    wcsspn;
-    wcsstr;
-    wcstod;
-    wcstof; # introduced=21
-    wcstoimax; # introduced=21
-    wcstok;
-    wcstol;
-    wcstold; # introduced=21
-    wcstold_l; # introduced=21
-    wcstoll; # introduced=21
-    wcstoll_l; # introduced=21
-    wcstombs;
-    wcstoul;
-    wcstoull; # introduced=21
-    wcstoull_l; # introduced=21
-    wcstoumax; # introduced=21
-    wcswidth;
-    wcsxfrm;
-    wcsxfrm_l; # introduced=21
-    wctob;
-    wctomb; # introduced=21
-    wctype;
-    wctype_l; # introduced=21
-    wcwidth;
-    wmemchr;
-    wmemcmp;
-    wmemcpy;
-    wmemmove;
-    wmempcpy; # introduced=23
-    wmemset;
-    wprintf;
-    write;
-    writev;
-    wscanf;
-  local:
-    *;
-};
-
-LIBC_N { # introduced-arm64=24 introduced-mips=24 introduced-mips64=24 introduced-x86=24 introduced-x86_64=24
-  global:
-    __fread_chk; # introduced=24
-    __fwrite_chk; # introduced=24
-    __getcwd_chk; # introduced=24
-    __pwrite_chk; # introduced=24
-    __pwrite64_chk; # introduced=24
-    __write_chk; # introduced=24
-    adjtimex; # introduced=24
-    clock_adjtime; # introduced=24
-    fgetpos64; # introduced=24
-    fileno_unlocked; # introduced=24
-    fopen64; # introduced=24
-    freeifaddrs; # introduced=24
-    freopen64; # introduced=24
-    fseeko64; # introduced=24
-    fsetpos64; # introduced=24
-    ftello64; # introduced=24
-    funopen64; # introduced=24
-    getgrgid_r; # introduced=24
-    getgrnam_r; # introduced=24
-    getifaddrs; # introduced=24
-    if_freenameindex; # introduced=24
-    if_nameindex; # introduced=24
-    in6addr_any; # var introduced=24
-    in6addr_loopback; # var introduced=24
-    lockf; # introduced=24
-    lockf64; # introduced=24
-    preadv; # introduced=24
-    preadv64; # introduced=24
-    prlimit; # arm mips x86 introduced=24
-    pthread_barrierattr_destroy; # introduced=24
-    pthread_barrierattr_getpshared; # introduced=24
-    pthread_barrierattr_init; # introduced=24
-    pthread_barrierattr_setpshared; # introduced=24
-    pthread_barrier_destroy; # introduced=24
-    pthread_barrier_init; # introduced=24
-    pthread_barrier_wait; # introduced=24
-    pthread_spin_destroy; # introduced=24
-    pthread_spin_init; # introduced=24
-    pthread_spin_lock; # introduced=24
-    pthread_spin_trylock; # introduced=24
-    pthread_spin_unlock; # introduced=24
-    pwritev; # introduced=24
-    pwritev64; # introduced=24
-    scandirat; # introduced=24
-    scandirat64; # introduced=24
-    strchrnul; # introduced=24
-    tmpfile64; # introduced=24
-} LIBC;
-
-LIBC_O {
-  global:
-    catclose; # future
-    catgets; # future
-    catopen; # future
-    ctermid; # future
-    endgrent; # future
-    endpwent; # future
-    futimes; # future
-    futimesat; # future
-    getdomainname; # future
-    getgrent; # future
-    getpwent; # future
-    getsubopt; # future
-    hasmntopt; # future
-    lutimes; # future
-    mblen; # future
-    pthread_getname_np; # future
-    quotactl; # future
-    setdomainname; # future
-    setgrent; # future
-    setpwent; # future
-    sighold; # future
-    sigignore; # future
-    sigpause; # future
-    sigrelse; # future
-    sigset; # future
-    sync_file_range; # future
-    towctrans; # future
-    towctrans_l; # future
-    wctrans; # future
-    wctrans_l; # future
-} LIBC_N;
-
-LIBC_PRIVATE {
-  global:
-    __accept4; # arm x86 mips
-    __bionic_brk; # arm x86 mips
-    __bionic_libgcc_compat_symbols; # arm x86
-    __divdi3; # arm x86 mips
-    __getdents64; # arm x86 mips
-    __popcountsi2; # arm x86 mips
-    __sclose; # arm x86 mips
-    __sflags; # arm x86 mips
-    __sflush; # arm x86 mips
-    __sfp; # arm x86 mips
-    __sglue; # arm x86 mips
-    __smakebuf; # arm x86 mips
-    __sread; # arm x86 mips
-    __srefill; # arm x86 mips
-    __srget; # arm x86 mips
-    __sseek; # arm x86 mips
-    __swbuf; # arm x86 mips
-    __swrite; # arm x86 mips
-    __swsetup; # arm x86 mips
-    __udivdi3; # arm x86 mips
-    __umoddi3; # x86 mips
-    _fwalk; # arm x86 mips
-    android_getaddrinfofornet;
-    android_getaddrinfofornetcontext;
-    android_gethostbyaddrfornet;
-    android_gethostbynamefornet;
-    free_malloc_leak_info;
-    get_malloc_leak_info;
-    gMallocLeakZygoteChild;
-    SHA1Final; # arm x86 mips
-    SHA1Init; # arm x86 mips
-    SHA1Transform; # arm x86 mips
-    SHA1Update; # arm x86 mips
-} LIBC_O;
-
-LIBC_PLATFORM {
-  global:
-    android_net_res_stats_get_info_for_net;
-    android_net_res_stats_aggregate;
-    android_net_res_stats_get_usable_servers;
-    malloc_backtrace;
-    malloc_disable;
-    malloc_enable;
-    malloc_iterate;
-} LIBC_O;
diff --git a/libc/libc.x86.map b/libc/libc.x86.map
index 6e31a41..81f3751 100644
--- a/libc/libc.x86.map
+++ b/libc/libc.x86.map
@@ -1250,7 +1250,7 @@
 
 LIBC_O {
   global:
-    bsd_signal; # arm x86 mips nobrillo versioned=26
+    bsd_signal; # arm x86 mips versioned=26
     catclose; # future
     catgets; # future
     catopen; # future
@@ -1289,24 +1289,24 @@
     __bionic_brk; # arm x86 mips
     __bionic_libgcc_compat_symbols; # arm x86
     __divdi3; # arm x86 mips
-    __futex_wait; # arm x86 mips nobrillo
-    __futex_wake; # arm x86 mips nobrillo
-    __get_thread; # arm x86 mips nobrillo
-    __get_tls; # arm x86 mips nobrillo
+    __futex_wait; # arm x86 mips
+    __futex_wake; # arm x86 mips
+    __get_thread; # arm x86 mips
+    __get_tls; # arm x86 mips
     __getdents64; # arm x86 mips
-    __open; # arm x86 mips nobrillo
-    __page_shift; # arm x86 mips nobrillo
-    __page_size; # arm x86 mips nobrillo
+    __open; # arm x86 mips
+    __page_shift; # arm x86 mips
+    __page_size; # arm x86 mips
     __popcountsi2; # arm x86 mips
-    __pthread_gettid; # arm x86 mips nobrillo
+    __pthread_gettid; # arm x86 mips
     __sclose; # arm x86 mips
-    __sdidinit; # arm x86 mips nobrillo
-    __set_errno; # arm x86 mips nobrillo
+    __sdidinit; # arm x86 mips
+    __set_errno; # arm x86 mips
     __sflags; # arm x86 mips
     __sflush; # arm x86 mips
     __sfp; # arm x86 mips
     __sglue; # arm x86 mips
-    __sinit; # arm x86 mips nobrillo
+    __sinit; # arm x86 mips
     __smakebuf; # arm x86 mips
     __sread; # arm x86 mips
     __srefill; # arm x86 mips
@@ -1317,44 +1317,44 @@
     __swsetup; # arm x86 mips
     __udivdi3; # arm x86 mips
     __umoddi3; # x86 mips
-    __wait4; # arm x86 mips nobrillo
+    __wait4; # arm x86 mips
     _fwalk; # arm x86 mips
     android_getaddrinfofornet;
     android_getaddrinfofornetcontext;
     android_gethostbyaddrfornet;
     android_gethostbynamefornet;
-    arc4random_addrandom; # arm x86 mips nobrillo
-    arc4random_stir; # arm x86 mips nobrillo
-    bcopy; # arm x86 mips nobrillo
-    bzero; # arm x86 mips nobrillo
-    dlmalloc; # arm x86 mips nobrillo
-    dlmalloc_inspect_all; # arm x86 mips nobrillo
-    dlmalloc_trim; # arm x86 mips nobrillo
-    dlmalloc_usable_size; # arm x86 mips nobrillo
-    fdprintf; # arm x86 mips nobrillo
+    arc4random_addrandom; # arm x86 mips
+    arc4random_stir; # arm x86 mips
+    bcopy; # arm x86 mips
+    bzero; # arm x86 mips
+    dlmalloc; # arm x86 mips
+    dlmalloc_inspect_all; # arm x86 mips
+    dlmalloc_trim; # arm x86 mips
+    dlmalloc_usable_size; # arm x86 mips
+    fdprintf; # arm x86 mips
     free_malloc_leak_info;
-    ftime; # arm x86 mips nobrillo
+    ftime; # arm x86 mips
     get_malloc_leak_info;
-    getdents; # arm x86 mips nobrillo
-    getdtablesize; # arm x86 mips nobrillo
+    getdents; # arm x86 mips
+    getdtablesize; # arm x86 mips
     gMallocLeakZygoteChild;
-    index; # arm x86 mips nobrillo
-    issetugid; # arm x86 mips nobrillo
-    memswap; # arm x86 mips nobrillo
-    pthread_attr_getstackaddr; # arm x86 mips nobrillo
-    pthread_attr_setstackaddr; # arm x86 mips nobrillo
+    index; # arm x86 mips
+    issetugid; # arm x86 mips
+    memswap; # arm x86 mips
+    pthread_attr_getstackaddr; # arm x86 mips
+    pthread_attr_setstackaddr; # arm x86 mips
     SHA1Final; # arm x86 mips
     SHA1Init; # arm x86 mips
     SHA1Transform; # arm x86 mips
     SHA1Update; # arm x86 mips
-    strntoimax; # arm x86 mips nobrillo
-    strntoumax; # arm x86 mips nobrillo
-    strtotimeval; # arm x86 mips nobrillo
-    sysv_signal; # arm x86 mips nobrillo
-    tkill; # arm x86 mips nobrillo
-    vfdprintf; # arm x86 mips nobrillo
-    wait3; # arm x86 mips nobrillo
-    wcswcs; # arm x86 mips nobrillo
+    strntoimax; # arm x86 mips
+    strntoumax; # arm x86 mips
+    strtotimeval; # arm x86 mips
+    sysv_signal; # arm x86 mips
+    tkill; # arm x86 mips
+    vfdprintf; # arm x86 mips
+    wait3; # arm x86 mips
+    wcswcs; # arm x86 mips
 } LIBC_O;
 
 LIBC_PLATFORM {
diff --git a/libc/stdio/snprintf.c b/libc/stdio/snprintf.c
deleted file mode 100644
index 9a25ef2..0000000
--- a/libc/stdio/snprintf.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*	$OpenBSD: snprintf.c,v 1.14 2005/10/10 12:00:52 espie Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#undef _FORTIFY_SOURCE
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include "local.h"
-
-int
-snprintf(char *str, size_t n, const char *fmt, ...)
-{
-	va_list ap;
-	int ret;
-	char dummy;
-	FILE f;
-	struct __sfileext fext;
-
-	/* While snprintf(3) specifies size_t stdio uses an int internally */
-	if (n > INT_MAX)
-		n = INT_MAX;
-	/* Stdio internals do not deal correctly with zero length buffer */
-	if (n == 0) {
-		str = &dummy;
-		n = 1;
-	}
-	_FILEEXT_SETUP(&f, &fext);
-	f._file = -1;
-	f._flags = __SWR | __SSTR;
-	f._bf._base = f._p = (unsigned char *)str;
-	f._bf._size = f._w = n - 1;
-	va_start(ap, fmt);
-	ret = __vfprintf(&f, fmt, ap);
-	va_end(ap);
-	*f._p = '\0';
-	return (ret);
-}
diff --git a/libc/stdio/sprintf.c b/libc/stdio/sprintf.c
deleted file mode 100644
index 1245552..0000000
--- a/libc/stdio/sprintf.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*	$OpenBSD: sprintf.c,v 1.13 2005/10/10 12:00:52 espie Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#undef _FORTIFY_SOURCE
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <limits.h>
-#include "local.h"
-
-#if defined(APIWARN)
-__warn_references(sprintf,
-    "warning: sprintf() is often misused, please use snprintf()");
-#endif
-
-int
-sprintf(char *str, const char *fmt, ...)
-{
-	int ret;
-	va_list ap;
-	FILE f;
-	struct __sfileext fext;
-
-	_FILEEXT_SETUP(&f, &fext);
-	f._file = -1;
-	f._flags = __SWR | __SSTR;
-	f._bf._base = f._p = (unsigned char *)str;
-	f._bf._size = f._w = INT_MAX;
-	va_start(ap, fmt);
-	ret = __vfprintf(&f, fmt, ap);
-	va_end(ap);
-	*f._p = '\0';
-	return (ret);
-}
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index 23a54de..b709b40 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -31,6 +31,7 @@
  * SUCH DAMAGE.
  */
 
+#define __BIONIC_NO_STDIO_FORTIFY
 #include <stdio.h>
 
 #include <errno.h>
@@ -45,6 +46,7 @@
 
 #include "local.h"
 #include "glue.h"
+#include "private/bionic_fortify.h"
 #include "private/ErrnoRestorer.h"
 #include "private/thread_private.h"
 
@@ -643,6 +645,10 @@
   return fp;
 }
 
+int asprintf(char** s, const char* fmt, ...) {
+  PRINTF_IMPL(vasprintf(s, fmt, ap));
+}
+
 char* ctermid(char* s) {
   return s ? strcpy(s, _PATH_TTY) : const_cast<char*>(_PATH_TTY);
 }
@@ -769,6 +775,18 @@
   return setvbuf(fp, nullptr, _IOLBF, 0);
 }
 
+int snprintf(char* s, size_t n, const char* fmt, ...) {
+  PRINTF_IMPL(vsnprintf(s, n, fmt, ap));
+}
+
+int sprintf(char* s, const char* fmt, ...) {
+  PRINTF_IMPL(vsprintf(s, fmt, ap));
+}
+
+int sscanf(const char* s, const char* fmt, ...) {
+  PRINTF_IMPL(vsscanf(s, fmt, ap));
+}
+
 int swprintf(wchar_t* s, size_t n, const wchar_t* fmt, ...) {
   PRINTF_IMPL(vswprintf(s, n, fmt, ap));
 }
@@ -785,6 +803,36 @@
   return vfscanf(stdin, fmt, ap);
 }
 
+int vsnprintf(char* s, size_t n, const char* fmt, va_list ap) {
+  // stdio internals use int rather than size_t.
+  static_assert(INT_MAX <= SSIZE_MAX, "SSIZE_MAX too large to fit in int");
+
+  __check_count("vsnprintf", "size", n);
+
+  // Stdio internals do not deal correctly with zero length buffer.
+  char dummy;
+  if (n == 0) {
+    s = &dummy;
+    n = 1;
+  }
+
+  FILE f;
+  __sfileext fext;
+  _FILEEXT_SETUP(&f, &fext);
+  f._file = -1;
+  f._flags = __SWR | __SSTR;
+  f._bf._base = f._p = reinterpret_cast<unsigned char*>(s);
+  f._bf._size = f._w = n - 1;
+
+  int result = __vfprintf(&f, fmt, ap);
+  *f._p = '\0';
+  return result;
+}
+
+int vsprintf(char* s, const char* fmt, va_list ap) {
+  return vsnprintf(s, SSIZE_MAX, fmt, ap);
+}
+
 int vwprintf(const wchar_t* fmt, va_list ap) {
   return vfwprintf(stdout, fmt, ap);
 }
diff --git a/libc/tools/genversion-scripts.py b/libc/tools/genversion-scripts.py
index 53f4db4..0a98994 100755
--- a/libc/tools/genversion-scripts.py
+++ b/libc/tools/genversion-scripts.py
@@ -37,8 +37,6 @@
   for arch in all_arches:
     if arch in tags:
       return True
-  if 'nobrillo' in tags:
-    return True
   return False
 
 
@@ -49,28 +47,21 @@
       basename = os.path.basename(script)
       dirname = os.path.dirname(script)
       for arch in all_arches:
-        for brillo in [False, True]:
-          has_nobrillo = False
-          name = basename.split(".")[0] + "." + arch + (".brillo" if brillo else "") + ".map"
-          tmp_path = os.path.join(bionic_temp, name)
-          dest_path = os.path.join(dirname, name)
-          with open(tmp_path, "w") as fout:
-            with open(script, "r") as fin:
-              fout.write("# %s\n" % warning)
-              for line in fin:
-                index = line.find("#")
-                if index != -1:
-                  tags = line[index+1:].split()
-                  if arch not in tags and has_arch_tags(tags):
-                    continue
-                  if brillo and "nobrillo" in tags:
-                    has_nobrillo = True
-                    continue
-                fout.write(line)
-          if not brillo or has_nobrillo:
-            shutil.copyfile(tmp_path, dest_path)
+        name = basename.split(".")[0] + "." + arch + ".map"
+        tmp_path = os.path.join(bionic_temp, name)
+        dest_path = os.path.join(dirname, name)
+        with open(tmp_path, "w") as fout:
+          with open(script, "r") as fin:
+            fout.write("# %s\n" % warning)
+            for line in fin:
+              index = line.find("#")
+              if index != -1:
+                tags = line[index+1:].split()
+                if arch not in tags and has_arch_tags(tags):
+                  continue
+              fout.write(line)
+        shutil.copyfile(tmp_path, dest_path)
 
 
 generator = VersionScriptGenerator()
 generator.run()
-
diff --git a/libc/upstream-openbsd/lib/libc/stdio/asprintf.c b/libc/upstream-openbsd/lib/libc/stdio/asprintf.c
deleted file mode 100644
index 4823677..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/asprintf.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*	$OpenBSD: asprintf.c,v 1.22 2015/12/28 22:08:18 mmcc Exp $	*/
-
-/*
- * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <stdarg.h>
-#include "local.h"
-
-int
-asprintf(char **str, const char *fmt, ...)
-{
-	int ret;
-	va_list ap;
-	FILE f;
-	struct __sfileext fext;
-	unsigned char *_base;
-
-	_FILEEXT_SETUP(&f, &fext);
-	f._file = -1;
-	f._flags = __SWR | __SSTR | __SALC;
-	f._bf._base = f._p = malloc(128);
-	if (f._bf._base == NULL)
-		goto err;
-	f._bf._size = f._w = 127;		/* Leave room for the NUL */
-	va_start(ap, fmt);
-	ret = __vfprintf(&f, fmt, ap);
-	va_end(ap);
-	if (ret == -1)
-		goto err;
-	*f._p = '\0';
-	_base = realloc(f._bf._base, ret + 1);
-	if (_base == NULL)
-		goto err;
-	*str = (char *)_base;
-	return (ret);
-
-err:
-	free(f._bf._base);
-	f._bf._base = NULL;
-	*str = NULL;
-	errno = ENOMEM;
-	return (-1);
-}
-DEF_WEAK(asprintf);
diff --git a/libc/upstream-openbsd/lib/libc/stdio/putw.c b/libc/upstream-openbsd/lib/libc/stdio/putw.c
deleted file mode 100644
index 47941a4..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/putw.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*	$OpenBSD: putw.c,v 1.10 2009/11/21 09:53:44 guenther Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include "local.h"
-#include "fvwrite.h"
-
-int
-putw(int w, FILE *fp)
-{
-	struct __suio uio;
-	struct __siov iov;
-	int ret;
-
-	iov.iov_base = &w;
-	iov.iov_len = uio.uio_resid = sizeof(w);
-	uio.uio_iov = &iov;
-	uio.uio_iovcnt = 1;
-	FLOCKFILE(fp);
-	_SET_ORIENTATION(fp, -1);
-	ret = __sfvwrite(fp, &uio);
-	FUNLOCKFILE(fp);
-	return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/sscanf.c b/libc/upstream-openbsd/lib/libc/stdio/sscanf.c
deleted file mode 100644
index e371ca6..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/sscanf.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*	$OpenBSD: sscanf.c,v 1.14 2011/11/08 18:30:42 guenther Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include "local.h"
-
-/* ARGSUSED */
-static int
-eofread(void *cookie, char *buf, int len)
-{
-
-	return (0);
-}
-
-/* SCANFLIKE2 */
-int
-sscanf(const char *str, const char *fmt, ...)
-{
-	int ret;
-	va_list ap;
-	FILE f;
-	struct __sfileext fext;
-
-	_FILEEXT_SETUP(&f, &fext);
-	f._flags = __SRD;
-	f._bf._base = f._p = (unsigned char *)str;
-	f._bf._size = f._r = strlen(str);
-	f._read = eofread;
-	f._lb._base = NULL;
-	va_start(ap, fmt);
-	ret = __svfscanf(&f, fmt, ap);
-	va_end(ap);
-	return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/vsnprintf.c b/libc/upstream-openbsd/lib/libc/stdio/vsnprintf.c
deleted file mode 100644
index 8b1a088..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/vsnprintf.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*	$OpenBSD: vsnprintf.c,v 1.15 2009/11/09 00:18:28 kurt Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include "local.h"
-
-int
-vsnprintf(char *str, size_t n, const char *fmt, __va_list ap)
-{
-	int ret;
-	char dummy;
-	FILE f;
-	struct __sfileext fext;
-
-	_FILEEXT_SETUP(&f, &fext);
-
-	/* While snprintf(3) specifies size_t stdio uses an int internally */
-	if (n > INT_MAX)
-		n = INT_MAX;
-	/* Stdio internals do not deal correctly with zero length buffer */
-	if (n == 0) {
-		str = &dummy;
-		n = 1;
-	}
-	f._file = -1;
-	f._flags = __SWR | __SSTR;
-	f._bf._base = f._p = (unsigned char *)str;
-	f._bf._size = f._w = n - 1;
-	ret = __vfprintf(&f, fmt, ap);
-	*f._p = '\0';
-	return (ret);
-}
diff --git a/libc/upstream-openbsd/lib/libc/stdio/vsprintf.c b/libc/upstream-openbsd/lib/libc/stdio/vsprintf.c
deleted file mode 100644
index 308ff37..0000000
--- a/libc/upstream-openbsd/lib/libc/stdio/vsprintf.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*	$OpenBSD: vsprintf.c,v 1.16 2009/11/09 00:18:28 kurt Exp $ */
-/*-
- * Copyright (c) 1990, 1993
- *	The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <limits.h>
-#include "local.h"
-
-#if defined(APIWARN)
-__warn_references(vsprintf,
-    "warning: vsprintf() is often misused, please use vsnprintf()");
-#endif
-
-int
-vsprintf(char *str, const char *fmt, __va_list ap)
-{
-	int ret;
-	FILE f;
-	struct __sfileext fext;
-
-	_FILEEXT_SETUP(&f, &fext);
-	f._file = -1;
-	f._flags = __SWR | __SSTR;
-	f._bf._base = f._p = (unsigned char *)str;
-	f._bf._size = f._w = INT_MAX;
-	ret = __vfprintf(&f, fmt, ap);
-	*f._p = '\0';
-	return (ret);
-}
diff --git a/libdl/Android.bp b/libdl/Android.bp
index 84561d9..273a887 100644
--- a/libdl/Android.bp
+++ b/libdl/Android.bp
@@ -60,3 +60,9 @@
         never: true,
     },
 }
+
+ndk_library {
+    name: "libdl.ndk",
+    symbol_file: "libdl.map.txt",
+    first_version: "9",
+}
diff --git a/libdl/NOTICE b/libdl/NOTICE
index 77b5743..7940d04 100644
--- a/libdl/NOTICE
+++ b/libdl/NOTICE
@@ -14,3 +14,19 @@
 
 -------------------------------------------------------------------
 
+Copyright (C) 2015 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-------------------------------------------------------------------
+
diff --git a/libdl/libdl.c b/libdl/libdl.c
index b62ee5c..4cc4dea 100644
--- a/libdl/libdl.c
+++ b/libdl/libdl.c
@@ -25,7 +25,7 @@
 
 void* dlopen(const char* filename __unused, int flag __unused) { return 0; }
 
-const char* dlerror(void) { return 0; }
+char* dlerror(void) { return 0; }
 
 void* dlsym(void* handle __unused, const char* symbol __unused) { return 0; }
 
diff --git a/libstdc++/NOTICE b/libstdc++/NOTICE
index 492770d..e69de29 100644
--- a/libstdc++/NOTICE
+++ b/libstdc++/NOTICE
@@ -1,81 +0,0 @@
-Copyright (C) 2008 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in
-   the documentation and/or other materials provided with the
-   distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (C) 2009 The Android Open Source Project
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
- * Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in
-   the documentation and/or other materials provided with the
-   distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994
-Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation.  Hewlett-Packard Company makes no
-representations about the suitability of this software for any
-purpose.  It is provided "as is" without express or implied warranty.
-
-
-Copyright (c) 1996,1997
-Silicon Graphics Computer Systems, Inc.
-
-Permission to use, copy, modify, distribute and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation.  Silicon Graphics makes no
-representations about the suitability of this software for any
-purpose.  It is provided "as is" without express or implied warranty.
-
--------------------------------------------------------------------
-
diff --git a/linker/Android.bp b/linker/Android.bp
index a35eb45..39f1da9 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -20,11 +20,14 @@
         "linker_block_allocator.cpp",
         "linker_dlwarning.cpp",
         "linker_gdb_support.cpp",
+        "linker_globals.cpp",
         "linker_libc_support.c",
+        "linker_namespaces.cpp",
         "linker_logger.cpp",
         "linker_mapped_file_fragment.cpp",
         "linker_phdr.cpp",
         "linker_sdk_versions.cpp",
+        "linker_soinfo.cpp",
         "linker_utils.cpp",
         "rt.cpp",
     ],
diff --git a/linker/NOTICE b/linker/NOTICE
index 4bbd741..3ba0ff9 100644
--- a/linker/NOTICE
+++ b/linker/NOTICE
@@ -190,3 +190,31 @@
 
 -------------------------------------------------------------------
 
+Copyright (C) 2016 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+ * Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in
+   the documentation and/or other materials provided with the
+   distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index c03ffa8..3ac61d7 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -15,6 +15,7 @@
  */
 
 #include "linker.h"
+#include "linker_globals.h"
 #include "linker_dlwarning.h"
 
 #include <pthread.h>
@@ -32,10 +33,10 @@
 
 static pthread_mutex_t g_dl_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
 
-static const char* __bionic_set_dlerror(char* new_value) {
+static char* __bionic_set_dlerror(char* new_value) {
   char** dlerror_slot = &reinterpret_cast<char**>(__get_tls())[TLS_SLOT_DLERROR];
 
-  const char* old_value = *dlerror_slot;
+  char* old_value = *dlerror_slot;
   *dlerror_slot = new_value;
   return old_value;
 }
@@ -51,8 +52,8 @@
   __bionic_set_dlerror(buffer);
 }
 
-const char* dlerror() {
-  const char* old_value = __bionic_set_dlerror(nullptr);
+char* dlerror() {
+  char* old_value = __bionic_set_dlerror(nullptr);
   return old_value;
 }
 
@@ -261,8 +262,6 @@
 static uint8_t __libdl_info_buf[sizeof(soinfo)] __attribute__((aligned(8)));
 static soinfo* __libdl_info = nullptr;
 
-extern android_namespace_t g_default_namespace;
-
 // This is used by the dynamic linker. Every process gets these symbols for free.
 soinfo* get_libdl_info() {
   if (__libdl_info == nullptr) {
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 68b3a53..d2a6e7d 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -53,8 +53,10 @@
 #include "linker.h"
 #include "linker_block_allocator.h"
 #include "linker_gdb_support.h"
+#include "linker_globals.h"
 #include "linker_debug.h"
 #include "linker_dlwarning.h"
+#include "linker_namespaces.h"
 #include "linker_sleb128.h"
 #include "linker_phdr.h"
 #include "linker_relocs.h"
@@ -75,74 +77,6 @@
 #undef ELF_ST_TYPE
 #define ELF_ST_TYPE(x) (static_cast<uint32_t>(x) & 0xf)
 
-struct android_namespace_t {
- public:
-  android_namespace_t() : name_(nullptr), is_isolated_(false) {}
-
-  const char* get_name() const { return name_; }
-  void set_name(const char* name) { name_ = name; }
-
-  bool is_isolated() const { return is_isolated_; }
-  void set_isolated(bool isolated) { is_isolated_ = isolated; }
-
-  const std::vector<std::string>& get_ld_library_paths() const {
-    return ld_library_paths_;
-  }
-  void set_ld_library_paths(std::vector<std::string>&& library_paths) {
-    ld_library_paths_ = library_paths;
-  }
-
-  const std::vector<std::string>& get_default_library_paths() const {
-    return default_library_paths_;
-  }
-  void set_default_library_paths(std::vector<std::string>&& library_paths) {
-    default_library_paths_ = library_paths;
-  }
-
-  const std::vector<std::string>& get_permitted_paths() const {
-    return permitted_paths_;
-  }
-  void set_permitted_paths(std::vector<std::string>&& permitted_paths) {
-    permitted_paths_ = permitted_paths;
-  }
-
-  void add_soinfo(soinfo* si) {
-    soinfo_list_.push_back(si);
-  }
-
-  void add_soinfos(const soinfo::soinfo_list_t& soinfos) {
-    for (auto si : soinfos) {
-      add_soinfo(si);
-      si->add_secondary_namespace(this);
-    }
-  }
-
-  void remove_soinfo(soinfo* si) {
-    soinfo_list_.remove_if([&](soinfo* candidate) {
-      return si == candidate;
-    });
-  }
-
-  const soinfo::soinfo_list_t& soinfo_list() const { return soinfo_list_; }
-
-  // For isolated namespaces - checks if the file is on the search path;
-  // always returns true for not isolated namespace.
-  bool is_accessible(const std::string& path);
-
- private:
-  const char* name_;
-  bool is_isolated_;
-  std::vector<std::string> ld_library_paths_;
-  std::vector<std::string> default_library_paths_;
-  std::vector<std::string> permitted_paths_;
-  soinfo::soinfo_list_t soinfo_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(android_namespace_t);
-};
-
-android_namespace_t g_default_namespace;
-
-static std::unordered_map<uintptr_t, soinfo*> g_soinfo_handles_map;
 static android_namespace_t* g_anonymous_namespace = &g_default_namespace;
 
 static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf);
@@ -157,32 +91,35 @@
 static soinfo* sonext;
 static soinfo* somain; // main process, always the one after libdl_info
 
-static const char* const kDefaultLdPaths[] = {
 #if defined(__LP64__)
-  "/system/lib64",
-  "/vendor/lib64",
+static const char* const kSystemLibDir     = "/system/lib64";
+static const char* const kVendorLibDir     = "/vendor/lib64";
+static const char* const kAsanSystemLibDir = "/data/lib64";
+static const char* const kAsanVendorLibDir = "/data/vendor/lib64";
 #else
-  "/system/lib",
-  "/vendor/lib",
+static const char* const kSystemLibDir     = "/system/lib";
+static const char* const kVendorLibDir     = "/vendor/lib";
+static const char* const kAsanSystemLibDir = "/data/lib";
+static const char* const kAsanVendorLibDir = "/data/vendor/lib";
 #endif
+
+static const char* const kDefaultLdPaths[] = {
+  kSystemLibDir,
+  kVendorLibDir,
   nullptr
 };
 
 static const char* const kAsanDefaultLdPaths[] = {
-#if defined(__LP64__)
-  "/data/lib64",
-  "/system/lib64",
-  "/data/vendor/lib64",
-  "/vendor/lib64",
-#else
-  "/data/lib",
-  "/system/lib",
-  "/data/vendor/lib",
-  "/vendor/lib",
-#endif
+  kAsanSystemLibDir,
+  kSystemLibDir,
+  kAsanVendorLibDir,
+  kVendorLibDir,
   nullptr
 };
 
+// Is ASAN enabled?
+static bool g_is_asan = false;
+
 static bool is_system_library(const std::string& realpath) {
   for (const auto& dir : g_default_namespace.get_default_library_paths()) {
     if (file_is_in_dir(realpath, dir)) {
@@ -192,13 +129,16 @@
   return false;
 }
 
-#if defined(__LP64__)
-static const char* const kSystemLibDir = "/system/lib64";
-#else
-static const char* const kSystemLibDir = "/system/lib";
-#endif
+// Checks if the file exists and not a directory.
+static bool file_exists(const char* path) {
+  struct stat s;
 
-static std::string dirname(const char *path);
+  if (stat(path, &s) != 0) {
+    return false;
+  }
+
+  return S_ISREG(s.st_mode);
+}
 
 // TODO(dimitry): The grey-list is a workaround for http://b/26394120 ---
 // gradually remove libraries from this list until it is gone.
@@ -250,33 +190,17 @@
 }
 // END OF WORKAROUND
 
-static const ElfW(Versym) kVersymNotNeeded = 0;
-static const ElfW(Versym) kVersymGlobal = 1;
-
 static const char* const* g_default_ld_paths;
 static std::vector<std::string> g_ld_preload_names;
 
 static std::vector<soinfo*> g_ld_preloads;
 
 static bool g_public_namespace_initialized;
-static soinfo::soinfo_list_t g_public_namespace;
+static soinfo_list_t g_public_namespace;
 
 int g_ld_debug_verbosity;
 abort_msg_t* g_abort_message = nullptr; // For debuggerd.
 
-// These values are used to call constructors for .init_array && .preinit_array
-int g_argc = 0;
-char** g_argv = nullptr;
-char** g_envp = nullptr;
-
-static std::string dirname(const char *path) {
-  const char* last_slash = strrchr(path, '/');
-  if (last_slash == path) return "/";
-  else if (last_slash == nullptr) return ".";
-  else
-    return std::string(path, last_slash - path);
-}
-
 #if STATS
 struct linker_stats_t {
   int count[kRelocMax];
@@ -296,16 +220,6 @@
 uint32_t bitmask[4096];
 #endif
 
-static char __linker_dl_err_buf[768];
-
-char* linker_get_error_buffer() {
-  return &__linker_dl_err_buf[0];
-}
-
-size_t linker_get_error_buffer_size() {
-  return sizeof(__linker_dl_err_buf);
-}
-
 static void notify_gdb_of_load(soinfo* info) {
   if (info->is_linker() || info->is_main_executable()) {
     // gdb already knows about the linker and the main executable.
@@ -329,32 +243,6 @@
   notify_gdb_of_unload(&(info->link_map_head));
 }
 
-bool android_namespace_t::is_accessible(const std::string& file) {
-  if (!is_isolated_) {
-    return true;
-  }
-
-  for (const auto& dir : ld_library_paths_) {
-    if (file_is_in_dir(file, dir)) {
-      return true;
-    }
-  }
-
-  for (const auto& dir : default_library_paths_) {
-    if (file_is_in_dir(file, dir)) {
-      return true;
-    }
-  }
-
-  for (const auto& dir : permitted_paths_) {
-    if (file_is_under_dir(file, dir)) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
 LinkedListEntry<soinfo>* SoinfoListAllocator::alloc() {
   return g_soinfo_links_allocator.alloc();
 }
@@ -438,60 +326,6 @@
   g_soinfo_allocator.free(si);
 }
 
-// For every path element this function checks of it exists, and is a directory,
-// and normalizes it:
-// 1. For regular path it converts it to realpath()
-// 2. For path in a zip file it uses realpath on the zipfile
-//    normalizes entry name by calling normalize_path function.
-static void resolve_paths(std::vector<std::string>& paths,
-                          std::vector<std::string>* resolved_paths) {
-  resolved_paths->clear();
-  for (const auto& path : paths) {
-    char resolved_path[PATH_MAX];
-    const char* original_path = path.c_str();
-    if (realpath(original_path, resolved_path) != nullptr) {
-      struct stat s;
-      if (stat(resolved_path, &s) == 0) {
-        if (S_ISDIR(s.st_mode)) {
-          resolved_paths->push_back(resolved_path);
-        } else {
-          DL_WARN("Warning: \"%s\" is not a directory (excluding from path)", resolved_path);
-          continue;
-        }
-      } else {
-        DL_WARN("Warning: cannot stat file \"%s\": %s", resolved_path, strerror(errno));
-        continue;
-      }
-    } else {
-      std::string zip_path;
-      std::string entry_path;
-
-      std::string normalized_path;
-
-      if (!normalize_path(original_path, &normalized_path)) {
-        DL_WARN("Warning: unable to normalize \"%s\"", original_path);
-        continue;
-      }
-
-      if (parse_zip_path(normalized_path.c_str(), &zip_path, &entry_path)) {
-        if (realpath(zip_path.c_str(), resolved_path) == nullptr) {
-          DL_WARN("Warning: unable to resolve \"%s\": %s", zip_path.c_str(), strerror(errno));
-          continue;
-        }
-
-        resolved_paths->push_back(std::string(resolved_path) + kZipFileSeparator + entry_path);
-      }
-    }
-  }
-}
-
-static void split_path(const char* path, const char* delimiters,
-                       std::vector<std::string>* paths) {
-  if (path != nullptr && path[0] != 0) {
-    *paths = android::base::Split(path, delimiters);
-  }
-}
-
 static void parse_path(const char* path, const char* delimiters,
                        std::vector<std::string>* resolved_paths) {
   std::vector<std::string> paths;
@@ -505,45 +339,6 @@
   g_default_namespace.set_ld_library_paths(std::move(ld_libary_paths));
 }
 
-void soinfo::set_dt_runpath(const char* path) {
-  if (!has_min_version(3)) {
-    return;
-  }
-
-  std::vector<std::string> runpaths;
-
-  split_path(path, ":", &runpaths);
-
-  std::string origin = dirname(get_realpath());
-  // FIXME: add $LIB and $PLATFORM.
-  std::pair<std::string, std::string> substs[] = {{"ORIGIN", origin}};
-  for (auto&& s : runpaths) {
-    size_t pos = 0;
-    while (pos < s.size()) {
-      pos = s.find("$", pos);
-      if (pos == std::string::npos) break;
-      for (const auto& subst : substs) {
-        const std::string& token = subst.first;
-        const std::string& replacement = subst.second;
-        if (s.substr(pos + 1, token.size()) == token) {
-          s.replace(pos, token.size() + 1, replacement);
-          // -1 to compensate for the ++pos below.
-          pos += replacement.size() - 1;
-          break;
-        } else if (s.substr(pos + 1, token.size() + 2) == "{" + token + "}") {
-          s.replace(pos, token.size() + 3, replacement);
-          pos += replacement.size() - 1;
-          break;
-        }
-      }
-      // Skip $ in case it did not match any of the known substitutions.
-      ++pos;
-    }
-  }
-
-  resolve_paths(runpaths, &dt_runpath_);
-}
-
 static void parse_LD_PRELOAD(const char* path) {
   g_ld_preload_names.clear();
   if (path != nullptr) {
@@ -610,336 +405,10 @@
   return rv;
 }
 
-const ElfW(Versym)* soinfo::get_versym(size_t n) const {
-  if (has_min_version(2) && versym_ != nullptr) {
-    return versym_ + n;
-  }
-
-  return nullptr;
-}
-
-ElfW(Addr) soinfo::get_verneed_ptr() const {
-  if (has_min_version(2)) {
-    return verneed_ptr_;
-  }
-
-  return 0;
-}
-
-size_t soinfo::get_verneed_cnt() const {
-  if (has_min_version(2)) {
-    return verneed_cnt_;
-  }
-
-  return 0;
-}
-
-ElfW(Addr) soinfo::get_verdef_ptr() const {
-  if (has_min_version(2)) {
-    return verdef_ptr_;
-  }
-
-  return 0;
-}
-
-size_t soinfo::get_verdef_cnt() const {
-  if (has_min_version(2)) {
-    return verdef_cnt_;
-  }
-
-  return 0;
-}
-
-template<typename F>
-static bool for_each_verdef(const soinfo* si, F functor) {
-  if (!si->has_min_version(2)) {
-    return true;
-  }
-
-  uintptr_t verdef_ptr = si->get_verdef_ptr();
-  if (verdef_ptr == 0) {
-    return true;
-  }
-
-  size_t offset = 0;
-
-  size_t verdef_cnt = si->get_verdef_cnt();
-  for (size_t i = 0; i<verdef_cnt; ++i) {
-    const ElfW(Verdef)* verdef = reinterpret_cast<ElfW(Verdef)*>(verdef_ptr + offset);
-    size_t verdaux_offset = offset + verdef->vd_aux;
-    offset += verdef->vd_next;
-
-    if (verdef->vd_version != 1) {
-      DL_ERR("unsupported verdef[%zd] vd_version: %d (expected 1) library: %s",
-          i, verdef->vd_version, si->get_realpath());
-      return false;
-    }
-
-    if ((verdef->vd_flags & VER_FLG_BASE) != 0) {
-      // "this is the version of the file itself.  It must not be used for
-      //  matching a symbol. It can be used to match references."
-      //
-      // http://www.akkadia.org/drepper/symbol-versioning
-      continue;
-    }
-
-    if (verdef->vd_cnt == 0) {
-      DL_ERR("invalid verdef[%zd] vd_cnt == 0 (version without a name)", i);
-      return false;
-    }
-
-    const ElfW(Verdaux)* verdaux = reinterpret_cast<ElfW(Verdaux)*>(verdef_ptr + verdaux_offset);
-
-    if (functor(i, verdef, verdaux) == true) {
-      break;
-    }
-  }
-
-  return true;
-}
-
-bool soinfo::find_verdef_version_index(const version_info* vi, ElfW(Versym)* versym) const {
-  if (vi == nullptr) {
-    *versym = kVersymNotNeeded;
-    return true;
-  }
-
-  *versym = kVersymGlobal;
-
-  return for_each_verdef(this,
-    [&](size_t, const ElfW(Verdef)* verdef, const ElfW(Verdaux)* verdaux) {
-      if (verdef->vd_hash == vi->elf_hash &&
-          strcmp(vi->name, get_string(verdaux->vda_name)) == 0) {
-        *versym = verdef->vd_ndx;
-        return true;
-      }
-
-      return false;
-    }
-  );
-}
-
-bool soinfo::find_symbol_by_name(SymbolName& symbol_name,
-                                 const version_info* vi,
-                                 const ElfW(Sym)** symbol) const {
-  uint32_t symbol_index;
-  bool success =
-      is_gnu_hash() ?
-      gnu_lookup(symbol_name, vi, &symbol_index) :
-      elf_lookup(symbol_name, vi, &symbol_index);
-
-  if (success) {
-    *symbol = symbol_index == 0 ? nullptr : symtab_ + symbol_index;
-  }
-
-  return success;
-}
-
-static bool is_symbol_global_and_defined(const soinfo* si, const ElfW(Sym)* s) {
-  if (ELF_ST_BIND(s->st_info) == STB_GLOBAL ||
-      ELF_ST_BIND(s->st_info) == STB_WEAK) {
-    return s->st_shndx != SHN_UNDEF;
-  } else if (ELF_ST_BIND(s->st_info) != STB_LOCAL) {
-    DL_WARN("unexpected ST_BIND value: %d for \"%s\" in \"%s\"",
-            ELF_ST_BIND(s->st_info), si->get_string(s->st_name), si->get_realpath());
-  }
-
-  return false;
-}
-
-static const ElfW(Versym) kVersymHiddenBit = 0x8000;
-
-static inline bool is_versym_hidden(const ElfW(Versym)* versym) {
-  // the symbol is hidden if bit 15 of versym is set.
-  return versym != nullptr && (*versym & kVersymHiddenBit) != 0;
-}
-
-static inline bool check_symbol_version(const ElfW(Versym) verneed,
-                                        const ElfW(Versym)* verdef) {
-  return verneed == kVersymNotNeeded ||
-      verdef == nullptr ||
-      verneed == (*verdef & ~kVersymHiddenBit);
-}
-
-bool soinfo::gnu_lookup(SymbolName& symbol_name,
-                        const version_info* vi,
-                        uint32_t* symbol_index) const {
-  uint32_t hash = symbol_name.gnu_hash();
-  uint32_t h2 = hash >> gnu_shift2_;
-
-  uint32_t bloom_mask_bits = sizeof(ElfW(Addr))*8;
-  uint32_t word_num = (hash / bloom_mask_bits) & gnu_maskwords_;
-  ElfW(Addr) bloom_word = gnu_bloom_filter_[word_num];
-
-  *symbol_index = 0;
-
-  TRACE_TYPE(LOOKUP, "SEARCH %s in %s@%p (gnu)",
-      symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(base));
-
-  // test against bloom filter
-  if ((1 & (bloom_word >> (hash % bloom_mask_bits)) & (bloom_word >> (h2 % bloom_mask_bits))) == 0) {
-    TRACE_TYPE(LOOKUP, "NOT FOUND %s in %s@%p",
-        symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(base));
-
-    return true;
-  }
-
-  // bloom test says "probably yes"...
-  uint32_t n = gnu_bucket_[hash % gnu_nbucket_];
-
-  if (n == 0) {
-    TRACE_TYPE(LOOKUP, "NOT FOUND %s in %s@%p",
-        symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(base));
-
-    return true;
-  }
-
-  // lookup versym for the version definition in this library
-  // note the difference between "version is not requested" (vi == nullptr)
-  // and "version not found". In the first case verneed is kVersymNotNeeded
-  // which implies that the default version can be accepted; the second case results in
-  // verneed = 1 (kVersymGlobal) and implies that we should ignore versioned symbols
-  // for this library and consider only *global* ones.
-  ElfW(Versym) verneed = 0;
-  if (!find_verdef_version_index(vi, &verneed)) {
-    return false;
-  }
-
-  do {
-    ElfW(Sym)* s = symtab_ + n;
-    const ElfW(Versym)* verdef = get_versym(n);
-    // skip hidden versions when verneed == kVersymNotNeeded (0)
-    if (verneed == kVersymNotNeeded && is_versym_hidden(verdef)) {
-        continue;
-    }
-    if (((gnu_chain_[n] ^ hash) >> 1) == 0 &&
-        check_symbol_version(verneed, verdef) &&
-        strcmp(get_string(s->st_name), symbol_name.get_name()) == 0 &&
-        is_symbol_global_and_defined(this, s)) {
-      TRACE_TYPE(LOOKUP, "FOUND %s in %s (%p) %zd",
-          symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(s->st_value),
-          static_cast<size_t>(s->st_size));
-      *symbol_index = n;
-      return true;
-    }
-  } while ((gnu_chain_[n++] & 1) == 0);
-
-  TRACE_TYPE(LOOKUP, "NOT FOUND %s in %s@%p",
-             symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(base));
-
-  return true;
-}
-
-bool soinfo::elf_lookup(SymbolName& symbol_name,
-                        const version_info* vi,
-                        uint32_t* symbol_index) const {
-  uint32_t hash = symbol_name.elf_hash();
-
-  TRACE_TYPE(LOOKUP, "SEARCH %s in %s@%p h=%x(elf) %zd",
-             symbol_name.get_name(), get_realpath(),
-             reinterpret_cast<void*>(base), hash, hash % nbucket_);
-
-  ElfW(Versym) verneed = 0;
-  if (!find_verdef_version_index(vi, &verneed)) {
-    return false;
-  }
-
-  for (uint32_t n = bucket_[hash % nbucket_]; n != 0; n = chain_[n]) {
-    ElfW(Sym)* s = symtab_ + n;
-    const ElfW(Versym)* verdef = get_versym(n);
-
-    // skip hidden versions when verneed == 0
-    if (verneed == kVersymNotNeeded && is_versym_hidden(verdef)) {
-        continue;
-    }
-
-    if (check_symbol_version(verneed, verdef) &&
-        strcmp(get_string(s->st_name), symbol_name.get_name()) == 0 &&
-        is_symbol_global_and_defined(this, s)) {
-      TRACE_TYPE(LOOKUP, "FOUND %s in %s (%p) %zd",
-                 symbol_name.get_name(), get_realpath(),
-                 reinterpret_cast<void*>(s->st_value),
-                 static_cast<size_t>(s->st_size));
-      *symbol_index = n;
-      return true;
-    }
-  }
-
-  TRACE_TYPE(LOOKUP, "NOT FOUND %s in %s@%p %x %zd",
-             symbol_name.get_name(), get_realpath(),
-             reinterpret_cast<void*>(base), hash, hash % nbucket_);
-
-  *symbol_index = 0;
-  return true;
-}
-
-soinfo::soinfo(android_namespace_t* ns, const char* realpath,
-               const struct stat* file_stat, off64_t file_offset,
-               int rtld_flags) {
-  memset(this, 0, sizeof(*this));
-
-  if (realpath != nullptr) {
-    realpath_ = realpath;
-  }
-
-  flags_ = FLAG_NEW_SOINFO;
-  version_ = SOINFO_VERSION;
-
-  if (file_stat != nullptr) {
-    this->st_dev_ = file_stat->st_dev;
-    this->st_ino_ = file_stat->st_ino;
-    this->file_offset_ = file_offset;
-  }
-
-  this->rtld_flags_ = rtld_flags;
-  this->primary_namespace_ = ns;
-}
-
-soinfo::~soinfo() {
-  g_soinfo_handles_map.erase(handle_);
-}
-
-static uint32_t calculate_elf_hash(const char* name) {
-  const uint8_t* name_bytes = reinterpret_cast<const uint8_t*>(name);
-  uint32_t h = 0, g;
-
-  while (*name_bytes) {
-    h = (h << 4) + *name_bytes++;
-    g = h & 0xf0000000;
-    h ^= g;
-    h ^= g >> 24;
-  }
-
-  return h;
-}
-
-uint32_t SymbolName::elf_hash() {
-  if (!has_elf_hash_) {
-    elf_hash_ = calculate_elf_hash(name_);
-    has_elf_hash_ = true;
-  }
-
-  return elf_hash_;
-}
-
-uint32_t SymbolName::gnu_hash() {
-  if (!has_gnu_hash_) {
-    uint32_t h = 5381;
-    const uint8_t* name = reinterpret_cast<const uint8_t*>(name_);
-    while (*name != 0) {
-      h += (h << 5) + *name++; // h*33 + c = h + h * 32 + c = h + h << 5 + c
-    }
-
-    gnu_hash_ =  h;
-    has_gnu_hash_ = true;
-  }
-
-  return gnu_hash_;
-}
 
 bool soinfo_do_lookup(soinfo* si_from, const char* name, const version_info* vi,
-                      soinfo** si_found_in, const soinfo::soinfo_list_t& global_group,
-                      const soinfo::soinfo_list_t& local_group, const ElfW(Sym)** symbol) {
+                      soinfo** si_found_in, const soinfo_list_t& global_group,
+                      const soinfo_list_t& local_group, const ElfW(Sym)** symbol) {
   SymbolName symbol_name(name);
   const ElfW(Sym)* s = nullptr;
 
@@ -1394,52 +863,6 @@
   return nullptr;
 }
 
-ElfW(Sym)* soinfo::find_symbol_by_address(const void* addr) {
-  return is_gnu_hash() ? gnu_addr_lookup(addr) : elf_addr_lookup(addr);
-}
-
-static bool symbol_matches_soaddr(const ElfW(Sym)* sym, ElfW(Addr) soaddr) {
-  return sym->st_shndx != SHN_UNDEF &&
-      soaddr >= sym->st_value &&
-      soaddr < sym->st_value + sym->st_size;
-}
-
-ElfW(Sym)* soinfo::gnu_addr_lookup(const void* addr) {
-  ElfW(Addr) soaddr = reinterpret_cast<ElfW(Addr)>(addr) - load_bias;
-
-  for (size_t i = 0; i < gnu_nbucket_; ++i) {
-    uint32_t n = gnu_bucket_[i];
-
-    if (n == 0) {
-      continue;
-    }
-
-    do {
-      ElfW(Sym)* sym = symtab_ + n;
-      if (symbol_matches_soaddr(sym, soaddr)) {
-        return sym;
-      }
-    } while ((gnu_chain_[n++] & 1) == 0);
-  }
-
-  return nullptr;
-}
-
-ElfW(Sym)* soinfo::elf_addr_lookup(const void* addr) {
-  ElfW(Addr) soaddr = reinterpret_cast<ElfW(Addr)>(addr) - load_bias;
-
-  // Search the library's symbol table for any defined symbol which
-  // contains this address.
-  for (size_t i = 0; i < nchain_; ++i) {
-    ElfW(Sym)* sym = symtab_ + i;
-    if (symbol_matches_soaddr(sym, soaddr)) {
-      return sym;
-    }
-  }
-
-  return nullptr;
-}
-
 class ZipArchiveCache {
  public:
   ZipArchiveCache() {}
@@ -1954,8 +1377,8 @@
 //
 // This group consists of the main executable, LD_PRELOADs
 // and libraries with the DF_1_GLOBAL flag set.
-static soinfo::soinfo_list_t make_global_group(android_namespace_t* ns) {
-  soinfo::soinfo_list_t global_group;
+static soinfo_list_t make_global_group(android_namespace_t* ns) {
+  soinfo_list_t global_group;
   ns->soinfo_list().for_each([&](soinfo* si) {
     if ((si->get_dt_flags_1() & DF_1_GLOBAL) != 0) {
       global_group.push_back(si);
@@ -1970,12 +1393,12 @@
 // group (see make_global_group). For all others this is a group
 // of RTLD_GLOBAL libraries (which includes the global group from
 // the default namespace).
-static soinfo::soinfo_list_t get_shared_group(android_namespace_t* ns) {
+static soinfo_list_t get_shared_group(android_namespace_t* ns) {
   if (ns == &g_default_namespace) {
     return make_global_group(ns);
   }
 
-  soinfo::soinfo_list_t shared_group;
+  soinfo_list_t shared_group;
   ns->soinfo_list().for_each([&](soinfo* si) {
     if ((si->get_rtld_flags() & RTLD_GLOBAL) != 0) {
       shared_group.push_back(si);
@@ -2015,7 +1438,7 @@
   }
 
   // Construct global_group.
-  soinfo::soinfo_list_t global_group = make_global_group(ns);
+  soinfo_list_t global_group = make_global_group(ns);
 
   // If soinfos array is null allocate one on stack.
   // The array is needed in case of failure; for example
@@ -2122,7 +1545,7 @@
 
 
   // Step 5: link libraries.
-  soinfo::soinfo_list_t local_group;
+  soinfo_list_t local_group;
   walk_dependencies_tree(
       (start_with != nullptr && add_as_children) ? &start_with : soinfos,
       (start_with != nullptr && add_as_children) ? 1 : soinfos_count,
@@ -2202,7 +1625,7 @@
     return;
   }
 
-  soinfo::soinfo_list_t unload_list;
+  soinfo_list_t unload_list;
   for (size_t i = 0; i < count; ++i) {
     soinfo* si = soinfos[i];
 
@@ -2225,8 +1648,8 @@
   // linked. This is why we can safely use the first one.
   soinfo* root = soinfos[0];
 
-  soinfo::soinfo_list_t local_unload_list;
-  soinfo::soinfo_list_t external_unload_list;
+  soinfo_list_t local_unload_list;
+  soinfo_list_t external_unload_list;
   soinfo* si = nullptr;
 
   while ((si = unload_list.pop_front()) != nullptr) {
@@ -2413,8 +1836,27 @@
     }
   }
 
+  std::string asan_name_holder;
+
+  const char* translated_name = name;
+  if (g_is_asan) {
+    if (file_is_in_dir(name, kSystemLibDir)) {
+      asan_name_holder = std::string(kAsanSystemLibDir) + "/" + basename(name);
+      if (file_exists(asan_name_holder.c_str())) {
+        translated_name = asan_name_holder.c_str();
+        PRINT("linker_asan dlopen translating \"%s\" -> \"%s\"", name, translated_name);
+      }
+    } else if (file_is_in_dir(name, kVendorLibDir)) {
+      asan_name_holder = std::string(kAsanVendorLibDir) + "/" + basename(name);
+      if (file_exists(asan_name_holder.c_str())) {
+        translated_name = asan_name_holder.c_str();
+        PRINT("linker_asan dlopen translating \"%s\" -> \"%s\"", name, translated_name);
+      }
+    }
+  }
+
   ProtectedDataGuard guard;
-  soinfo* si = find_library(ns, name, flags, extinfo, caller);
+  soinfo* si = find_library(ns, translated_name, flags, extinfo, caller);
   if (si != nullptr) {
     failure_guard.disable();
     si->call_constructors();
@@ -2584,6 +2026,13 @@
   return true;
 }
 
+static void add_soinfos_to_namespace(const soinfo_list_t& soinfos, android_namespace_t* ns) {
+  ns->add_soinfos(soinfos);
+  for (auto si : soinfos) {
+    si->add_secondary_namespace(ns);
+  }
+}
+
 android_namespace_t* create_namespace(const void* caller_addr,
                                       const char* name,
                                       const char* ld_library_path,
@@ -2623,16 +2072,16 @@
 
   if ((type & ANDROID_NAMESPACE_TYPE_SHARED) != 0) {
     // If shared - clone the parent namespace
-    ns->add_soinfos(parent_namespace->soinfo_list());
+    add_soinfos_to_namespace(parent_namespace->soinfo_list(), ns);
   } else {
     // If not shared - copy only the shared group
-    ns->add_soinfos(get_shared_group(parent_namespace));
+    add_soinfos_to_namespace(get_shared_group(parent_namespace), ns);
   }
 
   return ns;
 }
 
-static ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr) {
+ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr) {
   typedef ElfW(Addr) (*ifunc_resolver_t)(void);
   ifunc_resolver_t ifunc_resolver = reinterpret_cast<ifunc_resolver_t>(resolver_addr);
   ElfW(Addr) ifunc_addr = ifunc_resolver();
@@ -2711,6 +2160,75 @@
   return true;
 }
 
+template <typename F>
+static bool for_each_verdef(const soinfo* si, F functor) {
+  if (!si->has_min_version(2)) {
+    return true;
+  }
+
+  uintptr_t verdef_ptr = si->get_verdef_ptr();
+  if (verdef_ptr == 0) {
+    return true;
+  }
+
+  size_t offset = 0;
+
+  size_t verdef_cnt = si->get_verdef_cnt();
+  for (size_t i = 0; i<verdef_cnt; ++i) {
+    const ElfW(Verdef)* verdef = reinterpret_cast<ElfW(Verdef)*>(verdef_ptr + offset);
+    size_t verdaux_offset = offset + verdef->vd_aux;
+    offset += verdef->vd_next;
+
+    if (verdef->vd_version != 1) {
+      DL_ERR("unsupported verdef[%zd] vd_version: %d (expected 1) library: %s",
+          i, verdef->vd_version, si->get_realpath());
+      return false;
+    }
+
+    if ((verdef->vd_flags & VER_FLG_BASE) != 0) {
+      // "this is the version of the file itself.  It must not be used for
+      //  matching a symbol. It can be used to match references."
+      //
+      // http://www.akkadia.org/drepper/symbol-versioning
+      continue;
+    }
+
+    if (verdef->vd_cnt == 0) {
+      DL_ERR("invalid verdef[%zd] vd_cnt == 0 (version without a name)", i);
+      return false;
+    }
+
+    const ElfW(Verdaux)* verdaux = reinterpret_cast<ElfW(Verdaux)*>(verdef_ptr + verdaux_offset);
+
+    if (functor(i, verdef, verdaux) == true) {
+      break;
+    }
+  }
+
+  return true;
+}
+
+bool find_verdef_version_index(const soinfo* si, const version_info* vi, ElfW(Versym)* versym) {
+  if (vi == nullptr) {
+    *versym = kVersymNotNeeded;
+    return true;
+  }
+
+  *versym = kVersymGlobal;
+
+  return for_each_verdef(si,
+    [&](size_t, const ElfW(Verdef)* verdef, const ElfW(Verdaux)* verdaux) {
+      if (verdef->vd_hash == vi->elf_hash &&
+          strcmp(vi->name, si->get_string(verdaux->vda_name)) == 0) {
+        *versym = verdef->vd_ndx;
+        return true;
+      }
+
+      return false;
+    }
+  );
+}
+
 bool VersionTracker::init_verdef(const soinfo* si_from) {
   return for_each_verdef(si_from,
     [&](size_t, const ElfW(Verdef)* verdef, const ElfW(Verdaux)* verdaux) {
@@ -2729,6 +2247,10 @@
   return init_verneed(si_from) && init_verdef(si_from);
 }
 
+// TODO (dimitry): Methods below need to be moved out of soinfo
+// and in more isolated file in order minimize dependencies on
+// unnecessary object in the linker binary. Consider making them
+// independent from soinfo (?).
 bool soinfo::lookup_version_info(const VersionTracker& version_tracker, ElfW(Word) sym,
                                  const char* sym_name, const version_info** vi) {
   const ElfW(Versym)* sym_ver_ptr = get_versym(sym);
@@ -3129,408 +2651,8 @@
 }
 #endif  // !defined(__mips__)
 
-static void call_function(const char* function_name __unused,
-                          linker_ctor_function_t function,
-                          const char* realpath __unused) {
-  if (function == nullptr || reinterpret_cast<uintptr_t>(function) == static_cast<uintptr_t>(-1)) {
-    return;
-  }
-
-  TRACE("[ Calling c-tor %s @ %p for '%s' ]", function_name, function, realpath);
-  function(g_argc, g_argv, g_envp);
-  TRACE("[ Done calling c-tor %s @ %p for '%s' ]", function_name, function, realpath);
-}
-
-static void call_function(const char* function_name __unused,
-                          linker_dtor_function_t function,
-                          const char* realpath __unused) {
-  if (function == nullptr || reinterpret_cast<uintptr_t>(function) == static_cast<uintptr_t>(-1)) {
-    return;
-  }
-
-  TRACE("[ Calling d-tor %s @ %p for '%s' ]", function_name, function, realpath);
-  function();
-  TRACE("[ Done calling d-tor %s @ %p for '%s' ]", function_name, function, realpath);
-}
-
-template <typename F>
-static void call_array(const char* array_name __unused,
-                       F* functions,
-                       size_t count,
-                       bool reverse,
-                       const char* realpath) {
-  if (functions == nullptr) {
-    return;
-  }
-
-  TRACE("[ Calling %s (size %zd) @ %p for '%s' ]", array_name, count, functions, realpath);
-
-  int begin = reverse ? (count - 1) : 0;
-  int end = reverse ? -1 : count;
-  int step = reverse ? -1 : 1;
-
-  for (int i = begin; i != end; i += step) {
-    TRACE("[ %s[%d] == %p ]", array_name, i, functions[i]);
-    call_function("function", functions[i], realpath);
-  }
-
-  TRACE("[ Done calling %s for '%s' ]", array_name, realpath);
-}
-
-void soinfo::call_pre_init_constructors() {
-  // DT_PREINIT_ARRAY functions are called before any other constructors for executables,
-  // but ignored in a shared library.
-  call_array("DT_PREINIT_ARRAY", preinit_array_, preinit_array_count_, false, get_realpath());
-}
-
-void soinfo::call_constructors() {
-  if (constructors_called) {
-    return;
-  }
-
-  // We set constructors_called before actually calling the constructors, otherwise it doesn't
-  // protect against recursive constructor calls. One simple example of constructor recursion
-  // is the libc debug malloc, which is implemented in libc_malloc_debug_leak.so:
-  // 1. The program depends on libc, so libc's constructor is called here.
-  // 2. The libc constructor calls dlopen() to load libc_malloc_debug_leak.so.
-  // 3. dlopen() calls the constructors on the newly created
-  //    soinfo for libc_malloc_debug_leak.so.
-  // 4. The debug .so depends on libc, so CallConstructors is
-  //    called again with the libc soinfo. If it doesn't trigger the early-
-  //    out above, the libc constructor will be called again (recursively!).
-  constructors_called = true;
-
-  if (!is_main_executable() && preinit_array_ != nullptr) {
-    // The GNU dynamic linker silently ignores these, but we warn the developer.
-    PRINT("\"%s\": ignoring DT_PREINIT_ARRAY in shared library!", get_realpath());
-  }
-
-  get_children().for_each([] (soinfo* si) {
-    si->call_constructors();
-  });
-
-  TRACE("\"%s\": calling constructors", get_realpath());
-
-  // DT_INIT should be called before DT_INIT_ARRAY if both are present.
-  call_function("DT_INIT", init_func_, get_realpath());
-  call_array("DT_INIT_ARRAY", init_array_, init_array_count_, false, get_realpath());
-}
-
-void soinfo::call_destructors() {
-  if (!constructors_called) {
-    return;
-  }
-  TRACE("\"%s\": calling destructors", get_realpath());
-
-  // DT_FINI_ARRAY must be parsed in reverse order.
-  call_array("DT_FINI_ARRAY", fini_array_, fini_array_count_, true, get_realpath());
-
-  // DT_FINI should be called after DT_FINI_ARRAY if both are present.
-  call_function("DT_FINI", fini_func_, get_realpath());
-}
-
-void soinfo::add_child(soinfo* child) {
-  if (has_min_version(0)) {
-    child->parents_.push_back(this);
-    this->children_.push_back(child);
-  }
-}
-
-void soinfo::remove_all_links() {
-  if (!has_min_version(0)) {
-    return;
-  }
-
-  // 1. Untie connected soinfos from 'this'.
-  children_.for_each([&] (soinfo* child) {
-    child->parents_.remove_if([&] (const soinfo* parent) {
-      return parent == this;
-    });
-  });
-
-  parents_.for_each([&] (soinfo* parent) {
-    parent->children_.remove_if([&] (const soinfo* child) {
-      return child == this;
-    });
-  });
-
-  // 2. Remove from the primary namespace
-  primary_namespace_->remove_soinfo(this);
-  primary_namespace_ = nullptr;
-
-  // 3. Remove from secondary namespaces
-  secondary_namespaces_.for_each([&](android_namespace_t* ns) {
-    ns->remove_soinfo(this);
-  });
-
-
-  // 4. Once everything untied - clear local lists.
-  parents_.clear();
-  children_.clear();
-  secondary_namespaces_.clear();
-}
-
-dev_t soinfo::get_st_dev() const {
-  if (has_min_version(0)) {
-    return st_dev_;
-  }
-
-  return 0;
-};
-
-ino_t soinfo::get_st_ino() const {
-  if (has_min_version(0)) {
-    return st_ino_;
-  }
-
-  return 0;
-}
-
-off64_t soinfo::get_file_offset() const {
-  if (has_min_version(1)) {
-    return file_offset_;
-  }
-
-  return 0;
-}
-
-uint32_t soinfo::get_rtld_flags() const {
-  if (has_min_version(1)) {
-    return rtld_flags_;
-  }
-
-  return 0;
-}
-
-uint32_t soinfo::get_dt_flags_1() const {
-  if (has_min_version(1)) {
-    return dt_flags_1_;
-  }
-
-  return 0;
-}
-
-void soinfo::set_dt_flags_1(uint32_t dt_flags_1) {
-  if (has_min_version(1)) {
-    if ((dt_flags_1 & DF_1_GLOBAL) != 0) {
-      rtld_flags_ |= RTLD_GLOBAL;
-    }
-
-    if ((dt_flags_1 & DF_1_NODELETE) != 0) {
-      rtld_flags_ |= RTLD_NODELETE;
-    }
-
-    dt_flags_1_ = dt_flags_1;
-  }
-}
-
-void soinfo::set_nodelete() {
-  rtld_flags_ |= RTLD_NODELETE;
-}
-
-const char* soinfo::get_realpath() const {
-#if defined(__work_around_b_24465209__)
-  if (has_min_version(2)) {
-    return realpath_.c_str();
-  } else {
-    return old_name_;
-  }
-#else
-  return realpath_.c_str();
-#endif
-}
-
-void soinfo::set_soname(const char* soname) {
-#if defined(__work_around_b_24465209__)
-  if (has_min_version(2)) {
-    soname_ = soname;
-  }
-  strlcpy(old_name_, soname_, sizeof(old_name_));
-#else
-  soname_ = soname;
-#endif
-}
-
-const char* soinfo::get_soname() const {
-#if defined(__work_around_b_24465209__)
-  if (has_min_version(2)) {
-    return soname_;
-  } else {
-    return old_name_;
-  }
-#else
-  return soname_;
-#endif
-}
-
-// This is a return on get_children()/get_parents() if
-// 'this->flags' does not have FLAG_NEW_SOINFO set.
-static soinfo::soinfo_list_t g_empty_list;
-
-soinfo::soinfo_list_t& soinfo::get_children() {
-  if (has_min_version(0)) {
-    return children_;
-  }
-
-  return g_empty_list;
-}
-
-const soinfo::soinfo_list_t& soinfo::get_children() const {
-  if (has_min_version(0)) {
-    return children_;
-  }
-
-  return g_empty_list;
-}
-
-soinfo::soinfo_list_t& soinfo::get_parents() {
-  if (has_min_version(0)) {
-    return parents_;
-  }
-
-  return g_empty_list;
-}
-
-static std::vector<std::string> g_empty_runpath;
-
-const std::vector<std::string>& soinfo::get_dt_runpath() const {
-  if (has_min_version(3)) {
-    return dt_runpath_;
-  }
-
-  return g_empty_runpath;
-}
-
-android_namespace_t* soinfo::get_primary_namespace() {
-  if (has_min_version(3)) {
-    return primary_namespace_;
-  }
-
-  return &g_default_namespace;
-}
-
-void soinfo::add_secondary_namespace(android_namespace_t* secondary_ns) {
-  CHECK(has_min_version(3));
-  secondary_namespaces_.push_back(secondary_ns);
-}
-
-ElfW(Addr) soinfo::resolve_symbol_address(const ElfW(Sym)* s) const {
-  if (ELF_ST_TYPE(s->st_info) == STT_GNU_IFUNC) {
-    return call_ifunc_resolver(s->st_value + load_bias);
-  }
-
-  return static_cast<ElfW(Addr)>(s->st_value + load_bias);
-}
-
-const char* soinfo::get_string(ElfW(Word) index) const {
-  if (has_min_version(1) && (index >= strtab_size_)) {
-    __libc_fatal("%s: strtab out of bounds error; STRSZ=%zd, name=%d",
-        get_realpath(), strtab_size_, index);
-  }
-
-  return strtab_ + index;
-}
-
-bool soinfo::is_gnu_hash() const {
-  return (flags_ & FLAG_GNU_HASH) != 0;
-}
-
-bool soinfo::can_unload() const {
-  return !is_linked() || ((get_rtld_flags() & (RTLD_NODELETE | RTLD_GLOBAL)) == 0);
-}
-
-bool soinfo::is_linked() const {
-  return (flags_ & FLAG_LINKED) != 0;
-}
-
-bool soinfo::is_main_executable() const {
-  return (flags_ & FLAG_EXE) != 0;
-}
-
-bool soinfo::is_linker() const {
-  return (flags_ & FLAG_LINKER) != 0;
-}
-
-void soinfo::set_linked() {
-  flags_ |= FLAG_LINKED;
-}
-
-void soinfo::set_linker_flag() {
-  flags_ |= FLAG_LINKER;
-}
-
-void soinfo::set_main_executable() {
-  flags_ |= FLAG_EXE;
-}
-
-void soinfo::increment_ref_count() {
-  local_group_root_->ref_count_++;
-}
-
-size_t soinfo::decrement_ref_count() {
-  return --local_group_root_->ref_count_;
-}
-
-soinfo* soinfo::get_local_group_root() const {
-  return local_group_root_;
-}
-
-
-void soinfo::set_mapped_by_caller(bool mapped_by_caller) {
-  if (mapped_by_caller) {
-    flags_ |= FLAG_MAPPED_BY_CALLER;
-  } else {
-    flags_ &= ~FLAG_MAPPED_BY_CALLER;
-  }
-}
-
-bool soinfo::is_mapped_by_caller() const {
-  return (flags_ & FLAG_MAPPED_BY_CALLER) != 0;
-}
-
-// This function returns api-level at the time of
-// dlopen/load. Note that libraries opened by system
-// will always have 'current' api level.
-uint32_t soinfo::get_target_sdk_version() const {
-  if (!has_min_version(2)) {
-    return __ANDROID_API__;
-  }
-
-  return local_group_root_->target_sdk_version_;
-}
-
-uintptr_t soinfo::get_handle() const {
-  CHECK(has_min_version(3));
-  CHECK(handle_ != 0);
-  return handle_;
-}
-
-void* soinfo::to_handle() {
-  if (get_application_target_sdk_version() <= 23 || !has_min_version(3)) {
-    return this;
-  }
-
-  return reinterpret_cast<void*>(get_handle());
-}
-
-void soinfo::generate_handle() {
-  CHECK(has_min_version(3));
-  CHECK(handle_ == 0); // Make sure this is the first call
-
-  // Make sure the handle is unique and does not collide
-  // with special values which are RTLD_DEFAULT and RTLD_NEXT.
-  do {
-    arc4random_buf(&handle_, sizeof(handle_));
-    // the least significant bit for the handle is always 1
-    // making it easy to test the type of handle passed to
-    // dl* functions.
-    handle_ = handle_ | 1;
-  } while (handle_ == reinterpret_cast<uintptr_t>(RTLD_DEFAULT) ||
-           handle_ == reinterpret_cast<uintptr_t>(RTLD_NEXT) ||
-           g_soinfo_handles_map.find(handle_) != g_soinfo_handles_map.end());
-
-  g_soinfo_handles_map[handle_] = this;
-}
+// An empty list of soinfos
+static soinfo_list_t g_empty_list;
 
 bool soinfo::prelink_image() {
   /* Extract dynamic section */
@@ -4144,7 +3266,7 @@
   si->load_bias = get_elf_exec_load_bias(ehdr_vdso);
 
   si->prelink_image();
-  si->link_image(g_empty_list, soinfo::soinfo_list_t::make_list(si), nullptr);
+  si->link_image(g_empty_list, soinfo_list_t::make_list(si), nullptr);
 #endif
 }
 
@@ -4188,6 +3310,7 @@
   const char* bname = basename(interp);
   if (bname && (strcmp(bname, "linker_asan") == 0 || strcmp(bname, "linker_asan64") == 0)) {
     g_default_ld_paths = kAsanDefaultLdPaths;
+    g_is_asan = true;
   } else {
     g_default_ld_paths = kDefaultLdPaths;
   }
@@ -4362,7 +3485,7 @@
                       /* add_as_children */ true)) {
     __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", g_argv[0], linker_get_error_buffer());
   } else if (needed_libraries_count == 0) {
-    if (!si->link_image(g_empty_list, soinfo::soinfo_list_t::make_list(si), nullptr)) {
+    if (!si->link_image(g_empty_list, soinfo_list_t::make_list(si), nullptr)) {
       __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", g_argv[0], linker_get_error_buffer());
     }
     si->increment_ref_count();
@@ -4454,8 +3577,8 @@
   return 0;
 }
 
-static void __linker_cannot_link() {
-  __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", g_argv[0], linker_get_error_buffer());
+static void __linker_cannot_link(const char* argv0) {
+  __libc_fatal("CANNOT LINK EXECUTABLE \"%s\": %s", argv0, linker_get_error_buffer());
 }
 
 /*
@@ -4470,10 +3593,6 @@
 extern "C" ElfW(Addr) __linker_init(void* raw_args) {
   KernelArgumentBlock args(raw_args);
 
-  g_argc = args.argc;
-  g_argv = args.argv;
-  g_envp = args.envp;
-
   ElfW(Addr) linker_addr = args.getauxval(AT_BASE);
   ElfW(Addr) entry_point = args.getauxval(AT_ENTRY);
   ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_addr);
@@ -4490,7 +3609,7 @@
   if (reinterpret_cast<ElfW(Addr)>(&_start) == entry_point) {
     __libc_format_fd(STDOUT_FILENO,
                      "This is %s, the helper program for shared library executables.\n",
-                     g_argv[0]);
+                     args.argv[0]);
     exit(0);
   }
 
@@ -4503,7 +3622,7 @@
   linker_so.set_linker_flag();
 
   // Prelink the linker so we can access linker globals.
-  if (!linker_so.prelink_image()) __linker_cannot_link();
+  if (!linker_so.prelink_image()) __linker_cannot_link(args.argv[0]);
 
   // This might not be obvious... The reasons why we pass g_empty_list
   // in place of local_group here are (1) we do not really need it, because
@@ -4511,7 +3630,7 @@
   // itself without having to look into local_group and (2) allocators
   // are not yet initialized, and therefore we cannot use linked_list.push_*
   // functions at this point.
-  if (!linker_so.link_image(g_empty_list, g_empty_list, nullptr)) __linker_cannot_link();
+  if (!linker_so.link_image(g_empty_list, g_empty_list, nullptr)) __linker_cannot_link(args.argv[0]);
 
 #if defined(__i386__)
   // On x86, we can't make system calls before this point.
@@ -4527,11 +3646,16 @@
 
   // We didn't protect the linker's RELRO pages in link_image because we
   // couldn't make system calls on x86 at that point, but we can now...
-  if (!linker_so.protect_relro()) __linker_cannot_link();
+  if (!linker_so.protect_relro()) __linker_cannot_link(args.argv[0]);
 
   // Initialize the linker's static libc's globals
   __libc_init_globals(args);
 
+  // store argc/argv/envp to use them for calling constructors
+  g_argc = args.argc;
+  g_argv = args.argv;
+  g_envp = args.envp;
+
   // Initialize the linker's own global variables
   linker_so.call_constructors();
 
diff --git a/linker/linker.h b/linker/linker.h
index d8c0e19..aa6d00b 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -40,26 +40,13 @@
 #include "private/bionic_page.h"
 #include "private/libc_logging.h"
 #include "linked_list.h"
+#include "linker_common_types.h"
 #include "linker_logger.h"
+#include "linker_soinfo.h"
 
 #include <string>
 #include <vector>
 
-#define DL_ERR(fmt, x...) \
-    do { \
-      __libc_format_buffer(linker_get_error_buffer(), linker_get_error_buffer_size(), fmt, ##x); \
-      /* If LD_DEBUG is set high enough, log every dlerror(3) message. */ \
-      LD_LOG(kLogErrors, "%s\n", linker_get_error_buffer()); \
-    } while (false)
-
-#define DL_WARN(fmt, x...) \
-    do { \
-      __libc_format_log(ANDROID_LOG_WARN, "linker", fmt, ##x); \
-      __libc_format_fd(2, "WARNING: linker: "); \
-      __libc_format_fd(2, fmt, ##x); \
-      __libc_format_fd(2, "\n"); \
-    } while (false)
-
 #if defined(__LP64__)
 #define ELFW(what) ELF64_ ## what
 #else
@@ -80,83 +67,8 @@
 #define ELF64_R_TYPE(info)  (((info) >> 56) & 0xff)
 #endif
 
-#define FLAG_LINKED           0x00000001
-#define FLAG_EXE              0x00000004 // The main executable
-#define FLAG_LINKER           0x00000010 // The linker itself
-#define FLAG_GNU_HASH         0x00000040 // uses gnu hash
-#define FLAG_MAPPED_BY_CALLER 0x00000080 // the map is reserved by the caller
-                                         // and should not be unmapped
-#define FLAG_NEW_SOINFO       0x40000000 // new soinfo format
-
 #define SUPPORTED_DT_FLAGS_1 (DF_1_NOW | DF_1_GLOBAL | DF_1_NODELETE)
 
-#define SOINFO_VERSION 3
-
-#if defined(__work_around_b_24465209__)
-#define SOINFO_NAME_LEN 128
-#endif
-
-typedef void (*linker_dtor_function_t)();
-typedef void (*linker_ctor_function_t)(int, char**, char**);
-
-// Android uses RELA for aarch64 and x86_64. mips64 still uses REL.
-#if defined(__aarch64__) || defined(__x86_64__)
-#define USE_RELA 1
-#endif
-
-struct soinfo;
-
-class SoinfoListAllocator {
- public:
-  static LinkedListEntry<soinfo>* alloc();
-  static void free(LinkedListEntry<soinfo>* entry);
-
- private:
-  // unconstructable
-  DISALLOW_IMPLICIT_CONSTRUCTORS(SoinfoListAllocator);
-};
-
-class NamespaceListAllocator {
- public:
-  static LinkedListEntry<android_namespace_t>* alloc();
-  static void free(LinkedListEntry<android_namespace_t>* entry);
-
- private:
-  // unconstructable
-  DISALLOW_IMPLICIT_CONSTRUCTORS(NamespaceListAllocator);
-};
-
-class SymbolName {
- public:
-  explicit SymbolName(const char* name)
-      : name_(name), has_elf_hash_(false), has_gnu_hash_(false),
-        elf_hash_(0), gnu_hash_(0) { }
-
-  const char* get_name() {
-    return name_;
-  }
-
-  uint32_t elf_hash();
-  uint32_t gnu_hash();
-
- private:
-  const char* name_;
-  bool has_elf_hash_;
-  bool has_gnu_hash_;
-  uint32_t elf_hash_;
-  uint32_t gnu_hash_;
-
-  DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolName);
-};
-
-struct version_info {
-  constexpr version_info() : elf_hash(0), name(nullptr), target_si(nullptr) {}
-
-  uint32_t elf_hash;
-  const char* name;
-  const soinfo* target_si;
-};
-
 // Class used construct version dependency graph.
 class VersionTracker {
  public:
@@ -175,267 +87,9 @@
   DISALLOW_COPY_AND_ASSIGN(VersionTracker);
 };
 
-struct soinfo {
- public:
-  typedef LinkedList<soinfo, SoinfoListAllocator> soinfo_list_t;
-  typedef LinkedList<android_namespace_t, NamespaceListAllocator> android_namespace_list_t;
-#if defined(__work_around_b_24465209__)
- private:
-  char old_name_[SOINFO_NAME_LEN];
-#endif
- public:
-  const ElfW(Phdr)* phdr;
-  size_t phnum;
-#if defined(__work_around_b_24465209__)
-  ElfW(Addr) unused0; // DO NOT USE, maintained for compatibility.
-#endif
-  ElfW(Addr) base;
-  size_t size;
-
-#if defined(__work_around_b_24465209__)
-  uint32_t unused1;  // DO NOT USE, maintained for compatibility.
-#endif
-
-  ElfW(Dyn)* dynamic;
-
-#if defined(__work_around_b_24465209__)
-  uint32_t unused2; // DO NOT USE, maintained for compatibility
-  uint32_t unused3; // DO NOT USE, maintained for compatibility
-#endif
-
-  soinfo* next;
- private:
-  uint32_t flags_;
-
-  const char* strtab_;
-  ElfW(Sym)* symtab_;
-
-  size_t nbucket_;
-  size_t nchain_;
-  uint32_t* bucket_;
-  uint32_t* chain_;
-
-#if defined(__mips__) || !defined(__LP64__)
-  // This is only used by mips and mips64, but needs to be here for
-  // all 32-bit architectures to preserve binary compatibility.
-  ElfW(Addr)** plt_got_;
-#endif
-
-#if defined(USE_RELA)
-  ElfW(Rela)* plt_rela_;
-  size_t plt_rela_count_;
-
-  ElfW(Rela)* rela_;
-  size_t rela_count_;
-#else
-  ElfW(Rel)* plt_rel_;
-  size_t plt_rel_count_;
-
-  ElfW(Rel)* rel_;
-  size_t rel_count_;
-#endif
-
-  linker_ctor_function_t* preinit_array_;
-  size_t preinit_array_count_;
-
-  linker_ctor_function_t* init_array_;
-  size_t init_array_count_;
-  linker_dtor_function_t* fini_array_;
-  size_t fini_array_count_;
-
-  linker_ctor_function_t init_func_;
-  linker_dtor_function_t fini_func_;
-
-#if defined(__arm__)
- public:
-  // ARM EABI section used for stack unwinding.
-  uint32_t* ARM_exidx;
-  size_t ARM_exidx_count;
- private:
-#elif defined(__mips__)
-  uint32_t mips_symtabno_;
-  uint32_t mips_local_gotno_;
-  uint32_t mips_gotsym_;
-  bool mips_relocate_got(const VersionTracker& version_tracker,
-                         const soinfo_list_t& global_group,
-                         const soinfo_list_t& local_group);
-#if !defined(__LP64__)
-  bool mips_check_and_adjust_fp_modes();
-#endif
-#endif
-  size_t ref_count_;
- public:
-  link_map link_map_head;
-
-  bool constructors_called;
-
-  // When you read a virtual address from the ELF file, add this
-  // value to get the corresponding address in the process' address space.
-  ElfW(Addr) load_bias;
-
-#if !defined(__LP64__)
-  bool has_text_relocations;
-#endif
-  bool has_DT_SYMBOLIC;
-
- public:
-  soinfo(android_namespace_t* ns, const char* name, const struct stat* file_stat,
-         off64_t file_offset, int rtld_flags);
-  ~soinfo();
-
-  void call_constructors();
-  void call_destructors();
-  void call_pre_init_constructors();
-  bool prelink_image();
-  bool link_image(const soinfo_list_t& global_group, const soinfo_list_t& local_group,
-                  const android_dlextinfo* extinfo);
-  bool protect_relro();
-
-  void add_child(soinfo* child);
-  void remove_all_links();
-
-  ino_t get_st_ino() const;
-  dev_t get_st_dev() const;
-  off64_t get_file_offset() const;
-
-  uint32_t get_rtld_flags() const;
-  uint32_t get_dt_flags_1() const;
-  void set_dt_flags_1(uint32_t dt_flags_1);
-
-  soinfo_list_t& get_children();
-  const soinfo_list_t& get_children() const;
-
-  soinfo_list_t& get_parents();
-
-  bool find_symbol_by_name(SymbolName& symbol_name,
-                           const version_info* vi,
-                           const ElfW(Sym)** symbol) const;
-
-  ElfW(Sym)* find_symbol_by_address(const void* addr);
-  ElfW(Addr) resolve_symbol_address(const ElfW(Sym)* s) const;
-
-  const char* get_string(ElfW(Word) index) const;
-  bool can_unload() const;
-  bool is_gnu_hash() const;
-
-  bool inline has_min_version(uint32_t min_version __unused) const {
-#if defined(__work_around_b_24465209__)
-    return (flags_ & FLAG_NEW_SOINFO) != 0 && version_ >= min_version;
-#else
-    return true;
-#endif
-  }
-
-  bool is_linked() const;
-  bool is_linker() const;
-  bool is_main_executable() const;
-
-  void set_linked();
-  void set_linker_flag();
-  void set_main_executable();
-  void set_nodelete();
-
-  void increment_ref_count();
-  size_t decrement_ref_count();
-
-  soinfo* get_local_group_root() const;
-
-  void set_soname(const char* soname);
-  const char* get_soname() const;
-  const char* get_realpath() const;
-  const ElfW(Versym)* get_versym(size_t n) const;
-  ElfW(Addr) get_verneed_ptr() const;
-  size_t get_verneed_cnt() const;
-  ElfW(Addr) get_verdef_ptr() const;
-  size_t get_verdef_cnt() const;
-
-  bool find_verdef_version_index(const version_info* vi, ElfW(Versym)* versym) const;
-
-  uint32_t get_target_sdk_version() const;
-
-  void set_dt_runpath(const char *);
-  const std::vector<std::string>& get_dt_runpath() const;
-  android_namespace_t* get_primary_namespace();
-  void add_secondary_namespace(android_namespace_t* secondary_ns);
-
-  void set_mapped_by_caller(bool reserved_map);
-  bool is_mapped_by_caller() const;
-
-  uintptr_t get_handle() const;
-  void generate_handle();
-  void* to_handle();
-
- private:
-  bool elf_lookup(SymbolName& symbol_name, const version_info* vi, uint32_t* symbol_index) const;
-  ElfW(Sym)* elf_addr_lookup(const void* addr);
-  bool gnu_lookup(SymbolName& symbol_name, const version_info* vi, uint32_t* symbol_index) const;
-  ElfW(Sym)* gnu_addr_lookup(const void* addr);
-
-  bool lookup_version_info(const VersionTracker& version_tracker, ElfW(Word) sym,
-                           const char* sym_name, const version_info** vi);
-
-  template<typename ElfRelIteratorT>
-  bool relocate(const VersionTracker& version_tracker, ElfRelIteratorT&& rel_iterator,
-                const soinfo_list_t& global_group, const soinfo_list_t& local_group);
-
- private:
-  // This part of the structure is only available
-  // when FLAG_NEW_SOINFO is set in this->flags.
-  uint32_t version_;
-
-  // version >= 0
-  dev_t st_dev_;
-  ino_t st_ino_;
-
-  // dependency graph
-  soinfo_list_t children_;
-  soinfo_list_t parents_;
-
-  // version >= 1
-  off64_t file_offset_;
-  uint32_t rtld_flags_;
-  uint32_t dt_flags_1_;
-  size_t strtab_size_;
-
-  // version >= 2
-
-  size_t gnu_nbucket_;
-  uint32_t* gnu_bucket_;
-  uint32_t* gnu_chain_;
-  uint32_t gnu_maskwords_;
-  uint32_t gnu_shift2_;
-  ElfW(Addr)* gnu_bloom_filter_;
-
-  soinfo* local_group_root_;
-
-  uint8_t* android_relocs_;
-  size_t android_relocs_size_;
-
-  const char* soname_;
-  std::string realpath_;
-
-  const ElfW(Versym)* versym_;
-
-  ElfW(Addr) verdef_ptr_;
-  size_t verdef_cnt_;
-
-  ElfW(Addr) verneed_ptr_;
-  size_t verneed_cnt_;
-
-  uint32_t target_sdk_version_;
-
-  // version >= 3
-  std::vector<std::string> dt_runpath_;
-  android_namespace_t* primary_namespace_;
-  android_namespace_list_t secondary_namespaces_;
-  uintptr_t handle_;
-
-  friend soinfo* get_libdl_info();
-};
-
 bool soinfo_do_lookup(soinfo* si_from, const char* name, const version_info* vi,
-                      soinfo** si_found_in, const soinfo::soinfo_list_t& global_group,
-                      const soinfo::soinfo_list_t& local_group, const ElfW(Sym)** symbol);
+                      soinfo** si_found_in, const soinfo_list_t& global_group,
+                      const soinfo_list_t& local_group, const ElfW(Sym)** symbol);
 
 enum RelocationKind {
   kRelocAbsolute = 0,
@@ -461,9 +115,6 @@
 
 int do_dladdr(const void* addr, Dl_info* info);
 
-char* linker_get_error_buffer();
-size_t linker_get_error_buffer_size();
-
 void set_application_target_sdk_version(uint32_t target);
 uint32_t get_application_target_sdk_version();
 
diff --git a/linker/linker_common_types.h b/linker/linker_common_types.h
new file mode 100644
index 0000000..6afd950
--- /dev/null
+++ b/linker/linker_common_types.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __LINKER_COMMON_TYPES_H
+#define __LINKER_COMMON_TYPES_H
+
+#include <android/dlext.h>
+#include "linked_list.h"
+
+// TODO(dimitry): move this to linker_defines.h? Unless it is removed by
+// consequent refactoring steps.
+
+// Android uses RELA for aarch64 and x86_64. mips64 still uses REL.
+#if defined(__aarch64__) || defined(__x86_64__)
+#define USE_RELA 1
+#endif
+
+
+struct soinfo;
+
+class SoinfoListAllocator {
+ public:
+  static LinkedListEntry<soinfo>* alloc();
+  static void free(LinkedListEntry<soinfo>* entry);
+
+ private:
+  // unconstructable
+  DISALLOW_IMPLICIT_CONSTRUCTORS(SoinfoListAllocator);
+};
+
+class NamespaceListAllocator {
+ public:
+  static LinkedListEntry<android_namespace_t>* alloc();
+  static void free(LinkedListEntry<android_namespace_t>* entry);
+
+ private:
+  // unconstructable
+  DISALLOW_IMPLICIT_CONSTRUCTORS(NamespaceListAllocator);
+};
+
+typedef LinkedList<soinfo, SoinfoListAllocator> soinfo_list_t;
+typedef LinkedList<android_namespace_t, NamespaceListAllocator> android_namespace_list_t;
+
+#endif  /* __LINKER_COMMON_TYPES_H */
diff --git a/linker/linker_globals.cpp b/linker/linker_globals.cpp
new file mode 100644
index 0000000..155ebf4
--- /dev/null
+++ b/linker/linker_globals.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+
+#include "linker_globals.h"
+#include "linker_namespaces.h"
+
+int g_argc = 0;
+char** g_argv = nullptr;
+char** g_envp = nullptr;
+
+android_namespace_t g_default_namespace;
+
+std::unordered_map<uintptr_t, soinfo*> g_soinfo_handles_map;
+
+static char __linker_dl_err_buf[768];
+
+char* linker_get_error_buffer() {
+  return &__linker_dl_err_buf[0];
+}
+
+size_t linker_get_error_buffer_size() {
+  return sizeof(__linker_dl_err_buf);
+}
+
diff --git a/linker/linker_globals.h b/linker/linker_globals.h
new file mode 100644
index 0000000..b6f8a04
--- /dev/null
+++ b/linker/linker_globals.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __LINKER_GLOBALS_H
+#define __LINKER_GLOBALS_H
+
+#include <link.h>
+#include <stddef.h>
+
+#include <unordered_map>
+
+#define DL_ERR(fmt, x...) \
+    do { \
+      __libc_format_buffer(linker_get_error_buffer(), linker_get_error_buffer_size(), fmt, ##x); \
+      /* If LD_DEBUG is set high enough, log every dlerror(3) message. */ \
+      LD_LOG(kLogErrors, "%s\n", linker_get_error_buffer()); \
+    } while (false)
+
+#define DL_WARN(fmt, x...) \
+    do { \
+      __libc_format_log(ANDROID_LOG_WARN, "linker", fmt, ##x); \
+      __libc_format_fd(2, "WARNING: linker: "); \
+      __libc_format_fd(2, fmt, ##x); \
+      __libc_format_fd(2, "\n"); \
+    } while (false)
+
+#define DL_ERR_AND_LOG(fmt, x...) \
+  do { \
+    DL_ERR(fmt, x); \
+    PRINT(fmt, x); \
+  } while (false)
+
+constexpr ElfW(Versym) kVersymNotNeeded = 0;
+constexpr ElfW(Versym) kVersymGlobal = 1;
+
+// These values are used to call constructors for .init_array && .preinit_array
+extern int g_argc;
+extern char** g_argv;
+extern char** g_envp;
+
+struct soinfo;
+struct android_namespace_t;
+
+extern android_namespace_t g_default_namespace;
+
+extern std::unordered_map<uintptr_t, soinfo*> g_soinfo_handles_map;
+
+// Error buffer "variable"
+char* linker_get_error_buffer();
+size_t linker_get_error_buffer_size();
+
+#endif  /* __LINKER_GLOBALS_H */
diff --git a/linker/linker_mips.cpp b/linker/linker_mips.cpp
index 02375c4..cd392dc 100644
--- a/linker/linker_mips.cpp
+++ b/linker/linker_mips.cpp
@@ -32,10 +32,12 @@
 
 #include "linker.h"
 #include "linker_debug.h"
+#include "linker_globals.h"
 #include "linker_phdr.h"
 #include "linker_relocs.h"
 #include "linker_reloc_iterators.h"
 #include "linker_sleb128.h"
+#include "linker_soinfo.h"
 
 template bool soinfo::relocate<plain_reloc_iterator>(const VersionTracker& version_tracker,
                                                      plain_reloc_iterator&& rel_iterator,
diff --git a/linker/linker_namespaces.cpp b/linker/linker_namespaces.cpp
new file mode 100644
index 0000000..675f324
--- /dev/null
+++ b/linker/linker_namespaces.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "linker_namespaces.h"
+#include "linker_utils.h"
+
+#include <vector>
+
+bool android_namespace_t::is_accessible(const std::string& file) {
+  if (!is_isolated_) {
+    return true;
+  }
+
+  for (const auto& dir : ld_library_paths_) {
+    if (file_is_in_dir(file, dir)) {
+      return true;
+    }
+  }
+
+  for (const auto& dir : default_library_paths_) {
+    if (file_is_in_dir(file, dir)) {
+      return true;
+    }
+  }
+
+  for (const auto& dir : permitted_paths_) {
+    if (file_is_under_dir(file, dir)) {
+      return true;
+    }
+  }
+
+  return false;
+}
+
diff --git a/linker/linker_namespaces.h b/linker/linker_namespaces.h
new file mode 100644
index 0000000..c1cee8e
--- /dev/null
+++ b/linker/linker_namespaces.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __LINKER_NAMESPACES_H
+#define __LINKER_NAMESPACES_H
+
+#include "linker_common_types.h"
+
+#include <string>
+#include <vector>
+
+struct android_namespace_t {
+ public:
+  android_namespace_t() : name_(nullptr), is_isolated_(false) {}
+
+  const char* get_name() const { return name_; }
+  void set_name(const char* name) { name_ = name; }
+
+  bool is_isolated() const { return is_isolated_; }
+  void set_isolated(bool isolated) { is_isolated_ = isolated; }
+
+  const std::vector<std::string>& get_ld_library_paths() const {
+    return ld_library_paths_;
+  }
+  void set_ld_library_paths(std::vector<std::string>&& library_paths) {
+    ld_library_paths_ = library_paths;
+  }
+
+  const std::vector<std::string>& get_default_library_paths() const {
+    return default_library_paths_;
+  }
+  void set_default_library_paths(std::vector<std::string>&& library_paths) {
+    default_library_paths_ = library_paths;
+  }
+
+  const std::vector<std::string>& get_permitted_paths() const {
+    return permitted_paths_;
+  }
+  void set_permitted_paths(std::vector<std::string>&& permitted_paths) {
+    permitted_paths_ = permitted_paths;
+  }
+
+  void add_soinfo(soinfo* si) {
+    soinfo_list_.push_back(si);
+  }
+
+  void add_soinfos(const soinfo_list_t& soinfos) {
+    for (auto si : soinfos) {
+      add_soinfo(si);
+    }
+  }
+
+  void remove_soinfo(soinfo* si) {
+    soinfo_list_.remove_if([&](soinfo* candidate) {
+      return si == candidate;
+    });
+  }
+
+  const soinfo_list_t& soinfo_list() const { return soinfo_list_; }
+
+  // For isolated namespaces - checks if the file is on the search path;
+  // always returns true for not isolated namespace.
+  bool is_accessible(const std::string& path);
+
+ private:
+  const char* name_;
+  bool is_isolated_;
+  std::vector<std::string> ld_library_paths_;
+  std::vector<std::string> default_library_paths_;
+  std::vector<std::string> permitted_paths_;
+  soinfo_list_t soinfo_list_;
+
+  DISALLOW_COPY_AND_ASSIGN(android_namespace_t);
+};
+
+#endif  /* __LINKER_NAMESPACES_H */
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index ebc3166..bced722 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -36,6 +36,7 @@
 #include <unistd.h>
 
 #include "linker.h"
+#include "linker_globals.h"
 #include "linker_debug.h"
 #include "linker_utils.h"
 
@@ -259,7 +260,7 @@
   return true;
 }
 
-bool ElfReader::CheckFileRange(ElfW(Addr) offset, size_t size) {
+bool ElfReader::CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment) {
   off64_t range_start;
   off64_t range_end;
 
@@ -270,8 +271,9 @@
   return offset > 0 &&
          safe_add(&range_start, file_offset_, offset) &&
          safe_add(&range_end, range_start, size) &&
-         range_start < file_size_ &&
-         range_end <= file_size_;
+         (range_start < file_size_) &&
+         (range_end <= file_size_) &&
+         ((offset % alignment) == 0);
 }
 
 // Loads the program header table from an ELF file into a read-only private
@@ -288,8 +290,11 @@
 
   // Boundary checks
   size_t size = phdr_num_ * sizeof(ElfW(Phdr));
-  if (!CheckFileRange(header_.e_phoff, size)) {
-    DL_ERR("\"%s\" has invalid phdr offset/size", name_.c_str());
+  if (!CheckFileRange(header_.e_phoff, size, alignof(ElfW(Phdr)))) {
+    DL_ERR_AND_LOG("\"%s\" has invalid phdr offset/size: %zu/%zu",
+                   name_.c_str(),
+                   static_cast<size_t>(header_.e_phoff),
+                   size);
     return false;
   }
 
@@ -306,13 +311,16 @@
   shdr_num_ = header_.e_shnum;
 
   if (shdr_num_ == 0) {
-    DL_ERR("\"%s\" has no section headers", name_.c_str());
+    DL_ERR_AND_LOG("\"%s\" has no section headers", name_.c_str());
     return false;
   }
 
   size_t size = shdr_num_ * sizeof(ElfW(Shdr));
-  if (!CheckFileRange(header_.e_shoff, size)) {
-    DL_ERR("\"%s\" has invalid shdr offset/size", name_.c_str());
+  if (!CheckFileRange(header_.e_shoff, size, alignof(const ElfW(Shdr)))) {
+    DL_ERR_AND_LOG("\"%s\" has invalid shdr offset/size: %zu/%zu",
+                   name_.c_str(),
+                   static_cast<size_t>(header_.e_shoff),
+                   size);
     return false;
   }
 
@@ -336,7 +344,7 @@
   }
 
   if (dynamic_shdr == nullptr) {
-    DL_ERR("\"%s\" .dynamic section header was not found", name_.c_str());
+    DL_ERR_AND_LOG("\"%s\" .dynamic section header was not found", name_.c_str());
     return false;
   }
 
@@ -370,21 +378,22 @@
   }
 
   if (dynamic_shdr->sh_link >= shdr_num_) {
-    DL_ERR("\"%s\" .dynamic section has invalid sh_link: %d", name_.c_str(), dynamic_shdr->sh_link);
+    DL_ERR_AND_LOG("\"%s\" .dynamic section has invalid sh_link: %d",
+                   name_.c_str(),
+                   dynamic_shdr->sh_link);
     return false;
   }
 
   const ElfW(Shdr)* strtab_shdr = &shdr_table_[dynamic_shdr->sh_link];
 
   if (strtab_shdr->sh_type != SHT_STRTAB) {
-    DL_ERR("\"%s\" .dynamic section has invalid link(%d) sh_type: %d (expected SHT_STRTAB)",
-           name_.c_str(), dynamic_shdr->sh_link, strtab_shdr->sh_type);
+    DL_ERR_AND_LOG("\"%s\" .dynamic section has invalid link(%d) sh_type: %d (expected SHT_STRTAB)",
+                   name_.c_str(), dynamic_shdr->sh_link, strtab_shdr->sh_type);
     return false;
   }
 
-  if (!CheckFileRange(dynamic_shdr->sh_offset, dynamic_shdr->sh_size)) {
-    DL_ERR("\"%s\" has invalid offset/size of .dynamic section", name_.c_str());
-    PRINT("\"%s\" has invalid offset/size of .dynamic section", name_.c_str());
+  if (!CheckFileRange(dynamic_shdr->sh_offset, dynamic_shdr->sh_size, alignof(const ElfW(Dyn)))) {
+    DL_ERR_AND_LOG("\"%s\" has invalid offset/size of .dynamic section", name_.c_str());
     return false;
   }
 
@@ -395,9 +404,9 @@
 
   dynamic_ = static_cast<const ElfW(Dyn)*>(dynamic_fragment_.data());
 
-  if (!CheckFileRange(strtab_shdr->sh_offset, strtab_shdr->sh_size)) {
-    DL_ERR("\"%s\" has invalid offset/size of the .strtab section linked from .dynamic section",
-           name_.c_str());
+  if (!CheckFileRange(strtab_shdr->sh_offset, strtab_shdr->sh_size, alignof(const char))) {
+    DL_ERR_AND_LOG("\"%s\" has invalid offset/size of the .strtab section linked from .dynamic section",
+                   name_.c_str());
     return false;
   }
 
@@ -595,9 +604,16 @@
     }
 
     if (file_length != 0) {
+      int prot = PFLAGS_TO_PROT(phdr->p_flags);
+      // W + E PT_LOAD segments are not allowed.
+      if ((prot & (PROT_EXEC | PROT_WRITE)) == (PROT_EXEC | PROT_WRITE)) {
+        DL_ERR_AND_LOG("\"%s\": W + E load segments are not allowed", name_.c_str());
+        return false;
+      }
+
       void* seg_addr = mmap64(reinterpret_cast<void*>(seg_page_start),
                             file_length,
-                            PFLAGS_TO_PROT(phdr->p_flags),
+                            prot,
                             MAP_FIXED|MAP_PRIVATE,
                             fd_,
                             file_offset_ + file_page_start);
diff --git a/linker/linker_phdr.h b/linker/linker_phdr.h
index 89ec094..d6276ed 100644
--- a/linker/linker_phdr.h
+++ b/linker/linker_phdr.h
@@ -65,7 +65,7 @@
   bool LoadSegments();
   bool FindPhdr();
   bool CheckPhdr(ElfW(Addr));
-  bool CheckFileRange(ElfW(Addr) offset, size_t size);
+  bool CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment);
 
   bool did_read_;
   bool did_load_;
diff --git a/linker/linker_soinfo.cpp b/linker/linker_soinfo.cpp
new file mode 100644
index 0000000..59bdc4d
--- /dev/null
+++ b/linker/linker_soinfo.cpp
@@ -0,0 +1,795 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "linker_soinfo.h"
+
+#include <dlfcn.h>
+#include <elf.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include "linker_debug.h"
+#include "linker_globals.h"
+#include "linker_logger.h"
+#include "linker_utils.h"
+
+// TODO(dimitry): These functions are currently located in linker.cpp - find a better place for it
+bool find_verdef_version_index(const soinfo* si, const version_info* vi, ElfW(Versym)* versym);
+ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr);
+uint32_t get_application_target_sdk_version();
+
+soinfo::soinfo(android_namespace_t* ns, const char* realpath,
+               const struct stat* file_stat, off64_t file_offset,
+               int rtld_flags) {
+  memset(this, 0, sizeof(*this));
+
+  if (realpath != nullptr) {
+    realpath_ = realpath;
+  }
+
+  flags_ = FLAG_NEW_SOINFO;
+  version_ = SOINFO_VERSION;
+
+  if (file_stat != nullptr) {
+    this->st_dev_ = file_stat->st_dev;
+    this->st_ino_ = file_stat->st_ino;
+    this->file_offset_ = file_offset;
+  }
+
+  this->rtld_flags_ = rtld_flags;
+  this->primary_namespace_ = ns;
+}
+
+soinfo::~soinfo() {
+  g_soinfo_handles_map.erase(handle_);
+}
+
+void soinfo::set_dt_runpath(const char* path) {
+  if (!has_min_version(3)) {
+    return;
+  }
+
+  std::vector<std::string> runpaths;
+
+  split_path(path, ":", &runpaths);
+
+  std::string origin = dirname(get_realpath());
+  // FIXME: add $LIB and $PLATFORM.
+  std::pair<std::string, std::string> substs[] = {{"ORIGIN", origin}};
+  for (auto&& s : runpaths) {
+    size_t pos = 0;
+    while (pos < s.size()) {
+      pos = s.find("$", pos);
+      if (pos == std::string::npos) break;
+      for (const auto& subst : substs) {
+        const std::string& token = subst.first;
+        const std::string& replacement = subst.second;
+        if (s.substr(pos + 1, token.size()) == token) {
+          s.replace(pos, token.size() + 1, replacement);
+          // -1 to compensate for the ++pos below.
+          pos += replacement.size() - 1;
+          break;
+        } else if (s.substr(pos + 1, token.size() + 2) == "{" + token + "}") {
+          s.replace(pos, token.size() + 3, replacement);
+          pos += replacement.size() - 1;
+          break;
+        }
+      }
+      // Skip $ in case it did not match any of the known substitutions.
+      ++pos;
+    }
+  }
+
+  resolve_paths(runpaths, &dt_runpath_);
+}
+
+const ElfW(Versym)* soinfo::get_versym(size_t n) const {
+  if (has_min_version(2) && versym_ != nullptr) {
+    return versym_ + n;
+  }
+
+  return nullptr;
+}
+
+ElfW(Addr) soinfo::get_verneed_ptr() const {
+  if (has_min_version(2)) {
+    return verneed_ptr_;
+  }
+
+  return 0;
+}
+
+size_t soinfo::get_verneed_cnt() const {
+  if (has_min_version(2)) {
+    return verneed_cnt_;
+  }
+
+  return 0;
+}
+
+ElfW(Addr) soinfo::get_verdef_ptr() const {
+  if (has_min_version(2)) {
+    return verdef_ptr_;
+  }
+
+  return 0;
+}
+
+size_t soinfo::get_verdef_cnt() const {
+  if (has_min_version(2)) {
+    return verdef_cnt_;
+  }
+
+  return 0;
+}
+
+bool soinfo::find_symbol_by_name(SymbolName& symbol_name,
+                                 const version_info* vi,
+                                 const ElfW(Sym)** symbol) const {
+  uint32_t symbol_index;
+  bool success =
+      is_gnu_hash() ?
+      gnu_lookup(symbol_name, vi, &symbol_index) :
+      elf_lookup(symbol_name, vi, &symbol_index);
+
+  if (success) {
+    *symbol = symbol_index == 0 ? nullptr : symtab_ + symbol_index;
+  }
+
+  return success;
+}
+
+static bool is_symbol_global_and_defined(const soinfo* si, const ElfW(Sym)* s) {
+  if (ELF_ST_BIND(s->st_info) == STB_GLOBAL ||
+      ELF_ST_BIND(s->st_info) == STB_WEAK) {
+    return s->st_shndx != SHN_UNDEF;
+  } else if (ELF_ST_BIND(s->st_info) != STB_LOCAL) {
+    DL_WARN("unexpected ST_BIND value: %d for \"%s\" in \"%s\"",
+            ELF_ST_BIND(s->st_info), si->get_string(s->st_name), si->get_realpath());
+  }
+
+  return false;
+}
+
+static const ElfW(Versym) kVersymHiddenBit = 0x8000;
+
+static inline bool is_versym_hidden(const ElfW(Versym)* versym) {
+  // the symbol is hidden if bit 15 of versym is set.
+  return versym != nullptr && (*versym & kVersymHiddenBit) != 0;
+}
+
+static inline bool check_symbol_version(const ElfW(Versym) verneed,
+                                        const ElfW(Versym)* verdef) {
+  return verneed == kVersymNotNeeded ||
+      verdef == nullptr ||
+      verneed == (*verdef & ~kVersymHiddenBit);
+}
+
+bool soinfo::gnu_lookup(SymbolName& symbol_name,
+                        const version_info* vi,
+                        uint32_t* symbol_index) const {
+  uint32_t hash = symbol_name.gnu_hash();
+  uint32_t h2 = hash >> gnu_shift2_;
+
+  uint32_t bloom_mask_bits = sizeof(ElfW(Addr))*8;
+  uint32_t word_num = (hash / bloom_mask_bits) & gnu_maskwords_;
+  ElfW(Addr) bloom_word = gnu_bloom_filter_[word_num];
+
+  *symbol_index = 0;
+
+  TRACE_TYPE(LOOKUP, "SEARCH %s in %s@%p (gnu)",
+      symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(base));
+
+  // test against bloom filter
+  if ((1 & (bloom_word >> (hash % bloom_mask_bits)) & (bloom_word >> (h2 % bloom_mask_bits))) == 0) {
+    TRACE_TYPE(LOOKUP, "NOT FOUND %s in %s@%p",
+        symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(base));
+
+    return true;
+  }
+
+  // bloom test says "probably yes"...
+  uint32_t n = gnu_bucket_[hash % gnu_nbucket_];
+
+  if (n == 0) {
+    TRACE_TYPE(LOOKUP, "NOT FOUND %s in %s@%p",
+        symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(base));
+
+    return true;
+  }
+
+  // lookup versym for the version definition in this library
+  // note the difference between "version is not requested" (vi == nullptr)
+  // and "version not found". In the first case verneed is kVersymNotNeeded
+  // which implies that the default version can be accepted; the second case results in
+  // verneed = 1 (kVersymGlobal) and implies that we should ignore versioned symbols
+  // for this library and consider only *global* ones.
+  ElfW(Versym) verneed = 0;
+  if (!find_verdef_version_index(this, vi, &verneed)) {
+    return false;
+  }
+
+  do {
+    ElfW(Sym)* s = symtab_ + n;
+    const ElfW(Versym)* verdef = get_versym(n);
+    // skip hidden versions when verneed == kVersymNotNeeded (0)
+    if (verneed == kVersymNotNeeded && is_versym_hidden(verdef)) {
+        continue;
+    }
+    if (((gnu_chain_[n] ^ hash) >> 1) == 0 &&
+        check_symbol_version(verneed, verdef) &&
+        strcmp(get_string(s->st_name), symbol_name.get_name()) == 0 &&
+        is_symbol_global_and_defined(this, s)) {
+      TRACE_TYPE(LOOKUP, "FOUND %s in %s (%p) %zd",
+          symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(s->st_value),
+          static_cast<size_t>(s->st_size));
+      *symbol_index = n;
+      return true;
+    }
+  } while ((gnu_chain_[n++] & 1) == 0);
+
+  TRACE_TYPE(LOOKUP, "NOT FOUND %s in %s@%p",
+             symbol_name.get_name(), get_realpath(), reinterpret_cast<void*>(base));
+
+  return true;
+}
+
+bool soinfo::elf_lookup(SymbolName& symbol_name,
+                        const version_info* vi,
+                        uint32_t* symbol_index) const {
+  uint32_t hash = symbol_name.elf_hash();
+
+  TRACE_TYPE(LOOKUP, "SEARCH %s in %s@%p h=%x(elf) %zd",
+             symbol_name.get_name(), get_realpath(),
+             reinterpret_cast<void*>(base), hash, hash % nbucket_);
+
+  ElfW(Versym) verneed = 0;
+  if (!find_verdef_version_index(this, vi, &verneed)) {
+    return false;
+  }
+
+  for (uint32_t n = bucket_[hash % nbucket_]; n != 0; n = chain_[n]) {
+    ElfW(Sym)* s = symtab_ + n;
+    const ElfW(Versym)* verdef = get_versym(n);
+
+    // skip hidden versions when verneed == 0
+    if (verneed == kVersymNotNeeded && is_versym_hidden(verdef)) {
+        continue;
+    }
+
+    if (check_symbol_version(verneed, verdef) &&
+        strcmp(get_string(s->st_name), symbol_name.get_name()) == 0 &&
+        is_symbol_global_and_defined(this, s)) {
+      TRACE_TYPE(LOOKUP, "FOUND %s in %s (%p) %zd",
+                 symbol_name.get_name(), get_realpath(),
+                 reinterpret_cast<void*>(s->st_value),
+                 static_cast<size_t>(s->st_size));
+      *symbol_index = n;
+      return true;
+    }
+  }
+
+  TRACE_TYPE(LOOKUP, "NOT FOUND %s in %s@%p %x %zd",
+             symbol_name.get_name(), get_realpath(),
+             reinterpret_cast<void*>(base), hash, hash % nbucket_);
+
+  *symbol_index = 0;
+  return true;
+}
+
+ElfW(Sym)* soinfo::find_symbol_by_address(const void* addr) {
+  return is_gnu_hash() ? gnu_addr_lookup(addr) : elf_addr_lookup(addr);
+}
+
+static bool symbol_matches_soaddr(const ElfW(Sym)* sym, ElfW(Addr) soaddr) {
+  return sym->st_shndx != SHN_UNDEF &&
+      soaddr >= sym->st_value &&
+      soaddr < sym->st_value + sym->st_size;
+}
+
+ElfW(Sym)* soinfo::gnu_addr_lookup(const void* addr) {
+  ElfW(Addr) soaddr = reinterpret_cast<ElfW(Addr)>(addr) - load_bias;
+
+  for (size_t i = 0; i < gnu_nbucket_; ++i) {
+    uint32_t n = gnu_bucket_[i];
+
+    if (n == 0) {
+      continue;
+    }
+
+    do {
+      ElfW(Sym)* sym = symtab_ + n;
+      if (symbol_matches_soaddr(sym, soaddr)) {
+        return sym;
+      }
+    } while ((gnu_chain_[n++] & 1) == 0);
+  }
+
+  return nullptr;
+}
+
+ElfW(Sym)* soinfo::elf_addr_lookup(const void* addr) {
+  ElfW(Addr) soaddr = reinterpret_cast<ElfW(Addr)>(addr) - load_bias;
+
+  // Search the library's symbol table for any defined symbol which
+  // contains this address.
+  for (size_t i = 0; i < nchain_; ++i) {
+    ElfW(Sym)* sym = symtab_ + i;
+    if (symbol_matches_soaddr(sym, soaddr)) {
+      return sym;
+    }
+  }
+
+  return nullptr;
+}
+
+static void call_function(const char* function_name __unused,
+                          linker_ctor_function_t function,
+                          const char* realpath __unused) {
+  if (function == nullptr || reinterpret_cast<uintptr_t>(function) == static_cast<uintptr_t>(-1)) {
+    return;
+  }
+
+  TRACE("[ Calling c-tor %s @ %p for '%s' ]", function_name, function, realpath);
+  function(g_argc, g_argv, g_envp);
+  TRACE("[ Done calling c-tor %s @ %p for '%s' ]", function_name, function, realpath);
+}
+
+static void call_function(const char* function_name __unused,
+                          linker_dtor_function_t function,
+                          const char* realpath __unused) {
+  if (function == nullptr || reinterpret_cast<uintptr_t>(function) == static_cast<uintptr_t>(-1)) {
+    return;
+  }
+
+  TRACE("[ Calling d-tor %s @ %p for '%s' ]", function_name, function, realpath);
+  function();
+  TRACE("[ Done calling d-tor %s @ %p for '%s' ]", function_name, function, realpath);
+}
+
+template <typename F>
+static void call_array(const char* array_name __unused,
+                       F* functions,
+                       size_t count,
+                       bool reverse,
+                       const char* realpath) {
+  if (functions == nullptr) {
+    return;
+  }
+
+  TRACE("[ Calling %s (size %zd) @ %p for '%s' ]", array_name, count, functions, realpath);
+
+  int begin = reverse ? (count - 1) : 0;
+  int end = reverse ? -1 : count;
+  int step = reverse ? -1 : 1;
+
+  for (int i = begin; i != end; i += step) {
+    TRACE("[ %s[%d] == %p ]", array_name, i, functions[i]);
+    call_function("function", functions[i], realpath);
+  }
+
+  TRACE("[ Done calling %s for '%s' ]", array_name, realpath);
+}
+
+void soinfo::call_pre_init_constructors() {
+  // DT_PREINIT_ARRAY functions are called before any other constructors for executables,
+  // but ignored in a shared library.
+  call_array("DT_PREINIT_ARRAY", preinit_array_, preinit_array_count_, false, get_realpath());
+}
+
+void soinfo::call_constructors() {
+  if (constructors_called) {
+    return;
+  }
+
+  // We set constructors_called before actually calling the constructors, otherwise it doesn't
+  // protect against recursive constructor calls. One simple example of constructor recursion
+  // is the libc debug malloc, which is implemented in libc_malloc_debug_leak.so:
+  // 1. The program depends on libc, so libc's constructor is called here.
+  // 2. The libc constructor calls dlopen() to load libc_malloc_debug_leak.so.
+  // 3. dlopen() calls the constructors on the newly created
+  //    soinfo for libc_malloc_debug_leak.so.
+  // 4. The debug .so depends on libc, so CallConstructors is
+  //    called again with the libc soinfo. If it doesn't trigger the early-
+  //    out above, the libc constructor will be called again (recursively!).
+  constructors_called = true;
+
+  if (!is_main_executable() && preinit_array_ != nullptr) {
+    // The GNU dynamic linker silently ignores these, but we warn the developer.
+    PRINT("\"%s\": ignoring DT_PREINIT_ARRAY in shared library!", get_realpath());
+  }
+
+  get_children().for_each([] (soinfo* si) {
+    si->call_constructors();
+  });
+
+  TRACE("\"%s\": calling constructors", get_realpath());
+
+  // DT_INIT should be called before DT_INIT_ARRAY if both are present.
+  call_function("DT_INIT", init_func_, get_realpath());
+  call_array("DT_INIT_ARRAY", init_array_, init_array_count_, false, get_realpath());
+}
+
+void soinfo::call_destructors() {
+  if (!constructors_called) {
+    return;
+  }
+  TRACE("\"%s\": calling destructors", get_realpath());
+
+  // DT_FINI_ARRAY must be parsed in reverse order.
+  call_array("DT_FINI_ARRAY", fini_array_, fini_array_count_, true, get_realpath());
+
+  // DT_FINI should be called after DT_FINI_ARRAY if both are present.
+  call_function("DT_FINI", fini_func_, get_realpath());
+}
+
+void soinfo::add_child(soinfo* child) {
+  if (has_min_version(0)) {
+    child->parents_.push_back(this);
+    this->children_.push_back(child);
+  }
+}
+
+void soinfo::remove_all_links() {
+  if (!has_min_version(0)) {
+    return;
+  }
+
+  // 1. Untie connected soinfos from 'this'.
+  children_.for_each([&] (soinfo* child) {
+    child->parents_.remove_if([&] (const soinfo* parent) {
+      return parent == this;
+    });
+  });
+
+  parents_.for_each([&] (soinfo* parent) {
+    parent->children_.remove_if([&] (const soinfo* child) {
+      return child == this;
+    });
+  });
+
+  // 2. Remove from the primary namespace
+  primary_namespace_->remove_soinfo(this);
+  primary_namespace_ = nullptr;
+
+  // 3. Remove from secondary namespaces
+  secondary_namespaces_.for_each([&](android_namespace_t* ns) {
+    ns->remove_soinfo(this);
+  });
+
+
+  // 4. Once everything untied - clear local lists.
+  parents_.clear();
+  children_.clear();
+  secondary_namespaces_.clear();
+}
+
+dev_t soinfo::get_st_dev() const {
+  if (has_min_version(0)) {
+    return st_dev_;
+  }
+
+  return 0;
+};
+
+ino_t soinfo::get_st_ino() const {
+  if (has_min_version(0)) {
+    return st_ino_;
+  }
+
+  return 0;
+}
+
+off64_t soinfo::get_file_offset() const {
+  if (has_min_version(1)) {
+    return file_offset_;
+  }
+
+  return 0;
+}
+
+uint32_t soinfo::get_rtld_flags() const {
+  if (has_min_version(1)) {
+    return rtld_flags_;
+  }
+
+  return 0;
+}
+
+uint32_t soinfo::get_dt_flags_1() const {
+  if (has_min_version(1)) {
+    return dt_flags_1_;
+  }
+
+  return 0;
+}
+
+void soinfo::set_dt_flags_1(uint32_t dt_flags_1) {
+  if (has_min_version(1)) {
+    if ((dt_flags_1 & DF_1_GLOBAL) != 0) {
+      rtld_flags_ |= RTLD_GLOBAL;
+    }
+
+    if ((dt_flags_1 & DF_1_NODELETE) != 0) {
+      rtld_flags_ |= RTLD_NODELETE;
+    }
+
+    dt_flags_1_ = dt_flags_1;
+  }
+}
+
+void soinfo::set_nodelete() {
+  rtld_flags_ |= RTLD_NODELETE;
+}
+
+const char* soinfo::get_realpath() const {
+#if defined(__work_around_b_24465209__)
+  if (has_min_version(2)) {
+    return realpath_.c_str();
+  } else {
+    return old_name_;
+  }
+#else
+  return realpath_.c_str();
+#endif
+}
+
+void soinfo::set_soname(const char* soname) {
+#if defined(__work_around_b_24465209__)
+  if (has_min_version(2)) {
+    soname_ = soname;
+  }
+  strlcpy(old_name_, soname_, sizeof(old_name_));
+#else
+  soname_ = soname;
+#endif
+}
+
+const char* soinfo::get_soname() const {
+#if defined(__work_around_b_24465209__)
+  if (has_min_version(2)) {
+    return soname_;
+  } else {
+    return old_name_;
+  }
+#else
+  return soname_;
+#endif
+}
+
+// This is a return on get_children()/get_parents() if
+// 'this->flags' does not have FLAG_NEW_SOINFO set.
+static soinfo_list_t g_empty_list;
+
+soinfo_list_t& soinfo::get_children() {
+  if (has_min_version(0)) {
+    return children_;
+  }
+
+  return g_empty_list;
+}
+
+const soinfo_list_t& soinfo::get_children() const {
+  if (has_min_version(0)) {
+    return children_;
+  }
+
+  return g_empty_list;
+}
+
+soinfo_list_t& soinfo::get_parents() {
+  if (has_min_version(0)) {
+    return parents_;
+  }
+
+  return g_empty_list;
+}
+
+static std::vector<std::string> g_empty_runpath;
+
+const std::vector<std::string>& soinfo::get_dt_runpath() const {
+  if (has_min_version(3)) {
+    return dt_runpath_;
+  }
+
+  return g_empty_runpath;
+}
+
+android_namespace_t* soinfo::get_primary_namespace() {
+  if (has_min_version(3)) {
+    return primary_namespace_;
+  }
+
+  return &g_default_namespace;
+}
+
+void soinfo::add_secondary_namespace(android_namespace_t* secondary_ns) {
+  CHECK(has_min_version(3));
+  secondary_namespaces_.push_back(secondary_ns);
+}
+
+ElfW(Addr) soinfo::resolve_symbol_address(const ElfW(Sym)* s) const {
+  if (ELF_ST_TYPE(s->st_info) == STT_GNU_IFUNC) {
+    return call_ifunc_resolver(s->st_value + load_bias);
+  }
+
+  return static_cast<ElfW(Addr)>(s->st_value + load_bias);
+}
+
+const char* soinfo::get_string(ElfW(Word) index) const {
+  if (has_min_version(1) && (index >= strtab_size_)) {
+    __libc_fatal("%s: strtab out of bounds error; STRSZ=%zd, name=%d",
+        get_realpath(), strtab_size_, index);
+  }
+
+  return strtab_ + index;
+}
+
+bool soinfo::is_gnu_hash() const {
+  return (flags_ & FLAG_GNU_HASH) != 0;
+}
+
+bool soinfo::can_unload() const {
+  return !is_linked() || ((get_rtld_flags() & (RTLD_NODELETE | RTLD_GLOBAL)) == 0);
+}
+
+bool soinfo::is_linked() const {
+  return (flags_ & FLAG_LINKED) != 0;
+}
+
+bool soinfo::is_main_executable() const {
+  return (flags_ & FLAG_EXE) != 0;
+}
+
+bool soinfo::is_linker() const {
+  return (flags_ & FLAG_LINKER) != 0;
+}
+
+void soinfo::set_linked() {
+  flags_ |= FLAG_LINKED;
+}
+
+void soinfo::set_linker_flag() {
+  flags_ |= FLAG_LINKER;
+}
+
+void soinfo::set_main_executable() {
+  flags_ |= FLAG_EXE;
+}
+
+void soinfo::increment_ref_count() {
+  local_group_root_->ref_count_++;
+}
+
+size_t soinfo::decrement_ref_count() {
+  return --local_group_root_->ref_count_;
+}
+
+soinfo* soinfo::get_local_group_root() const {
+  return local_group_root_;
+}
+
+
+void soinfo::set_mapped_by_caller(bool mapped_by_caller) {
+  if (mapped_by_caller) {
+    flags_ |= FLAG_MAPPED_BY_CALLER;
+  } else {
+    flags_ &= ~FLAG_MAPPED_BY_CALLER;
+  }
+}
+
+bool soinfo::is_mapped_by_caller() const {
+  return (flags_ & FLAG_MAPPED_BY_CALLER) != 0;
+}
+
+// This function returns api-level at the time of
+// dlopen/load. Note that libraries opened by system
+// will always have 'current' api level.
+uint32_t soinfo::get_target_sdk_version() const {
+  if (!has_min_version(2)) {
+    return __ANDROID_API__;
+  }
+
+  return local_group_root_->target_sdk_version_;
+}
+
+uintptr_t soinfo::get_handle() const {
+  CHECK(has_min_version(3));
+  CHECK(handle_ != 0);
+  return handle_;
+}
+
+void* soinfo::to_handle() {
+  if (get_application_target_sdk_version() <= 23 || !has_min_version(3)) {
+    return this;
+  }
+
+  return reinterpret_cast<void*>(get_handle());
+}
+
+void soinfo::generate_handle() {
+  CHECK(has_min_version(3));
+  CHECK(handle_ == 0); // Make sure this is the first call
+
+  // Make sure the handle is unique and does not collide
+  // with special values which are RTLD_DEFAULT and RTLD_NEXT.
+  do {
+    arc4random_buf(&handle_, sizeof(handle_));
+    // the least significant bit for the handle is always 1
+    // making it easy to test the type of handle passed to
+    // dl* functions.
+    handle_ = handle_ | 1;
+  } while (handle_ == reinterpret_cast<uintptr_t>(RTLD_DEFAULT) ||
+           handle_ == reinterpret_cast<uintptr_t>(RTLD_NEXT) ||
+           g_soinfo_handles_map.find(handle_) != g_soinfo_handles_map.end());
+
+  g_soinfo_handles_map[handle_] = this;
+}
+
+// TODO(dimitry): Move SymbolName methods to a separate file.
+
+uint32_t calculate_elf_hash(const char* name) {
+  const uint8_t* name_bytes = reinterpret_cast<const uint8_t*>(name);
+  uint32_t h = 0, g;
+
+  while (*name_bytes) {
+    h = (h << 4) + *name_bytes++;
+    g = h & 0xf0000000;
+    h ^= g;
+    h ^= g >> 24;
+  }
+
+  return h;
+}
+
+uint32_t SymbolName::elf_hash() {
+  if (!has_elf_hash_) {
+    elf_hash_ = calculate_elf_hash(name_);
+    has_elf_hash_ = true;
+  }
+
+  return elf_hash_;
+}
+
+uint32_t SymbolName::gnu_hash() {
+  if (!has_gnu_hash_) {
+    uint32_t h = 5381;
+    const uint8_t* name = reinterpret_cast<const uint8_t*>(name_);
+    while (*name != 0) {
+      h += (h << 5) + *name++; // h*33 + c = h + h * 32 + c = h + h << 5 + c
+    }
+
+    gnu_hash_ =  h;
+    has_gnu_hash_ = true;
+  }
+
+  return gnu_hash_;
+}
+
+
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
new file mode 100644
index 0000000..d7b584e
--- /dev/null
+++ b/linker/linker_soinfo.h
@@ -0,0 +1,345 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef __LINKER_SOINFO_H
+#define __LINKER_SOINFO_H
+
+#include <link.h>
+
+#include <string>
+
+#include "linker_namespaces.h"
+
+#define FLAG_LINKED           0x00000001
+#define FLAG_EXE              0x00000004 // The main executable
+#define FLAG_LINKER           0x00000010 // The linker itself
+#define FLAG_GNU_HASH         0x00000040 // uses gnu hash
+#define FLAG_MAPPED_BY_CALLER 0x00000080 // the map is reserved by the caller
+                                         // and should not be unmapped
+#define FLAG_NEW_SOINFO       0x40000000 // new soinfo format
+
+#define SOINFO_VERSION 3
+
+typedef void (*linker_dtor_function_t)();
+typedef void (*linker_ctor_function_t)(int, char**, char**);
+
+class SymbolName {
+ public:
+  explicit SymbolName(const char* name)
+      : name_(name), has_elf_hash_(false), has_gnu_hash_(false),
+        elf_hash_(0), gnu_hash_(0) { }
+
+  const char* get_name() {
+    return name_;
+  }
+
+  uint32_t elf_hash();
+  uint32_t gnu_hash();
+
+ private:
+  const char* name_;
+  bool has_elf_hash_;
+  bool has_gnu_hash_;
+  uint32_t elf_hash_;
+  uint32_t gnu_hash_;
+
+  DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolName);
+};
+
+struct version_info {
+  constexpr version_info() : elf_hash(0), name(nullptr), target_si(nullptr) {}
+
+  uint32_t elf_hash;
+  const char* name;
+  const soinfo* target_si;
+};
+
+// TODO(dimitry): remove reference from soinfo member functions to this class.
+class VersionTracker;
+
+#if defined(__work_around_b_24465209__)
+#define SOINFO_NAME_LEN 128
+#endif
+
+struct soinfo {
+#if defined(__work_around_b_24465209__)
+ private:
+  char old_name_[SOINFO_NAME_LEN];
+#endif
+ public:
+  const ElfW(Phdr)* phdr;
+  size_t phnum;
+#if defined(__work_around_b_24465209__)
+  ElfW(Addr) unused0; // DO NOT USE, maintained for compatibility.
+#endif
+  ElfW(Addr) base;
+  size_t size;
+
+#if defined(__work_around_b_24465209__)
+  uint32_t unused1;  // DO NOT USE, maintained for compatibility.
+#endif
+
+  ElfW(Dyn)* dynamic;
+
+#if defined(__work_around_b_24465209__)
+  uint32_t unused2; // DO NOT USE, maintained for compatibility
+  uint32_t unused3; // DO NOT USE, maintained for compatibility
+#endif
+
+  soinfo* next;
+ private:
+  uint32_t flags_;
+
+  const char* strtab_;
+  ElfW(Sym)* symtab_;
+
+  size_t nbucket_;
+  size_t nchain_;
+  uint32_t* bucket_;
+  uint32_t* chain_;
+
+#if defined(__mips__) || !defined(__LP64__)
+  // This is only used by mips and mips64, but needs to be here for
+  // all 32-bit architectures to preserve binary compatibility.
+  ElfW(Addr)** plt_got_;
+#endif
+
+#if defined(USE_RELA)
+  ElfW(Rela)* plt_rela_;
+  size_t plt_rela_count_;
+
+  ElfW(Rela)* rela_;
+  size_t rela_count_;
+#else
+  ElfW(Rel)* plt_rel_;
+  size_t plt_rel_count_;
+
+  ElfW(Rel)* rel_;
+  size_t rel_count_;
+#endif
+
+  linker_ctor_function_t* preinit_array_;
+  size_t preinit_array_count_;
+
+  linker_ctor_function_t* init_array_;
+  size_t init_array_count_;
+  linker_dtor_function_t* fini_array_;
+  size_t fini_array_count_;
+
+  linker_ctor_function_t init_func_;
+  linker_dtor_function_t fini_func_;
+
+#if defined(__arm__)
+ public:
+  // ARM EABI section used for stack unwinding.
+  uint32_t* ARM_exidx;
+  size_t ARM_exidx_count;
+ private:
+#elif defined(__mips__)
+  uint32_t mips_symtabno_;
+  uint32_t mips_local_gotno_;
+  uint32_t mips_gotsym_;
+  bool mips_relocate_got(const VersionTracker& version_tracker,
+                         const soinfo_list_t& global_group,
+                         const soinfo_list_t& local_group);
+#if !defined(__LP64__)
+  bool mips_check_and_adjust_fp_modes();
+#endif
+#endif
+  size_t ref_count_;
+ public:
+  link_map link_map_head;
+
+  bool constructors_called;
+
+  // When you read a virtual address from the ELF file, add this
+  // value to get the corresponding address in the process' address space.
+  ElfW(Addr) load_bias;
+
+#if !defined(__LP64__)
+  bool has_text_relocations;
+#endif
+  bool has_DT_SYMBOLIC;
+
+ public:
+  soinfo(android_namespace_t* ns, const char* name, const struct stat* file_stat,
+         off64_t file_offset, int rtld_flags);
+  ~soinfo();
+
+  void call_constructors();
+  void call_destructors();
+  void call_pre_init_constructors();
+  bool prelink_image();
+  bool link_image(const soinfo_list_t& global_group, const soinfo_list_t& local_group,
+                  const android_dlextinfo* extinfo);
+  bool protect_relro();
+
+  void add_child(soinfo* child);
+  void remove_all_links();
+
+  ino_t get_st_ino() const;
+  dev_t get_st_dev() const;
+  off64_t get_file_offset() const;
+
+  uint32_t get_rtld_flags() const;
+  uint32_t get_dt_flags_1() const;
+  void set_dt_flags_1(uint32_t dt_flags_1);
+
+  soinfo_list_t& get_children();
+  const soinfo_list_t& get_children() const;
+
+  soinfo_list_t& get_parents();
+
+  bool find_symbol_by_name(SymbolName& symbol_name,
+                           const version_info* vi,
+                           const ElfW(Sym)** symbol) const;
+
+  ElfW(Sym)* find_symbol_by_address(const void* addr);
+  ElfW(Addr) resolve_symbol_address(const ElfW(Sym)* s) const;
+
+  const char* get_string(ElfW(Word) index) const;
+  bool can_unload() const;
+  bool is_gnu_hash() const;
+
+  bool inline has_min_version(uint32_t min_version __unused) const {
+#if defined(__work_around_b_24465209__)
+    return (flags_ & FLAG_NEW_SOINFO) != 0 && version_ >= min_version;
+#else
+    return true;
+#endif
+  }
+
+  bool is_linked() const;
+  bool is_linker() const;
+  bool is_main_executable() const;
+
+  void set_linked();
+  void set_linker_flag();
+  void set_main_executable();
+  void set_nodelete();
+
+  void increment_ref_count();
+  size_t decrement_ref_count();
+
+  soinfo* get_local_group_root() const;
+
+  void set_soname(const char* soname);
+  const char* get_soname() const;
+  const char* get_realpath() const;
+  const ElfW(Versym)* get_versym(size_t n) const;
+  ElfW(Addr) get_verneed_ptr() const;
+  size_t get_verneed_cnt() const;
+  ElfW(Addr) get_verdef_ptr() const;
+  size_t get_verdef_cnt() const;
+
+  uint32_t get_target_sdk_version() const;
+
+  void set_dt_runpath(const char *);
+  const std::vector<std::string>& get_dt_runpath() const;
+  android_namespace_t* get_primary_namespace();
+  void add_secondary_namespace(android_namespace_t* secondary_ns);
+
+  void set_mapped_by_caller(bool reserved_map);
+  bool is_mapped_by_caller() const;
+
+  uintptr_t get_handle() const;
+  void generate_handle();
+  void* to_handle();
+
+ private:
+  bool elf_lookup(SymbolName& symbol_name, const version_info* vi, uint32_t* symbol_index) const;
+  ElfW(Sym)* elf_addr_lookup(const void* addr);
+  bool gnu_lookup(SymbolName& symbol_name, const version_info* vi, uint32_t* symbol_index) const;
+  ElfW(Sym)* gnu_addr_lookup(const void* addr);
+
+  bool lookup_version_info(const VersionTracker& version_tracker, ElfW(Word) sym,
+                           const char* sym_name, const version_info** vi);
+
+  template<typename ElfRelIteratorT>
+  bool relocate(const VersionTracker& version_tracker, ElfRelIteratorT&& rel_iterator,
+                const soinfo_list_t& global_group, const soinfo_list_t& local_group);
+
+ private:
+  // This part of the structure is only available
+  // when FLAG_NEW_SOINFO is set in this->flags.
+  uint32_t version_;
+
+  // version >= 0
+  dev_t st_dev_;
+  ino_t st_ino_;
+
+  // dependency graph
+  soinfo_list_t children_;
+  soinfo_list_t parents_;
+
+  // version >= 1
+  off64_t file_offset_;
+  uint32_t rtld_flags_;
+  uint32_t dt_flags_1_;
+  size_t strtab_size_;
+
+  // version >= 2
+
+  size_t gnu_nbucket_;
+  uint32_t* gnu_bucket_;
+  uint32_t* gnu_chain_;
+  uint32_t gnu_maskwords_;
+  uint32_t gnu_shift2_;
+  ElfW(Addr)* gnu_bloom_filter_;
+
+  soinfo* local_group_root_;
+
+  uint8_t* android_relocs_;
+  size_t android_relocs_size_;
+
+  const char* soname_;
+  std::string realpath_;
+
+  const ElfW(Versym)* versym_;
+
+  ElfW(Addr) verdef_ptr_;
+  size_t verdef_cnt_;
+
+  ElfW(Addr) verneed_ptr_;
+  size_t verneed_cnt_;
+
+  uint32_t target_sdk_version_;
+
+  // version >= 3
+  std::vector<std::string> dt_runpath_;
+  android_namespace_t* primary_namespace_;
+  android_namespace_list_t secondary_namespaces_;
+  uintptr_t handle_;
+
+  friend soinfo* get_libdl_info();
+};
+
+// This function is used by dlvsym() to calculate hash of sym_ver
+uint32_t calculate_elf_hash(const char* name);
+
+#endif  /* __LINKER_SOINFO_H */
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp
index fb070ee..e7447e4 100644
--- a/linker/linker_utils.cpp
+++ b/linker/linker_utils.cpp
@@ -15,7 +15,26 @@
  */
 
 #include "linker_utils.h"
+
 #include "linker_debug.h"
+#include "linker_globals.h"
+
+#include "android-base/strings.h"
+
+#include <sys/stat.h>
+#include <unistd.h>
+
+std::string dirname(const char* path) {
+  const char* last_slash = strrchr(path, '/');
+
+  if (last_slash == path) {
+    return "/";
+  } else if (last_slash == nullptr) {
+    return ".";
+  } else {
+    return std::string(path, last_slash - path);
+  }
+}
 
 bool normalize_path(const char* path, std::string* normalized_path) {
   // Input should be an absolute path
@@ -134,3 +153,52 @@
   return static_cast<size_t>(offset & (PAGE_SIZE-1));
 }
 
+void split_path(const char* path, const char* delimiters,
+                std::vector<std::string>* paths) {
+  if (path != nullptr && path[0] != 0) {
+    *paths = android::base::Split(path, delimiters);
+  }
+}
+
+void resolve_paths(std::vector<std::string>& paths,
+                   std::vector<std::string>* resolved_paths) {
+  resolved_paths->clear();
+  for (const auto& path : paths) {
+    char resolved_path[PATH_MAX];
+    const char* original_path = path.c_str();
+    if (realpath(original_path, resolved_path) != nullptr) {
+      struct stat s;
+      if (stat(resolved_path, &s) == 0) {
+        if (S_ISDIR(s.st_mode)) {
+          resolved_paths->push_back(resolved_path);
+        } else {
+          DL_WARN("Warning: \"%s\" is not a directory (excluding from path)", resolved_path);
+          continue;
+        }
+      } else {
+        DL_WARN("Warning: cannot stat file \"%s\": %s", resolved_path, strerror(errno));
+        continue;
+      }
+    } else {
+      std::string zip_path;
+      std::string entry_path;
+
+      std::string normalized_path;
+
+      if (!normalize_path(original_path, &normalized_path)) {
+        DL_WARN("Warning: unable to normalize \"%s\"", original_path);
+        continue;
+      }
+
+      if (parse_zip_path(normalized_path.c_str(), &zip_path, &entry_path)) {
+        if (realpath(zip_path.c_str(), resolved_path) == nullptr) {
+          DL_WARN("Warning: unable to resolve \"%s\": %s", zip_path.c_str(), strerror(errno));
+          continue;
+        }
+
+        resolved_paths->push_back(std::string(resolved_path) + kZipFileSeparator + entry_path);
+      }
+    }
+  }
+}
+
diff --git a/linker/linker_utils.h b/linker/linker_utils.h
index 987eabd..2e015a5 100644
--- a/linker/linker_utils.h
+++ b/linker/linker_utils.h
@@ -17,14 +17,25 @@
 #define __LINKER_UTILS_H
 
 #include <string>
+#include <vector>
 
 extern const char* const kZipFileSeparator;
 
-bool normalize_path(const char* path, std::string* normalized_path);
 bool file_is_in_dir(const std::string& file, const std::string& dir);
 bool file_is_under_dir(const std::string& file, const std::string& dir);
+bool normalize_path(const char* path, std::string* normalized_path);
 bool parse_zip_path(const char* input_path, std::string* zip_path, std::string* entry_path);
 
+// For every path element this function checks of it exists, and is a directory,
+// and normalizes it:
+// 1. For regular path it converts it to realpath()
+// 2. For path in a zip file it uses realpath on the zipfile
+//    normalizes entry name by calling normalize_path function.
+void resolve_paths(std::vector<std::string>& paths, std::vector<std::string>* resolved_paths);
+void split_path(const char* path, const char* delimiters, std::vector<std::string>* paths);
+
+std::string dirname(const char* path);
+
 off64_t page_start(off64_t offset);
 size_t page_offset(off64_t offset);
 bool safe_add(off64_t* out, off64_t a, size_t b);
diff --git a/linker/tests/Android.mk b/linker/tests/Android.mk
index 48c6374..d5b57f1 100644
--- a/linker/tests/Android.mk
+++ b/linker/tests/Android.mk
@@ -40,4 +40,6 @@
 # for __libc_fatal
 LOCAL_SRC_FILES += ../../libc/bionic/libc_logging.cpp
 
+LOCAL_STATIC_LIBRARIES += libbase
+
 include $(BUILD_NATIVE_TEST)
diff --git a/tests/Android.mk b/tests/Android.mk
index 0da3b88..b329831 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -16,6 +16,20 @@
 
 LOCAL_PATH := $(call my-dir)
 
+# Move prebuilt test elf-files to $(TARGET_OUT_NATIVE_TESTS)
+include $(CLEAR_VARS)
+LOCAL_MULTILIB := both
+LOCAL_MODULE := libtest_invalid-rw_load_segment.so
+LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/prebuilt-elf-files
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/prebuilt-elf-files
+LOCAL_MODULE_CLASS := SHARED_LIBRARY
+
+LOCAL_SRC_FILES_arm := prebuilt-elf-files/arm/$(LOCAL_MODULE)
+LOCAL_SRC_FILES_arm64 := prebuilt-elf-files/arm64/$(LOCAL_MODULE)
+LOCAL_SRC_FILES_x86 := prebuilt-elf-files/x86/$(LOCAL_MODULE)
+LOCAL_SRC_FILES_x86_64 := prebuilt-elf-files/x86_64/$(LOCAL_MODULE)
+include $(BUILD_PREBUILT)
+
 ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
 build_host := true
 else
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 5bf5861..a1c5801 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -1142,3 +1142,23 @@
 
   dlclose(handle);
 }
+
+// Bionic specific tests
+#if defined(__BIONIC__)
+
+#if defined(__LP64__)
+#define NATIVE_TESTS_PATH "/nativetest64"
+#else
+#define NATIVE_TESTS_PATH "/nativetest"
+#endif
+
+#define PREBUILT_ELF_PATH NATIVE_TESTS_PATH "/prebuilt-elf-files"
+
+TEST(dlfcn, dlopen_invalid_rw_load_segment) {
+  std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-rw_load_segment.so";
+  void* handle = dlopen(libpath.c_str(), RTLD_NOW);
+  ASSERT_TRUE(handle == nullptr);
+  std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\": W + E load segments are not allowed";
+  ASSERT_STREQ(expected_dlerror.c_str(), dlerror());
+}
+#endif
diff --git a/tests/prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so b/tests/prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so
new file mode 100755
index 0000000..00d91ff
--- /dev/null
+++ b/tests/prebuilt-elf-files/arm/libtest_invalid-rw_load_segment.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so b/tests/prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so
new file mode 100755
index 0000000..f61d2ed
--- /dev/null
+++ b/tests/prebuilt-elf-files/arm64/libtest_invalid-rw_load_segment.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so b/tests/prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so
new file mode 100755
index 0000000..7a343c9
--- /dev/null
+++ b/tests/prebuilt-elf-files/x86/libtest_invalid-rw_load_segment.so
Binary files differ
diff --git a/tests/prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so b/tests/prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so
new file mode 100755
index 0000000..b39d0ca
--- /dev/null
+++ b/tests/prebuilt-elf-files/x86_64/libtest_invalid-rw_load_segment.so
Binary files differ
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp
index 8747dfc..ecba4ad 100644
--- a/tests/stdio_test.cpp
+++ b/tests/stdio_test.cpp
@@ -29,14 +29,20 @@
 
 #include <vector>
 
+#include "BionicDeathTest.h"
 #include "TemporaryFile.h"
 
 #if defined(NOFORTIFY)
 #define STDIO_TEST stdio_nofortify
+#define STDIO_DEATHTEST stdio_nofortify_DeathTest
 #else
 #define STDIO_TEST stdio
+#define STDIO_DEATHTEST stdio_DeathTest
 #endif
 
+class stdio_DeathTest : public BionicDeathTest {};
+class stdio_nofortify_DeathTest : public BionicDeathTest {};
+
 static void AssertFileIs(FILE* fp, const char* expected, bool is_fmemopen = false) {
   rewind(fp);
 
@@ -1329,3 +1335,28 @@
   ASSERT_EQ(-1, remove(td.dirname));
   ASSERT_EQ(ENOENT, errno);
 }
+
+TEST(STDIO_DEATHTEST, snprintf_30445072_known_buffer_size) {
+  char buf[16];
+  ASSERT_EXIT(snprintf(buf, atol("-1"), "hello"),
+              testing::KilledBySignal(SIGABRT),
+#if defined(NOFORTIFY)
+              "FORTIFY: vsnprintf: size .* > SSIZE_MAX"
+#else
+              "FORTIFY: vsnprintf: prevented .*-byte write into 16-byte buffer"
+#endif
+              );
+}
+
+TEST(STDIO_DEATHTEST, snprintf_30445072_unknown_buffer_size) {
+  std::string buf = "world";
+  ASSERT_EXIT(snprintf(&buf[0], atol("-1"), "hello"),
+              testing::KilledBySignal(SIGABRT),
+              "FORTIFY: vsnprintf: size .* > SSIZE_MAX");
+}
+
+TEST(STDIO_TEST, sprintf_30445072) {
+  std::string buf = "world";
+  sprintf(&buf[0], "hello");
+  ASSERT_EQ(buf, "hello");
+}
diff --git a/tests/sys_sysinfo_test.cpp b/tests/sys_sysinfo_test.cpp
index b00e13f..d7d0f6e 100644
--- a/tests/sys_sysinfo_test.cpp
+++ b/tests/sys_sysinfo_test.cpp
@@ -17,17 +17,28 @@
 #include <gtest/gtest.h>
 
 #include <sys/sysinfo.h>
+#include <unistd.h>
 
 TEST(sys_sysinfo, smoke) {
-  int nprocessor = get_nprocs();
-  ASSERT_GT(nprocessor, 0);
+  int nprocs = get_nprocs();
+  ASSERT_GT(nprocs, 0);
+  ASSERT_EQ(sysconf(_SC_NPROCESSORS_ONLN), nprocs);
 
-  int nprocessor_conf = get_nprocs_conf();
-  ASSERT_GE(nprocessor_conf, nprocessor);
+  int nprocs_conf = get_nprocs_conf();
+  ASSERT_GE(nprocs_conf, nprocs);
+  ASSERT_EQ(sysconf(_SC_NPROCESSORS_CONF), nprocs_conf);
 
   long avail_phys_pages = get_avphys_pages();
   ASSERT_GT(avail_phys_pages, 0);
+  ASSERT_EQ(sysconf(_SC_AVPHYS_PAGES), avail_phys_pages);
 
   long phys_pages = get_phys_pages();
   ASSERT_GE(phys_pages, avail_phys_pages);
+  ASSERT_EQ(sysconf(_SC_PHYS_PAGES), phys_pages);
+}
+
+TEST(sys_sysinfo, sysinfo) {
+  struct sysinfo si;
+  memset(&si, 0, sizeof(si));
+  ASSERT_EQ(0, sysinfo(&si));
 }
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index 3a87e88..32b1626 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -857,6 +857,39 @@
   ASSERT_EQ(online_cpus, sysconf(_SC_NPROCESSORS_ONLN));
 }
 
+TEST(UNISTD_TEST, sysconf_SC_ARG_MAX) {
+  // Since Linux 2.6.23, ARG_MAX isn't a constant and depends on RLIMIT_STACK.
+
+  // Get our current limit, and set things up so we restore the limit.
+  rlimit rl;
+  ASSERT_EQ(0, getrlimit(RLIMIT_STACK, &rl));
+  uint64_t original_rlim_cur = rl.rlim_cur;
+  if (rl.rlim_cur == RLIM_INFINITY) {
+    rl.rlim_cur = 8 * 1024 * 1024; // Bionic reports unlimited stacks as 8MiB.
+  }
+  auto guard = make_scope_guard([&rl, original_rlim_cur]() {
+    rl.rlim_cur = original_rlim_cur;
+    ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl));
+  });
+
+  // _SC_ARG_MAX should be 1/4 the stack size.
+  EXPECT_EQ(static_cast<long>(rl.rlim_cur / 4), sysconf(_SC_ARG_MAX));
+
+  // If you have a really small stack, the kernel still guarantees "32 pages" (fs/exec.c).
+  rl.rlim_cur = 1024;
+  rl.rlim_max = RLIM_INFINITY;
+  ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl));
+
+  EXPECT_EQ(static_cast<long>(32 * sysconf(_SC_PAGE_SIZE)), sysconf(_SC_ARG_MAX));
+
+  // With a 128-page stack limit, we know exactly what _SC_ARG_MAX should be...
+  rl.rlim_cur = 128 * sysconf(_SC_PAGE_SIZE);
+  rl.rlim_max = RLIM_INFINITY;
+  ASSERT_EQ(0, setrlimit(RLIMIT_STACK, &rl));
+
+  EXPECT_EQ(static_cast<long>((128 * sysconf(_SC_PAGE_SIZE)) / 4), sysconf(_SC_ARG_MAX));
+}
+
 TEST(UNISTD_TEST, dup2_same) {
   // POSIX says of dup2:
   // If fildes2 is already a valid open file descriptor ...