Merge "Reset access to system properties on reinitialization"
diff --git a/libc/Android.mk b/libc/Android.mk
index ba3e5aa..a399b89 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -697,6 +697,9 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := bionic/__stack_chk_fail.cpp
+# On x86, the __set_tls implementation is complex enough that
+# -fstack-protector-strong inserts a check.
+LOCAL_SRC_FILES_x86 := arch-x86/bionic/__set_tls.c
 LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
 LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
 LOCAL_CPPFLAGS := $(libc_common_cppflags)
@@ -1383,6 +1386,9 @@
     $(LOCAL_PATH)/libc.mips64.map \
     $(LOCAL_PATH)/libc.x86.map \
     $(LOCAL_PATH)/libc.x86_64.map \
+    $(LOCAL_PATH)/libc.arm.brillo.map \
+    $(LOCAL_PATH)/libc.mips.brillo.map \
+    $(LOCAL_PATH)/libc.x86.brillo.map \
 
 # Leave the symbols in the shared library so that stack unwinders can produce
 # meaningful name resolution.
@@ -1414,11 +1420,18 @@
 LOCAL_LDFLAGS_x86 := -Wl,--hash-style=both
 
 # Don't re-export new/delete and friends, even if the compiler really wants to.
+ifdef BRILLO
+LOCAL_LDFLAGS_arm    += -Wl,--version-script,$(LOCAL_PATH)/libc.arm.brillo.map
+LOCAL_LDFLAGS_mips   += -Wl,--version-script,$(LOCAL_PATH)/libc.mips.brillo.map
+LOCAL_LDFLAGS_x86    += -Wl,--version-script,$(LOCAL_PATH)/libc.x86.brillo.map
+else
 LOCAL_LDFLAGS_arm    += -Wl,--version-script,$(LOCAL_PATH)/libc.arm.map
-LOCAL_LDFLAGS_arm64  += -Wl,--version-script,$(LOCAL_PATH)/libc.arm64.map
 LOCAL_LDFLAGS_mips   += -Wl,--version-script,$(LOCAL_PATH)/libc.mips.map
-LOCAL_LDFLAGS_mips64 += -Wl,--version-script,$(LOCAL_PATH)/libc.mips64.map
 LOCAL_LDFLAGS_x86    += -Wl,--version-script,$(LOCAL_PATH)/libc.x86.map
+endif
+
+LOCAL_LDFLAGS_arm64  += -Wl,--version-script,$(LOCAL_PATH)/libc.arm64.map
+LOCAL_LDFLAGS_mips64 += -Wl,--version-script,$(LOCAL_PATH)/libc.mips64.map
 LOCAL_LDFLAGS_x86_64 += -Wl,--version-script,$(LOCAL_PATH)/libc.x86_64.map
 
 # We'd really like to do this for all architectures, but since this wasn't done
diff --git a/libc/arch-x86/x86.mk b/libc/arch-x86/x86.mk
index b4056bb..1d717aa 100644
--- a/libc/arch-x86/x86.mk
+++ b/libc/arch-x86/x86.mk
@@ -109,7 +109,6 @@
     arch-x86/bionic/libgcc_compat.c \
     arch-x86/bionic/__restore.S \
     arch-x86/bionic/setjmp.S \
-    arch-x86/bionic/__set_tls.c \
     arch-x86/bionic/syscall.S \
     arch-x86/bionic/vfork.S \
 
diff --git a/libc/bionic/bionic_systrace.cpp b/libc/bionic/bionic_systrace.cpp
index 103aa8f..b522b10 100644
--- a/libc/bionic/bionic_systrace.cpp
+++ b/libc/bionic/bionic_systrace.cpp
@@ -34,27 +34,25 @@
 
 static Lock g_lock;
 static const prop_info* g_pinfo;
-static uint32_t g_serial = -1;
+static uint32_t g_property_serial = -1;
+static uint32_t g_property_area_serial = -1;
 static uint64_t g_tags;
 static int g_trace_marker_fd = -1;
 
 static bool should_trace() {
   bool result = false;
   g_lock.lock();
-  // If g_pinfo is null, this means that systrace hasn't been run and it's safe to
-  // assume that no trace writing will need to take place.  However, to avoid running
-  // this costly find check each time, we set it to a non-tracing value so that next
-  // time, it will just check the serial to see if the value has been changed.
-  // this function also deals with the bootup case, during which the call to property
-  // set will fail if the property server hasn't yet started.
-  if (g_pinfo == NULL) {
+  // debug.atrace.tags.enableflags is set to a safe non-tracing value during property
+  // space initialization, so it should only be null in two cases, if there are
+  // insufficient permissions for this process to access the property, in which
+  // case an audit will be logged, and during boot before the property server has
+  // been started, in which case we store the global property_area serial to prevent
+  // the costly find operation until we see a changed property_area.
+  if (!g_pinfo && g_property_area_serial != __system_property_area_serial()) {
+    g_property_area_serial = __system_property_area_serial();
     g_pinfo = __system_property_find(SYSTRACE_PROPERTY_NAME);
-    if (g_pinfo == NULL) {
-      __system_property_set(SYSTRACE_PROPERTY_NAME, "0");
-      g_pinfo = __system_property_find(SYSTRACE_PROPERTY_NAME);
-    }
   }
-  if (g_pinfo != NULL) {
+  if (g_pinfo) {
     // Find out which tags have been enabled on the command line and set
     // the value of tags accordingly.  If the value of the property changes,
     // the serial will also change, so the costly system_property_read function
@@ -62,11 +60,11 @@
     // first.  The values within pinfo may change, but its location is guaranteed
     // not to move.
     uint32_t cur_serial = __system_property_serial(g_pinfo);
-    if (cur_serial != g_serial) {
-      g_serial = cur_serial;
+    if (cur_serial != g_property_serial) {
+      g_property_serial = cur_serial;
       char value[PROP_VALUE_MAX];
       __system_property_read(g_pinfo, 0, value);
-      g_tags = strtoull(value, NULL, 0);
+      g_tags = strtoull(value, nullptr, 0);
     }
     result = ((g_tags & ATRACE_TAG_BIONIC) != 0);
   }
diff --git a/libc/bionic/flockfile.cpp b/libc/bionic/flockfile.cpp
index db68801..db53828 100644
--- a/libc/bionic/flockfile.cpp
+++ b/libc/bionic/flockfile.cpp
@@ -36,20 +36,12 @@
 // struct __sfileext (see fileext.h).
 
 void flockfile(FILE* fp) {
-  if (!__sdidinit) {
-    __sinit();
-  }
-
   if (fp != nullptr) {
     pthread_mutex_lock(&_FLOCK(fp));
   }
 }
 
 int ftrylockfile(FILE* fp) {
-  if (!__sdidinit) {
-    __sinit();
-  }
-
   // The specification for ftrylockfile() says it returns 0 on success,
   // or non-zero on error. So return an errno code directly on error.
   if (fp == nullptr) {
@@ -60,10 +52,6 @@
 }
 
 void funlockfile(FILE* fp) {
-  if (!__sdidinit) {
-    __sinit();
-  }
-
   if (fp != nullptr) {
     pthread_mutex_unlock(&_FLOCK(fp));
   }
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index 91e210e..b0c62d6 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -54,7 +54,6 @@
 extern "C" int __system_properties_init(void);
 extern "C" int __set_tls(void* ptr);
 extern "C" int __set_tid_address(int* tid_address);
-extern "C" int __sinit(void);
 
 __LIBC_HIDDEN__ WriteProtected<libc_globals> __libc_globals;
 
@@ -80,6 +79,10 @@
 
   static pthread_internal_t main_thread;
 
+  // The x86 -fstack-protector implementation uses TLS, so make sure that's
+  // set up before we call any function that might get a stack check inserted.
+  __set_tls(main_thread.tls);
+
   // Tell the kernel to clear our tid field when we exit, so we're like any other pthread.
   // As a side-effect, this tells us our pid (which is the same as the main thread's tid).
   main_thread.tid = __set_tid_address(&main_thread.tid);
@@ -98,7 +101,6 @@
 
   __init_thread(&main_thread);
   __init_tls(&main_thread);
-  __set_tls(main_thread.tls);
 
   // Store a pointer to the kernel argument block in a TLS slot to be
   // picked up by the libc constructor.
@@ -134,9 +136,6 @@
   __pthread_internal_add(main_thread);
 
   __system_properties_init(); // Requires 'environ'.
-  // Initialize stdio here to get rid of data races caused by lazy initialization.
-  // TODO: Remove other calls to __sinit().
-  __sinit();
 }
 
 __noreturn static void __early_abort(int line) {
diff --git a/libc/bionic/libc_logging.cpp b/libc/bionic/libc_logging.cpp
index 2a987b9..67bb052 100644
--- a/libc/bionic/libc_logging.cpp
+++ b/libc/bionic/libc_logging.cpp
@@ -31,6 +31,7 @@
 
 #include <android/set_abort_message.h>
 #include <assert.h>
+#include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <pthread.h>
@@ -46,6 +47,9 @@
 #include <time.h>
 #include <unistd.h>
 
+#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
+#include <sys/_system_properties.h>
+
 static pthread_mutex_t g_abort_msg_lock = PTHREAD_MUTEX_INITIALIZER;
 
 __LIBC_HIDDEN__ abort_msg_t** __abort_message_ptr; // Accessible to __libc_init_common.
@@ -481,6 +485,64 @@
   return log_fd;
 }
 
+struct cache {
+  const prop_info* pinfo;
+  uint32_t serial;
+  char c;
+};
+
+static void refresh_cache(struct cache *cache, const char *key)
+{
+  if (!cache->pinfo) {
+    cache->pinfo = __system_property_find(key);
+    if (!cache->pinfo) {
+      return;
+    }
+  }
+  uint32_t serial = __system_property_serial(cache->pinfo);
+  if (serial == cache->serial) {
+    return;
+  }
+  cache->serial = serial;
+
+  char buf[PROP_VALUE_MAX];
+  __system_property_read(cache->pinfo, 0, buf);
+  cache->c = buf[0];
+}
+
+// Timestamp state generally remains constant, since a change is
+// rare, we can accept a trylock failure gracefully.
+static pthread_mutex_t lock_clockid = PTHREAD_MUTEX_INITIALIZER;
+
+static clockid_t __android_log_clockid()
+{
+  static struct cache r_time_cache = { NULL, static_cast<uint32_t>(-1), 0 };
+  static struct cache p_time_cache = { NULL, static_cast<uint32_t>(-1), 0 };
+  char c;
+
+  if (pthread_mutex_trylock(&lock_clockid)) {
+    // We are willing to accept some race in this context
+    if (!(c = p_time_cache.c)) {
+      c = r_time_cache.c;
+    }
+  } else {
+    static uint32_t serial;
+    uint32_t current_serial = __system_property_area_serial();
+    if (current_serial != serial) {
+      refresh_cache(&r_time_cache, "ro.logd.timestamp");
+      refresh_cache(&p_time_cache, "persist.logd.timestamp");
+      serial = current_serial;
+    }
+    if (!(c = p_time_cache.c)) {
+      c = r_time_cache.c;
+    }
+
+    pthread_mutex_unlock(&lock_clockid);
+  }
+
+  return (tolower(c) == 'm') ? CLOCK_MONOTONIC : CLOCK_REALTIME;
+}
+
 struct log_time { // Wire format
   uint32_t tv_sec;
   uint32_t tv_nsec;
@@ -501,7 +563,7 @@
   vec[1].iov_base = &tid;
   vec[1].iov_len = sizeof(tid);
   timespec ts;
-  clock_gettime(CLOCK_REALTIME, &ts);
+  clock_gettime(__android_log_clockid(), &ts);
   log_time realtime_ts;
   realtime_ts.tv_sec = ts.tv_sec;
   realtime_ts.tv_nsec = ts.tv_nsec;
@@ -544,7 +606,7 @@
   vec[1].iov_base = &tid;
   vec[1].iov_len = sizeof(tid);
   timespec ts;
-  clock_gettime(CLOCK_REALTIME, &ts);
+  clock_gettime(__android_log_clockid(), &ts);
   log_time realtime_ts;
   realtime_ts.tv_sec = ts.tv_sec;
   realtime_ts.tv_nsec = ts.tv_nsec;
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index d6b8e8f..4bbb2c1 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -47,37 +47,34 @@
 
 #include "private/libc_logging.h"
 
-// Brillo doesn't need to support any legacy cruft.
-#if !defined(__BRILLO__)
+extern "C" {
 
-// Most of the cruft is only for 32-bit Android targets.
-#if !defined(__LP64__)
+// Brillo and LP64 don't need to support any legacy cruft.
+#if !defined(__BRILLO__) && !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.
-extern "C" {
-  unsigned int __page_size = PAGE_SIZE;
-  unsigned int __page_shift = 12;
-}
+unsigned int __page_size = PAGE_SIZE;
+unsigned int __page_shift = 12;
 
 // TODO: remove this backward compatibility hack (for jb-mr1 strace binaries).
-extern "C" pid_t __wait4(pid_t pid, int* status, int options, struct rusage* rusage) {
+pid_t __wait4(pid_t pid, int* status, int options, struct rusage* rusage) {
   return wait4(pid, status, options, rusage);
 }
 
 // TODO: does anything still need this?
-extern "C" int __open() {
+int __open() {
   abort();
 }
 
 // TODO: does anything still need this?
-extern "C" void** __get_tls() {
+void** __get_tls() {
 #include "private/__get_tls.h"
   return __get_tls();
 }
 
 // This non-standard function was in our <string.h> for some reason.
-extern "C" void memswap(void* m1, void* m2, size_t n) {
+void memswap(void* m1, void* m2, size_t n) {
   char* p = reinterpret_cast<char*>(m1);
   char* p_end = p + n;
   char* q = reinterpret_cast<char*>(m2);
@@ -90,13 +87,13 @@
   }
 }
 
-extern "C" int pthread_attr_setstackaddr(pthread_attr_t*, void*) {
+int pthread_attr_setstackaddr(pthread_attr_t*, void*) {
   // This was removed from POSIX.1-2008, and is not implemented on bionic.
   // Needed for ABI compatibility with the NDK.
   return ENOSYS;
 }
 
-extern "C" int pthread_attr_getstackaddr(const pthread_attr_t* attr, void** stack_addr) {
+int pthread_attr_getstackaddr(const pthread_attr_t* attr, void** stack_addr) {
   // This was removed from POSIX.1-2008.
   // Needed for ABI compatibility with the NDK.
   *stack_addr = (char*)attr->stack_base + attr->stack_size;
@@ -104,7 +101,7 @@
 }
 
 // Non-standard cruft that should only ever have been in system/core/toolbox.
-extern "C" char* strtotimeval(const char* str, struct timeval* ts) {
+char* strtotimeval(const char* str, struct timeval* ts) {
   char* s;
   ts->tv_sec = strtoumax(str, &s, 10);
 
@@ -146,7 +143,7 @@
 }
 
 // This non-standard function was in our <inttypes.h> for some reason.
-extern "C" uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n) {
+uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n) {
   const unsigned char*  p   = (const unsigned char *)nptr;
   const unsigned char*  end = p + n;
   int                   minus = 0;
@@ -194,12 +191,12 @@
 }
 
 // This non-standard function was in our <inttypes.h> for some reason.
-extern "C" intmax_t strntoimax(const char* nptr, char** endptr, int base, size_t n) {
+intmax_t strntoimax(const char* nptr, char** endptr, int base, size_t n) {
   return (intmax_t) strntoumax(nptr, endptr, base, n);
 }
 
 // POSIX calls this dprintf, but LP32 Android had fdprintf instead.
-extern "C" int fdprintf(int fd, const char* fmt, ...) {
+int fdprintf(int fd, const char* fmt, ...) {
   va_list ap;
   va_start(ap, fmt);
   int rc = vdprintf(fd, fmt, ap);
@@ -208,7 +205,7 @@
 }
 
 // POSIX calls this vdprintf, but LP32 Android had fdprintf instead.
-extern "C" int vfdprintf(int fd, const char* fmt, va_list ap) {
+int vfdprintf(int fd, const char* fmt, va_list ap) {
   return vdprintf(fd, fmt, ap);
 }
 
@@ -219,64 +216,64 @@
 #undef __futex_wait
 
 // This used to be in <sys/atomics.h>.
-extern "C" int __futex_wake(volatile void* ftx, int count) {
+int __futex_wake(volatile void* ftx, int count) {
   return __real_futex_wake(ftx, count);
 }
 
 // This used to be in <sys/atomics.h>.
-extern "C" int __futex_wait(volatile void* ftx, int value, const struct timespec* timeout) {
+int __futex_wait(volatile void* ftx, int value, const struct timespec* timeout) {
   return __real_futex_wait(ftx, value, timeout);
 }
 
 // Unity's libmono uses this.
-extern "C" int tkill(pid_t tid, int sig) {
+int tkill(pid_t tid, int sig) {
   return syscall(__NR_tkill, tid, sig);
 }
 
 // This was removed from POSIX 2008.
-extern "C" wchar_t* wcswcs(wchar_t* haystack, wchar_t* needle) {
+wchar_t* wcswcs(wchar_t* haystack, wchar_t* needle) {
   return wcsstr(haystack, needle);
 }
 
 // This was removed from POSIX 2008.
-extern "C" sighandler_t bsd_signal(int signum, sighandler_t handler) {
+sighandler_t bsd_signal(int signum, sighandler_t handler) {
   return signal(signum, handler);
 }
 
 #if !defined(__i386__)
 // This was removed from POSIX 2008.
 #undef bcopy
-extern "C" void bcopy(const void* src, void* dst, size_t n) {
-  memcpy(dst, src, n);
+void bcopy(const void* src, void* dst, size_t n) {
+  memmove(dst, src, n);
 }
 #else
 // x86 has an assembler implementation.
 #endif
 
 // sysv_signal() was never in POSIX.
-extern sighandler_t _signal(int signum, sighandler_t handler, int flags);
-extern "C" sighandler_t sysv_signal(int signum, sighandler_t handler) {
+extern "C++" sighandler_t _signal(int signum, sighandler_t handler, int flags);
+sighandler_t sysv_signal(int signum, sighandler_t handler) {
   return _signal(signum, handler, SA_RESETHAND);
 }
 
 // This is a system call that was never in POSIX. Use readdir(3) instead.
-extern "C" int __getdents64(unsigned int, dirent*, unsigned int);
-extern "C" int getdents(unsigned int fd, dirent* dirp, unsigned int count) {
+int __getdents64(unsigned int, dirent*, unsigned int);
+int getdents(unsigned int fd, dirent* dirp, unsigned int count) {
   return __getdents64(fd, dirp, count);
 }
 
 // This is a BSDism that we never implemented correctly. Used by Firefox.
-extern "C" int issetugid() {
+int issetugid() {
   return 0;
 }
 
 // This was removed from POSIX 2004.
-extern "C" pid_t wait3(int* status, int options, struct rusage* rusage) {
+pid_t wait3(int* status, int options, struct rusage* rusage) {
   return wait4(-1, status, options, rusage);
 }
 
 // This was removed from POSIX 2004.
-extern "C" int getdtablesize() {
+int getdtablesize() {
   struct rlimit r;
 
   if (getrlimit(RLIMIT_NOFILE, &r) < 0) {
@@ -286,6 +283,10 @@
   return r.rlim_cur;
 }
 
+// A leaked BSD stdio implementation detail that's now a no-op.
+void __sinit() {}
+int __sdidinit = 1;
+
 // Only used by ftime, which was removed from POSIX 2008.
 struct timeb {
   time_t          time;
@@ -295,7 +296,7 @@
 };
 
 // This was removed from POSIX 2008.
-extern "C" int ftime(struct timeb* tb) {
+int ftime(struct timeb* tb) {
   struct timeval  tv;
   struct timezone tz;
 
@@ -317,35 +318,35 @@
 }
 
 // This was removed from POSIX 2008.
-extern "C" char* index(const char* str, int ch) {
+char* index(const char* str, int ch) {
   return strchr(str, ch);
 }
 
 // This was removed from BSD.
-extern "C" void arc4random_stir(void) {
+void arc4random_stir(void) {
   // The current implementation stirs itself as needed.
 }
 
 // This was removed from BSD.
-extern "C" void arc4random_addrandom(unsigned char*, int) {
+void arc4random_addrandom(unsigned char*, int) {
   // The current implementation adds randomness as needed.
 }
 
 // Old versions of the NDK did not export malloc_usable_size, but did
 // export dlmalloc_usable_size. We are moving away from dlmalloc in L
 // so make this call malloc_usable_size.
-extern "C" size_t dlmalloc_usable_size(void* ptr) {
+size_t dlmalloc_usable_size(void* ptr) {
   return malloc_usable_size(ptr);
 }
 
 // In L we added a public pthread_gettid_np, but some apps were using the private API.
-extern "C" pid_t __pthread_gettid(pthread_t t) {
+pid_t __pthread_gettid(pthread_t t) {
   return pthread_gettid_np(t);
 }
 
 // Older versions of apportable used dlmalloc directly instead of malloc,
 // so export this compatibility shim that simply calls malloc.
-extern "C" void* dlmalloc(size_t size) {
+void* dlmalloc(size_t size) {
   return malloc(size);
 }
 
@@ -353,39 +354,39 @@
 #include "pthread_internal.h"
 #undef __get_thread
 // Various third-party apps contain a backport of our pthread_rwlock implementation that uses this.
-extern "C" pthread_internal_t* __get_thread() {
+pthread_internal_t* __get_thread() {
   return __real_get_thread();
 }
 
 // This one exists only for the LP32 NDK and is not present anywhere else.
-extern "C" long __set_errno_internal(int);
-extern "C" long __set_errno(int n) {
+extern long __set_errno_internal(int);
+long __set_errno(int n) {
   return __set_errno_internal(n);
 }
 
-#endif // !defined(__LP64__)
-
 // This was never implemented in bionic, only needed for ABI compatibility with the NDK.
 // In the M time frame, over 1000 apps have a reference to this!
-extern "C" void endpwent() { }
+void endpwent() { }
 
 // Since dlmalloc_inspect_all and dlmalloc_trim are exported for systems
 // that use dlmalloc, be consistent and export them everywhere.
 #if defined(USE_JEMALLOC)
-extern "C" void dlmalloc_inspect_all(void (*)(void*, void*, size_t, void*), void*) {
+void dlmalloc_inspect_all(void (*)(void*, void*, size_t, void*), void*) {
 }
-extern "C" int dlmalloc_trim(size_t) {
+int dlmalloc_trim(size_t) {
     return 0;
 }
 #else
-extern "C" void dlmalloc_inspect_all_real(void (*)(void*, void*, size_t, void*), void*);
-extern "C" void dlmalloc_inspect_all(void (*handler)(void*, void*, size_t, void*), void* arg) {
+void dlmalloc_inspect_all_real(void (*)(void*, void*, size_t, void*), void*);
+void dlmalloc_inspect_all(void (*handler)(void*, void*, size_t, void*), void* arg) {
   dlmalloc_inspect_all_real(handler, arg);
 }
-extern "C" int dlmalloc_trim_real(size_t);
-extern "C" int dlmalloc_trim(size_t pad) {
+int dlmalloc_trim_real(size_t);
+int dlmalloc_trim(size_t pad) {
   return dlmalloc_trim_real(pad);
 }
 #endif
 
-#endif // !defined(__BRILLO__)
+#endif // !defined(__BRILLO__) && !defined (__LP64__)
+
+} // extern "C"
diff --git a/libc/bionic/pthread_atfork.cpp b/libc/bionic/pthread_atfork.cpp
index 093ffd2..2200a6c 100644
--- a/libc/bionic/pthread_atfork.cpp
+++ b/libc/bionic/pthread_atfork.cpp
@@ -45,7 +45,7 @@
 
 class atfork_list_t {
  public:
-  atfork_list_t() : first_(nullptr), last_(nullptr) {}
+  constexpr atfork_list_t() : first_(nullptr), last_(nullptr) {}
 
   template<typename F>
   void walk_forward(F f) {
diff --git a/libc/bionic/pthread_cond.cpp b/libc/bionic/pthread_cond.cpp
index adbce07..d36426c 100644
--- a/libc/bionic/pthread_cond.cpp
+++ b/libc/bionic/pthread_cond.cpp
@@ -172,7 +172,7 @@
 
 static int __pthread_cond_timedwait(pthread_cond_internal_t* cond, pthread_mutex_t* mutex,
                                     bool use_realtime_clock, const timespec* abs_timeout_or_null) {
-  int result = check_timespec(abs_timeout_or_null);
+  int result = check_timespec(abs_timeout_or_null, true);
   if (result != 0) {
     return result;
   }
diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp
index cad138c..7d8e8a8 100644
--- a/libc/bionic/pthread_mutex.cpp
+++ b/libc/bionic/pthread_mutex.cpp
@@ -304,7 +304,7 @@
     if (__predict_true(__pthread_normal_mutex_trylock(mutex, shared) == 0)) {
         return 0;
     }
-    int result = check_timespec(abs_timeout_or_null);
+    int result = check_timespec(abs_timeout_or_null, true);
     if (result != 0) {
         return result;
     }
@@ -487,7 +487,7 @@
             old_state = new_state;
         }
 
-        int result = check_timespec(abs_timeout_or_null);
+        int result = check_timespec(abs_timeout_or_null, true);
         if (result != 0) {
             return result;
         }
diff --git a/libc/bionic/pthread_rwlock.cpp b/libc/bionic/pthread_rwlock.cpp
index b1c48c8..a065295 100644
--- a/libc/bionic/pthread_rwlock.cpp
+++ b/libc/bionic/pthread_rwlock.cpp
@@ -298,7 +298,7 @@
     if (result == 0 || result == EAGAIN) {
       return result;
     }
-    result = check_timespec(abs_timeout_or_null);
+    result = check_timespec(abs_timeout_or_null, true);
     if (result != 0) {
       return result;
     }
@@ -370,7 +370,7 @@
     if (result == 0) {
       return result;
     }
-    result = check_timespec(abs_timeout_or_null);
+    result = check_timespec(abs_timeout_or_null, true);
     if (result != 0) {
       return result;
     }
diff --git a/libc/bionic/semaphore.cpp b/libc/bionic/semaphore.cpp
index 79b5d63..b30c0b0 100644
--- a/libc/bionic/semaphore.cpp
+++ b/libc/bionic/semaphore.cpp
@@ -235,7 +235,7 @@
   }
 
   // Check it as per POSIX.
-  int result = check_timespec(abs_timeout);
+  int result = check_timespec(abs_timeout, false);
   if (result != 0) {
     errno = result;
     return -1;
diff --git a/libc/include/android/dlext.h b/libc/include/android/dlext.h
index ed9a3b9..7979c43 100644
--- a/libc/include/android/dlext.h
+++ b/libc/include/android/dlext.h
@@ -152,16 +152,20 @@
  * 2. In directories specified by DT_RUNPATH of the "needed by" binary.
  * 3. deault_library_path (This of this as namespace-local default library path)
  *
- * When is_isolated is true the resulted namespace requires all of the libraries
- * to be on the search path; the search_path is ld_library_path:default_library_path.
+ * When is_isolated is true the resulting namespace requires all of the libraries
+ * to be on the search path or under the permitted_when_isolated_path; the search_path is
+ * ld_library_path:default_library_path. Note that the permitted_when_isolated_path path
+ * is not part of the search_path and does not affect the search order. It is a way
+ * to allow loading libraries from specific locations when using absolute path.
  *
- * If a library or any of its dependencies are outside of the search path and not
- * part of the public namespace dlopen will fail.
+ * If a library or any of its dependencies are outside of the permitted_when_isolated_path
+ * and search_path, and it is not part of the public namespace dlopen will fail.
  */
 extern struct android_namespace_t* android_create_namespace(const char* name,
                                                             const char* ld_library_path,
                                                             const char* default_library_path,
-                                                            bool is_isolated);
+                                                            bool is_isolated,
+                                                            const char* permitted_when_isolated_path);
 
 __END_DECLS
 
diff --git a/libc/include/dlfcn.h b/libc/include/dlfcn.h
index afa7687..c2e8980 100644
--- a/libc/include/dlfcn.h
+++ b/libc/include/dlfcn.h
@@ -43,11 +43,12 @@
                                in dli_sname */
 } Dl_info;
 
-extern void*        dlopen(const char*  filename, int flag);
-extern int          dlclose(void*  handle);
-extern const char*  dlerror(void);
-extern void*        dlsym(void*  handle, const char*  symbol);
-extern int          dladdr(const void* addr, Dl_info *info);
+extern void* dlopen(const char*  filename, int flag);
+extern int dlclose(void*  handle);
+extern const char* dlerror(void);
+extern void* dlsym(void* handle, const char* symbol) __nonnull((2));
+extern void* dlvsym(void* handle, const char* symbol, const char* version) __nonnull((2, 3));
+extern int dladdr(const void* addr, Dl_info *info);
 
 enum {
 #if defined(__LP64__)
diff --git a/libc/libc.arm.brillo.map b/libc/libc.arm.brillo.map
new file mode 100644
index 0000000..4dd4481
--- /dev/null
+++ b/libc/libc.arm.brillo.map
@@ -0,0 +1,1420 @@
+# Generated by genversionscripts.py. Do not edit.
+LIBC {
+  global:
+    __assert;
+    __assert2;
+    __atomic_cmpxchg; # arm
+    __atomic_dec; # arm
+    __atomic_inc; # arm
+    __atomic_swap; # arm
+    __b64_ntop;
+    __b64_pton;
+    __brk; # arm x86 mips
+    __cmpdf2; # arm
+    __cmsg_nxthdr;
+    __connect; # arm x86 mips
+    __ctype_get_mb_cur_max;
+    __cxa_atexit;
+    __cxa_finalize;
+    __cxa_thread_atexit_impl;
+    __divdf3; # arm
+    __divdi3; # arm x86 mips
+    __divsf3; # arm
+    __divsi3; # arm
+    __dn_comp;
+    __dn_count_labels;
+    __dn_skipname;
+    __epoll_pwait; # arm x86 mips
+    __eqdf2; # arm
+    __errno;
+    __exit; # arm x86 mips
+    __extendsfdf2; # arm
+    __fbufsize;
+    __fcntl64; # arm x86 mips
+    __FD_CLR_chk;
+    __FD_ISSET_chk;
+    __FD_SET_chk;
+    __fgets_chk;
+    __fixdfsi; # arm
+    __fixsfsi; # arm
+    __fixunssfsi; # arm
+    __flbf;
+    __floatdidf; # arm
+    __floatdisf; # arm
+    __floatsidf; # arm
+    __floatsisf; # arm
+    __floatundidf; # arm
+    __floatundisf; # arm
+    __floatunsidf; # arm
+    __floatunsisf; # arm
+    __fp_nquery;
+    __fp_query;
+    __fpclassify;
+    __fpclassifyd;
+    __fpclassifyf;
+    __fpclassifyl;
+    __fpending;
+    __fpurge;
+    __freadable;
+    __fsetlocking;
+    __fstatfs64; # arm x86 mips
+    __fwritable;
+    __gedf2; # arm
+    __get_h_errno;
+    __getcpu; # arm x86 mips
+    __getcwd; # arm x86 mips
+    __getdents64; # arm x86 mips
+    __getpid; # arm x86 mips
+    __getpriority; # arm x86 mips
+    __gnu_basename;
+    __gnu_ldivmod_helper; # arm
+    __gnu_strerror_r;
+    __gnu_uldivmod_helper; # arm
+    __gtdf2; # arm
+    __hostalias;
+    __ioctl; # arm x86 mips
+    __isfinite;
+    __isfinitef;
+    __isfinitel;
+    __isinf;
+    __isinff;
+    __isinfl;
+    __isnan;
+    __isnanf;
+    __isnanl;
+    __isnormal;
+    __isnormalf;
+    __isnormall;
+    __isthreaded;
+    __ledf2; # arm
+    __libc_current_sigrtmax;
+    __libc_current_sigrtmin;
+    __libc_init;
+    __llseek; # arm x86 mips
+    __loc_aton;
+    __loc_ntoa;
+    __lshrdi3; # arm
+    __ltdf2; # arm
+    __memchr_chk;
+    __memcpy_chk;
+    __memmove_chk;
+    __memrchr_chk;
+    __memset_chk;
+    __mmap2; # arm x86 mips
+    __muldf3; # arm
+    __muldi3; # arm
+    __mulsf3; # arm
+    __nedf2; # arm
+    __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;
+    __openat; # arm x86 mips
+    __openat_2;
+    __p_cdname;
+    __p_cdnname;
+    __p_class;
+    __p_class_syms;
+    __p_fqname;
+    __p_fqnname;
+    __p_option;
+    __p_query;
+    __p_rcode;
+    __p_secstodate;
+    __p_time;
+    __p_type;
+    __p_type_syms;
+    __poll_chk;
+    __popcount_tab; # arm
+    __popcountsi2; # arm x86 mips
+    __ppoll; # arm x86 mips
+    __ppoll_chk;
+    __pread64_chk;
+    __pread_chk;
+    __progname;
+    __pselect6; # arm x86 mips
+    __pthread_cleanup_pop;
+    __pthread_cleanup_push;
+    __ptrace; # arm x86 mips
+    __putlong;
+    __putshort;
+    __read_chk;
+    __readlink_chk;
+    __readlinkat_chk;
+    __reboot; # arm x86 mips
+    __recvfrom_chk;
+    __register_atfork;
+    __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;
+    __restore_core_regs; # arm
+    __rt_sigaction; # arm x86 mips
+    __rt_sigpending; # arm x86 mips
+    __rt_sigprocmask; # arm x86 mips
+    __rt_sigsuspend; # arm x86 mips
+    __rt_sigtimedwait; # arm x86 mips
+    __sched_cpualloc;
+    __sched_cpucount;
+    __sched_cpufree;
+    __sched_getaffinity; # arm x86 mips
+    __sclose; # arm x86 mips
+    __set_tid_address; # arm x86 mips
+    __set_tls; # arm mips
+    __sF;
+    __sflags; # arm x86 mips
+    __sflush; # arm x86 mips
+    __sfp; # arm x86 mips
+    __sglue; # arm x86 mips
+    __sigaction; # arm x86 mips
+    __signalfd4; # arm x86 mips
+    __smakebuf; # arm x86 mips
+    __snprintf_chk;
+    __socket; # arm x86 mips
+    __sprintf_chk;
+    __sread; # arm x86 mips
+    __srefill; # arm x86 mips
+    __srget; # arm x86 mips
+    __sseek; # arm x86 mips
+    __stack_chk_fail;
+    __stack_chk_guard;
+    __statfs64; # arm x86 mips
+    __stpcpy_chk;
+    __stpncpy_chk;
+    __stpncpy_chk2;
+    __strcat_chk;
+    __strchr_chk;
+    __strcpy_chk;
+    __strlcat_chk;
+    __strlcpy_chk;
+    __strlen_chk;
+    __strncat_chk;
+    __strncpy_chk;
+    __strncpy_chk2;
+    __strrchr_chk;
+    __subdf3; # arm
+    __subsf3; # arm
+    __swbuf; # arm x86 mips
+    __swrite; # arm x86 mips
+    __swsetup; # arm x86 mips
+    __sym_ntop;
+    __sym_ntos;
+    __sym_ston;
+    __system_properties_init;
+    __system_property_add;
+    __system_property_area__;
+    __system_property_area_init;
+    __system_property_area_serial;
+    __system_property_find;
+    __system_property_find_nth;
+    __system_property_foreach;
+    __system_property_get;
+    __system_property_read;
+    __system_property_serial;
+    __system_property_set;
+    __system_property_set_filename;
+    __system_property_update;
+    __system_property_wait_any;
+    __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
+    __truncdfsf2; # arm
+    __udivdi3; # arm x86 mips
+    __udivsi3; # arm
+    __umask_chk;
+    __unorddf2; # arm
+    __unordsf2; # arm
+    __vsnprintf_chk;
+    __vsprintf_chk;
+    __waitid; # arm x86 mips
+    _ctype_;
+    _Exit;
+    _exit;
+    _flushlbf;
+    _fwalk; # arm x86 mips
+    _getlong;
+    _getshort;
+    _longjmp;
+    _resolv_delete_cache_for_net;
+    _resolv_flush_cache_for_net;
+    _resolv_set_nameservers_for_net;
+    _setjmp;
+    _tolower;
+    _tolower_tab_; # arm x86 mips
+    _toupper;
+    _toupper_tab_; # arm x86 mips
+    abort;
+    abs;
+    accept;
+    accept4;
+    access;
+    acct;
+    alarm;
+    alphasort;
+    alphasort64;
+    android_getaddrinfofornet;
+    android_getaddrinfofornetcontext;
+    android_gethostbyaddrfornet;
+    android_gethostbynamefornet;
+    android_set_abort_message;
+    arc4random;
+    arc4random_buf;
+    arc4random_uniform;
+    asctime;
+    asctime64; # arm x86 mips
+    asctime64_r; # arm x86 mips
+    asctime_r;
+    asprintf;
+    at_quick_exit;
+    atof;
+    atoi;
+    atol;
+    atoll;
+    basename;
+    basename_r; # arm x86 mips
+    bind;
+    bindresvport;
+    brk;
+    bsearch;
+    btowc;
+    bzero; # arm x86 mips
+    c16rtomb;
+    c32rtomb;
+    cacheflush; # arm mips
+    calloc;
+    capget;
+    capset;
+    cfgetispeed;
+    cfgetospeed;
+    cfmakeraw;
+    cfsetispeed;
+    cfsetospeed;
+    cfsetspeed;
+    chdir;
+    chmod;
+    chown;
+    chroot;
+    clearenv;
+    clearerr;
+    clearerr_unlocked;
+    clock;
+    clock_getcpuclockid;
+    clock_getres;
+    clock_gettime;
+    clock_nanosleep;
+    clock_settime;
+    clone;
+    close;
+    closedir;
+    closelog;
+    connect;
+    creat;
+    creat64;
+    ctime;
+    ctime64; # arm x86 mips
+    ctime64_r; # arm x86 mips
+    ctime_r;
+    daemon;
+    daylight;
+    delete_module;
+    difftime;
+    dirfd;
+    dirname;
+    dirname_r; # arm x86 mips
+    div;
+    dn_expand;
+    dprintf;
+    drand48;
+    dup;
+    dup2;
+    dup3;
+    duplocale;
+    endmntent;
+    endservent;
+    endutent;
+    environ;
+    epoll_create;
+    epoll_create1;
+    epoll_ctl;
+    epoll_pwait;
+    epoll_wait;
+    erand48;
+    err;
+    error;
+    error_at_line;
+    error_message_count;
+    error_one_per_line;
+    error_print_progname;
+    errx;
+    ether_aton;
+    ether_aton_r;
+    ether_ntoa;
+    ether_ntoa_r;
+    eventfd;
+    eventfd_read;
+    eventfd_write;
+    execl;
+    execle;
+    execlp;
+    execv;
+    execve;
+    execvp;
+    execvpe;
+    exit;
+    faccessat;
+    fake_gmtime_r; # arm x86 mips
+    fake_localtime_r; # arm x86 mips
+    fallocate;
+    fallocate64;
+    fchdir;
+    fchmod;
+    fchmodat;
+    fchown;
+    fchownat;
+    fclose;
+    fcntl;
+    fdatasync;
+    fdopen;
+    fdopendir;
+    feof;
+    feof_unlocked;
+    ferror;
+    ferror_unlocked;
+    fflush;
+    ffs;
+    fgetc;
+    fgetln;
+    fgetpos;
+    fgets;
+    fgetwc;
+    fgetws;
+    fgetxattr;
+    fileno;
+    flistxattr;
+    flock;
+    flockfile;
+    fmemopen;
+    fnmatch;
+    fopen;
+    fork;
+    forkpty;
+    fpathconf;
+    fprintf;
+    fpurge;
+    fputc;
+    fputs;
+    fputwc;
+    fputws;
+    fread;
+    free;
+    free_malloc_leak_info;
+    freeaddrinfo;
+    freelocale;
+    fremovexattr;
+    freopen;
+    fscanf;
+    fseek;
+    fseeko;
+    fsetpos;
+    fsetxattr;
+    fstat;
+    fstat64;
+    fstatat;
+    fstatat64;
+    fstatfs;
+    fstatfs64;
+    fstatvfs;
+    fstatvfs64;
+    fsync;
+    ftell;
+    ftello;
+    ftok;
+    ftruncate;
+    ftruncate64;
+    ftrylockfile;
+    fts_children;
+    fts_close;
+    fts_open;
+    fts_read;
+    fts_set;
+    ftw;
+    ftw64;
+    funlockfile;
+    funopen;
+    futimens;
+    fwide;
+    fwprintf;
+    fwrite;
+    fwscanf;
+    gai_strerror;
+    get_avphys_pages;
+    get_malloc_leak_info;
+    get_nprocs;
+    get_nprocs_conf;
+    get_phys_pages;
+    getaddrinfo;
+    getauxval;
+    getc;
+    getc_unlocked;
+    getchar;
+    getchar_unlocked;
+    getcwd;
+    getdelim;
+    getegid;
+    getenv;
+    geteuid;
+    getgid;
+    getgrgid;
+    getgrnam;
+    getgrouplist;
+    getgroups;
+    gethostbyaddr;
+    gethostbyaddr_r;
+    gethostbyname;
+    gethostbyname2;
+    gethostbyname2_r;
+    gethostbyname_r;
+    gethostent;
+    gethostname;
+    getitimer;
+    getline;
+    getlogin;
+    getmntent;
+    getmntent_r;
+    getnameinfo;
+    getnetbyaddr;
+    getnetbyname;
+    getopt;
+    getopt_long;
+    getopt_long_only;
+    getpagesize;
+    getpeername;
+    getpgid;
+    getpgrp;
+    getpid;
+    getppid;
+    getpriority;
+    getprogname;
+    getprotobyname;
+    getprotobynumber;
+    getpt;
+    getpwnam;
+    getpwnam_r;
+    getpwuid;
+    getpwuid_r;
+    getresgid;
+    getresuid;
+    getrlimit;
+    getrlimit64;
+    getrusage;
+    gets;
+    getservbyname;
+    getservbyport;
+    getservent;
+    getsid;
+    getsockname;
+    getsockopt;
+    gettid;
+    gettimeofday;
+    getuid;
+    getutent;
+    getwc;
+    getwchar;
+    getxattr;
+    gmtime;
+    gmtime64; # arm x86 mips
+    gmtime64_r; # arm x86 mips
+    gmtime_r;
+    grantpt;
+    herror;
+    hstrerror;
+    htonl;
+    htons;
+    if_indextoname;
+    if_nametoindex;
+    imaxabs;
+    imaxdiv;
+    inet_addr;
+    inet_aton;
+    inet_lnaof;
+    inet_makeaddr;
+    inet_netof;
+    inet_network;
+    inet_nsap_addr;
+    inet_nsap_ntoa;
+    inet_ntoa;
+    inet_ntop;
+    inet_pton;
+    init_module;
+    initgroups;
+    initstate;
+    inotify_add_watch;
+    inotify_init;
+    inotify_init1;
+    inotify_rm_watch;
+    insque;
+    ioctl;
+    isalnum;
+    isalnum_l;
+    isalpha;
+    isalpha_l;
+    isascii;
+    isatty;
+    isblank;
+    isblank_l;
+    iscntrl;
+    iscntrl_l;
+    isdigit;
+    isdigit_l;
+    isfinite;
+    isfinitef;
+    isfinitel;
+    isgraph;
+    isgraph_l;
+    isinf;
+    isinff;
+    isinfl;
+    islower;
+    islower_l;
+    isnan;
+    isnanf;
+    isnanl;
+    isnormal;
+    isnormalf;
+    isnormall;
+    isprint;
+    isprint_l;
+    ispunct;
+    ispunct_l;
+    isspace;
+    isspace_l;
+    isupper;
+    isupper_l;
+    iswalnum;
+    iswalnum_l;
+    iswalpha;
+    iswalpha_l;
+    iswblank;
+    iswblank_l;
+    iswcntrl;
+    iswcntrl_l;
+    iswctype;
+    iswctype_l;
+    iswdigit;
+    iswdigit_l;
+    iswgraph;
+    iswgraph_l;
+    iswlower;
+    iswlower_l;
+    iswprint;
+    iswprint_l;
+    iswpunct;
+    iswpunct_l;
+    iswspace;
+    iswspace_l;
+    iswupper;
+    iswupper_l;
+    iswxdigit;
+    iswxdigit_l;
+    isxdigit;
+    isxdigit_l;
+    jrand48;
+    kill;
+    killpg;
+    klogctl;
+    labs;
+    lchown;
+    lcong48;
+    ldexp;
+    ldiv;
+    lfind;
+    lgetxattr;
+    link;
+    linkat;
+    listen;
+    listxattr;
+    llabs;
+    lldiv;
+    llistxattr;
+    localeconv;
+    localtime;
+    localtime64; # arm x86 mips
+    localtime64_r; # arm x86 mips
+    localtime_r;
+    login_tty;
+    longjmp;
+    lrand48;
+    lremovexattr;
+    lsearch;
+    lseek;
+    lseek64;
+    lsetxattr;
+    lstat;
+    lstat64;
+    madvise;
+    mallinfo;
+    malloc;
+    malloc_info;
+    malloc_usable_size;
+    mbrlen;
+    mbrtoc16;
+    mbrtoc32;
+    mbrtowc;
+    mbsinit;
+    mbsnrtowcs;
+    mbsrtowcs;
+    mbstowcs;
+    mbtowc;
+    memalign;
+    memccpy;
+    memchr;
+    memcmp;
+    memcpy;
+    memmem;
+    memmove;
+    mempcpy;
+    memrchr;
+    memset;
+    mincore;
+    mkdir;
+    mkdirat;
+    mkdtemp;
+    mkfifo;
+    mkfifoat;
+    mknod;
+    mknodat;
+    mkostemp;
+    mkostemp64;
+    mkostemps;
+    mkostemps64;
+    mkstemp;
+    mkstemp64;
+    mkstemps;
+    mkstemps64;
+    mktemp;
+    mktime;
+    mktime64; # arm x86 mips
+    mktime_tz;
+    mlock;
+    mlockall;
+    mmap;
+    mmap64;
+    mount;
+    mprotect;
+    mrand48;
+    mremap;
+    msync;
+    munlock;
+    munlockall;
+    munmap;
+    nanosleep;
+    newlocale;
+    nftw;
+    nftw64;
+    nice;
+    nrand48;
+    nsdispatch;
+    ntohl;
+    ntohs;
+    open;
+    open64;
+    open_memstream;
+    open_wmemstream;
+    openat;
+    openat64;
+    opendir;
+    openlog;
+    openpty;
+    optarg;
+    opterr;
+    optind;
+    optopt;
+    optreset;
+    pathconf;
+    pause;
+    pclose;
+    perror;
+    personality;
+    pipe;
+    pipe2;
+    poll;
+    popen;
+    posix_fadvise;
+    posix_fadvise64;
+    posix_fallocate;
+    posix_fallocate64;
+    posix_madvise;
+    posix_memalign;
+    posix_openpt;
+    ppoll;
+    prctl;
+    pread;
+    pread64;
+    printf;
+    prlimit64;
+    process_vm_readv;
+    process_vm_writev;
+    pselect;
+    psiginfo;
+    psignal;
+    pthread_atfork;
+    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;
+    pthread_condattr_getpshared;
+    pthread_condattr_init;
+    pthread_condattr_setclock;
+    pthread_condattr_setpshared;
+    pthread_create;
+    pthread_detach;
+    pthread_equal;
+    pthread_exit;
+    pthread_getattr_np;
+    pthread_getcpuclockid;
+    pthread_getschedparam;
+    pthread_getspecific;
+    pthread_gettid_np;
+    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;
+    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;
+    pthread_rwlockattr_getpshared;
+    pthread_rwlockattr_init;
+    pthread_rwlockattr_setkind_np;
+    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
+    pwrite;
+    pwrite64;
+    qsort;
+    quick_exit;
+    raise;
+    rand;
+    rand_r;
+    random;
+    read;
+    readahead;
+    readdir;
+    readdir64;
+    readdir64_r;
+    readdir_r;
+    readlink;
+    readlinkat;
+    readv;
+    realloc;
+    realpath;
+    reboot;
+    recv;
+    recvfrom;
+    recvmmsg;
+    recvmsg;
+    regcomp;
+    regerror;
+    regexec;
+    regfree;
+    remove;
+    removexattr;
+    remque;
+    rename;
+    renameat;
+    res_init;
+    res_mkquery;
+    res_query;
+    res_search;
+    restore_core_regs; # arm
+    rewind;
+    rewinddir;
+    rmdir;
+    sbrk;
+    scandir;
+    scandir64;
+    scanf;
+    sched_get_priority_max;
+    sched_get_priority_min;
+    sched_getaffinity;
+    sched_getcpu;
+    sched_getparam;
+    sched_getscheduler;
+    sched_rr_get_interval;
+    sched_setaffinity;
+    sched_setparam;
+    sched_setscheduler;
+    sched_yield;
+    seed48;
+    seekdir;
+    select;
+    sem_close;
+    sem_destroy;
+    sem_getvalue;
+    sem_init;
+    sem_open;
+    sem_post;
+    sem_timedwait;
+    sem_trywait;
+    sem_unlink;
+    sem_wait;
+    send;
+    sendfile;
+    sendfile64;
+    sendmmsg;
+    sendmsg;
+    sendto;
+    setbuf;
+    setbuffer;
+    setegid;
+    setenv;
+    seteuid;
+    setfsgid;
+    setfsuid;
+    setgid;
+    setgroups;
+    sethostname;
+    setitimer;
+    setjmp;
+    setlinebuf;
+    setlocale;
+    setlogmask;
+    setmntent;
+    setns;
+    setpgid;
+    setpgrp;
+    setpriority;
+    setprogname;
+    setregid;
+    setresgid;
+    setresuid;
+    setreuid;
+    setrlimit;
+    setrlimit64;
+    setservent;
+    setsid;
+    setsockopt;
+    setstate;
+    settimeofday;
+    setuid;
+    setutent;
+    setvbuf;
+    setxattr;
+    shutdown;
+    sigaction;
+    sigaddset;
+    sigaltstack;
+    sigblock;
+    sigdelset;
+    sigemptyset;
+    sigfillset;
+    siginterrupt;
+    sigismember;
+    siglongjmp;
+    signal;
+    signalfd;
+    sigpending;
+    sigprocmask;
+    sigqueue;
+    sigsetjmp;
+    sigsetmask;
+    sigsuspend;
+    sigtimedwait;
+    sigwait;
+    sigwaitinfo;
+    sleep;
+    snprintf;
+    socket;
+    socketpair;
+    splice;
+    sprintf;
+    srand;
+    srand48;
+    srandom;
+    sscanf;
+    stat;
+    stat64;
+    statfs;
+    statfs64;
+    statvfs;
+    statvfs64;
+    stderr;
+    stdin;
+    stdout;
+    stpcpy;
+    stpncpy;
+    strcasecmp;
+    strcasecmp_l;
+    strcasestr;
+    strcat;
+    strchr;
+    strcmp;
+    strcoll;
+    strcoll_l;
+    strcpy;
+    strcspn;
+    strdup;
+    strerror;
+    strerror_l;
+    strerror_r;
+    strftime;
+    strftime_l;
+    strlcat;
+    strlcpy;
+    strlen;
+    strncasecmp;
+    strncasecmp_l;
+    strncat;
+    strncmp;
+    strncpy;
+    strndup;
+    strnlen;
+    strpbrk;
+    strptime;
+    strrchr;
+    strsep;
+    strsignal;
+    strspn;
+    strstr;
+    strtod;
+    strtof;
+    strtoimax;
+    strtok;
+    strtok_r;
+    strtol;
+    strtold;
+    strtold_l;
+    strtoll;
+    strtoll_l;
+    strtoq;
+    strtoul;
+    strtoull;
+    strtoull_l;
+    strtoumax;
+    strtouq;
+    strxfrm;
+    strxfrm_l;
+    swapoff;
+    swapon;
+    swprintf;
+    swscanf;
+    symlink;
+    symlinkat;
+    sync;
+    sys_siglist;
+    sys_signame;
+    syscall;
+    sysconf;
+    sysinfo;
+    syslog;
+    system;
+    tcdrain;
+    tcflow;
+    tcflush;
+    tcgetattr;
+    tcgetpgrp;
+    tcgetsid;
+    tcsendbreak;
+    tcsetattr;
+    tcsetpgrp;
+    tdelete;
+    tdestroy;
+    tee;
+    telldir;
+    tempnam;
+    tfind;
+    tgkill;
+    time;
+    timegm;
+    timegm64; # arm x86 mips
+    timelocal;
+    timelocal64; # arm x86 mips
+    timer_create;
+    timer_delete;
+    timer_getoverrun;
+    timer_gettime;
+    timer_settime;
+    timerfd_create;
+    timerfd_gettime;
+    timerfd_settime;
+    times;
+    timezone;
+    tmpfile;
+    tmpnam;
+    toascii;
+    tolower;
+    tolower_l;
+    toupper;
+    toupper_l;
+    towlower;
+    towlower_l;
+    towupper;
+    towupper_l;
+    truncate;
+    truncate64;
+    tsearch;
+    ttyname;
+    ttyname_r;
+    twalk;
+    tzname;
+    tzset;
+    umask;
+    umount;
+    umount2;
+    uname;
+    ungetc;
+    ungetwc;
+    unlink;
+    unlinkat;
+    unlockpt;
+    unsetenv;
+    unshare;
+    uselocale;
+    usleep;
+    utime;
+    utimensat;
+    utimes;
+    utmpname;
+    valloc; # arm x86 mips
+    vasprintf;
+    vdprintf;
+    verr;
+    verrx;
+    vfork;
+    vfprintf;
+    vfscanf;
+    vfwprintf;
+    vfwscanf;
+    vmsplice;
+    vprintf;
+    vscanf;
+    vsnprintf;
+    vsprintf;
+    vsscanf;
+    vswprintf;
+    vswscanf;
+    vsyslog;
+    vwarn;
+    vwarnx;
+    vwprintf;
+    vwscanf;
+    wait;
+    wait4;
+    waitid;
+    waitpid;
+    warn;
+    warnx;
+    wcpcpy;
+    wcpncpy;
+    wcrtomb;
+    wcscasecmp;
+    wcscasecmp_l;
+    wcscat;
+    wcschr;
+    wcscmp;
+    wcscoll;
+    wcscoll_l;
+    wcscpy;
+    wcscspn;
+    wcsdup;
+    wcsftime;
+    wcslcat;
+    wcslcpy;
+    wcslen;
+    wcsncasecmp;
+    wcsncasecmp_l;
+    wcsncat;
+    wcsncmp;
+    wcsncpy;
+    wcsnlen;
+    wcsnrtombs;
+    wcspbrk;
+    wcsrchr;
+    wcsrtombs;
+    wcsspn;
+    wcsstr;
+    wcstod;
+    wcstof;
+    wcstoimax;
+    wcstok;
+    wcstol;
+    wcstold;
+    wcstold_l;
+    wcstoll;
+    wcstoll_l;
+    wcstombs;
+    wcstoul;
+    wcstoull;
+    wcstoull_l;
+    wcstoumax;
+    wcswidth;
+    wcsxfrm;
+    wcsxfrm_l;
+    wctob;
+    wctomb;
+    wctype;
+    wctype_l;
+    wcwidth;
+    wmemchr;
+    wmemcmp;
+    wmemcpy;
+    wmemmove;
+    wmempcpy;
+    wmemset;
+    wprintf;
+    write;
+    writev;
+    wscanf;
+  local:
+    *;
+};
+
+LIBC_N {
+  global:
+    __fread_chk;
+    __fwrite_chk;
+    __getcwd_chk;
+    __pwrite_chk;
+    __pwrite64_chk;
+    __write_chk;
+    fileno_unlocked;
+    getgrgid_r;
+    getgrnam_r;
+    preadv;
+    preadv64;
+    prlimit; # arm mips x86
+    pthread_barrierattr_destroy;
+    pthread_barrierattr_getpshared;
+    pthread_barrierattr_init;
+    pthread_barrierattr_setpshared;
+    pthread_barrier_destroy;
+    pthread_barrier_init;
+    pthread_barrier_wait;
+    pthread_spin_destroy;
+    pthread_spin_init;
+    pthread_spin_lock;
+    pthread_spin_trylock;
+    pthread_spin_unlock;
+    pwritev;
+    pwritev64;
+    scandirat;
+    scandirat64;
+    strchrnul;
+} LIBC;
+
+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
+    __dso_handle; # 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
+    _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
+    atexit; # arm
+    gMallocLeakZygoteChild;
+    SHA1Final; # arm x86 mips
+    SHA1Init; # arm x86 mips
+    SHA1Transform; # arm x86 mips
+    SHA1Update; # arm x86 mips
+} LIBC_N;
diff --git a/libc/libc.arm.map b/libc/libc.arm.map
index 69aa272..1a666f4 100644
--- a/libc/libc.arm.map
+++ b/libc/libc.arm.map
@@ -58,13 +58,13 @@
     __freadable;
     __fsetlocking;
     __fstatfs64; # arm x86 mips
-    __futex_wait; # arm x86 mips
-    __futex_wake; # arm x86 mips
+    __futex_wait; # arm x86 mips nobrillo
+    __futex_wake; # arm x86 mips nobrillo
     __fwritable;
     __gedf2; # arm
     __get_h_errno;
-    __get_thread; # arm x86 mips
-    __get_tls; # arm x86 mips
+    __get_thread; # arm x86 mips nobrillo
+    __get_tls; # arm x86 mips nobrillo
     __getcpu; # arm x86 mips
     __getcwd; # arm x86 mips
     __getdents64; # arm x86 mips
@@ -131,7 +131,7 @@
     __ns_skiprr; # arm x86 mips
     __ns_sprintrr; # arm x86 mips
     __ns_sprintrrf; # arm x86 mips
-    __open; # arm x86 mips
+    __open; # arm x86 mips nobrillo
     __open_2;
     __openat; # arm x86 mips
     __openat_2;
@@ -148,8 +148,8 @@
     __p_time;
     __p_type;
     __p_type_syms;
-    __page_shift; # arm x86 mips
-    __page_size; # arm x86 mips
+    __page_shift; # arm x86 mips nobrillo
+    __page_size; # arm x86 mips nobrillo
     __poll_chk;
     __popcount_tab; # arm
     __popcountsi2; # arm x86 mips
@@ -161,7 +161,7 @@
     __pselect6; # arm x86 mips
     __pthread_cleanup_pop;
     __pthread_cleanup_push;
-    __pthread_gettid; # arm x86 mips
+    __pthread_gettid; # arm x86 mips nobrillo
     __ptrace; # arm x86 mips
     __putlong;
     __putshort;
@@ -202,8 +202,8 @@
     __sched_cpufree;
     __sched_getaffinity; # arm x86 mips
     __sclose; # arm x86 mips
-    __sdidinit; # arm x86 mips
-    __set_errno; # arm x86 mips
+    __sdidinit; # arm x86 mips nobrillo
+    __set_errno; # arm x86 mips nobrillo
     __set_tid_address; # arm x86 mips
     __set_tls; # arm mips
     __sF;
@@ -213,7 +213,7 @@
     __sglue; # arm x86 mips
     __sigaction; # arm x86 mips
     __signalfd4; # arm x86 mips
-    __sinit; # arm x86 mips
+    __sinit; # arm x86 mips nobrillo
     __smakebuf; # arm x86 mips
     __snprintf_chk;
     __socket; # arm x86 mips
@@ -274,7 +274,7 @@
     __unordsf2; # arm
     __vsnprintf_chk;
     __vsprintf_chk;
-    __wait4; # arm x86 mips
+    __wait4; # arm x86 mips nobrillo
     __waitid; # arm x86 mips
     _ctype_;
     _Exit;
@@ -307,9 +307,9 @@
     android_gethostbynamefornet;
     android_set_abort_message;
     arc4random;
-    arc4random_addrandom; # arm x86 mips
+    arc4random_addrandom; # arm x86 mips nobrillo
     arc4random_buf;
-    arc4random_stir; # arm x86 mips
+    arc4random_stir; # arm x86 mips nobrillo
     arc4random_uniform;
     asctime;
     asctime64; # arm x86 mips
@@ -323,11 +323,11 @@
     atoll;
     basename;
     basename_r; # arm x86 mips
-    bcopy; # arm x86 mips
+    bcopy; # arm x86 mips nobrillo
     bind;
     bindresvport;
     brk;
-    bsd_signal; # arm x86 mips
+    bsd_signal; # arm x86 mips nobrillo
     bsearch;
     btowc;
     bzero; # arm x86 mips
@@ -383,7 +383,7 @@
     dup3;
     duplocale;
     endmntent;
-    endpwent;
+    endpwent; # arm x86 mips nobrillo
     endservent;
     endutent;
     environ;
@@ -430,7 +430,7 @@
     fdatasync;
     fdopen;
     fdopendir;
-    fdprintf; # arm x86 mips
+    fdprintf; # arm x86 mips nobrillo
     feof;
     feof_unlocked;
     ferror;
@@ -483,7 +483,7 @@
     fsync;
     ftell;
     ftello;
-    ftime; # arm x86 mips
+    ftime; # arm x86 mips nobrillo
     ftok;
     ftruncate;
     ftruncate64;
@@ -516,8 +516,8 @@
     getchar_unlocked;
     getcwd;
     getdelim;
-    getdents; # arm x86 mips
-    getdtablesize; # arm x86 mips
+    getdents; # arm x86 mips nobrillo
+    getdtablesize; # arm x86 mips nobrillo
     getegid;
     getenv;
     geteuid;
@@ -592,7 +592,7 @@
     if_nametoindex;
     imaxabs;
     imaxdiv;
-    index; # arm x86 mips
+    index; # arm x86 mips nobrillo
     inet_addr;
     inet_aton;
     inet_lnaof;
@@ -645,7 +645,7 @@
     isprint_l;
     ispunct;
     ispunct_l;
-    issetugid; # arm x86 mips
+    issetugid; # arm x86 mips nobrillo
     isspace;
     isspace_l;
     isupper;
@@ -735,7 +735,7 @@
     mempcpy;
     memrchr;
     memset;
-    memswap; # arm x86 mips
+    memswap; # arm x86 mips nobrillo
     mincore;
     mkdir;
     mkdirat;
@@ -826,7 +826,7 @@
     pthread_attr_getschedpolicy;
     pthread_attr_getscope;
     pthread_attr_getstack;
-    pthread_attr_getstackaddr; # arm x86 mips
+    pthread_attr_getstackaddr; # arm x86 mips nobrillo
     pthread_attr_getstacksize;
     pthread_attr_init;
     pthread_attr_setdetachstate;
@@ -835,7 +835,7 @@
     pthread_attr_setschedpolicy;
     pthread_attr_setscope;
     pthread_attr_setstack;
-    pthread_attr_setstackaddr; # arm x86 mips
+    pthread_attr_setstackaddr; # arm x86 mips nobrillo
     pthread_attr_setstacksize;
     pthread_cond_broadcast;
     pthread_cond_destroy;
@@ -1094,8 +1094,8 @@
     strncpy;
     strndup;
     strnlen;
-    strntoimax; # arm x86 mips
-    strntoumax; # arm x86 mips
+    strntoimax; # arm x86 mips nobrillo
+    strntoumax; # arm x86 mips nobrillo
     strpbrk;
     strptime;
     strrchr;
@@ -1114,7 +1114,7 @@
     strtoll;
     strtoll_l;
     strtoq;
-    strtotimeval; # arm x86 mips
+    strtotimeval; # arm x86 mips nobrillo
     strtoul;
     strtoull;
     strtoull_l;
@@ -1136,7 +1136,7 @@
     sysinfo;
     syslog;
     system;
-    sysv_signal; # arm x86 mips
+    sysv_signal; # arm x86 mips nobrillo
     tcdrain;
     tcflow;
     tcflush;
@@ -1168,7 +1168,7 @@
     timerfd_settime;
     times;
     timezone;
-    tkill; # arm x86 mips
+    tkill; # arm x86 mips nobrillo
     tmpfile;
     tmpnam;
     toascii;
@@ -1210,7 +1210,7 @@
     vdprintf;
     verr;
     verrx;
-    vfdprintf; # arm x86 mips
+    vfdprintf; # arm x86 mips nobrillo
     vfork;
     vfprintf;
     vfscanf;
@@ -1230,7 +1230,7 @@
     vwprintf;
     vwscanf;
     wait;
-    wait3; # arm x86 mips
+    wait3; # arm x86 mips nobrillo
     wait4;
     waitid;
     waitpid;
@@ -1279,7 +1279,7 @@
     wcstoull;
     wcstoull_l;
     wcstoumax;
-    wcswcs; # arm x86 mips
+    wcswcs; # arm x86 mips nobrillo
     wcswidth;
     wcsxfrm;
     wcsxfrm_l;
@@ -1411,7 +1411,6 @@
     __ashrdi3; # arm
     __bionic_brk; # arm x86 mips
     __bionic_libgcc_compat_symbols; # arm x86
-    __bionic_libgcc_unwind_symbols; # arm
     __dso_handle; # arm
     __gnu_Unwind_Backtrace; # arm
     __gnu_unwind_execute; # arm
@@ -1447,10 +1446,10 @@
     _Unwind_VRS_Pop; # arm
     _Unwind_VRS_Set; # arm
     atexit; # arm
-    dlmalloc; # arm x86 mips
-    dlmalloc_inspect_all;
-    dlmalloc_trim;
-    dlmalloc_usable_size; # arm x86 mips
+    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
     gMallocLeakZygoteChild;
     SHA1Final; # arm x86 mips
     SHA1Init; # arm x86 mips
diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map
index 763f77e..8fa46a8 100644
--- a/libc/libc.arm64.map
+++ b/libc/libc.arm64.map
@@ -241,7 +241,6 @@
     dup3;
     duplocale;
     endmntent;
-    endpwent;
     endservent;
     endutent;
     environ;
@@ -1182,7 +1181,5 @@
 
 LIBC_PRIVATE {
   global:
-    dlmalloc_inspect_all;
-    dlmalloc_trim;
     gMallocLeakZygoteChild;
 } LIBC_N;
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index 76cb168..9eb8d01 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -58,13 +58,13 @@
     __freadable;
     __fsetlocking;
     __fstatfs64; # arm x86 mips
-    __futex_wait; # arm x86 mips
-    __futex_wake; # arm x86 mips
+    __futex_wait; # arm x86 mips nobrillo
+    __futex_wake; # arm x86 mips nobrillo
     __fwritable;
     __gedf2; # arm
     __get_h_errno;
-    __get_thread; # arm x86 mips
-    __get_tls; # arm x86 mips
+    __get_thread; # arm x86 mips nobrillo
+    __get_tls; # arm x86 mips nobrillo
     __getcpu; # arm x86 mips
     __getcwd; # arm x86 mips
     __getdents64; # arm x86 mips
@@ -132,7 +132,7 @@
     __ns_skiprr; # arm x86 mips
     __ns_sprintrr; # arm x86 mips
     __ns_sprintrrf; # arm x86 mips
-    __open; # arm x86 mips
+    __open; # arm x86 mips nobrillo
     __open_2;
     __openat; # arm x86 mips
     __openat_2;
@@ -149,8 +149,8 @@
     __p_time;
     __p_type;
     __p_type_syms;
-    __page_shift; # arm x86 mips
-    __page_size; # arm x86 mips
+    __page_shift; # arm x86 mips nobrillo
+    __page_size; # arm x86 mips nobrillo
     __poll_chk;
     __popcount_tab; # arm
     __popcountsi2; # arm x86 mips
@@ -162,7 +162,7 @@
     __pselect6; # arm x86 mips
     __pthread_cleanup_pop;
     __pthread_cleanup_push;
-    __pthread_gettid; # arm x86 mips
+    __pthread_gettid; # arm x86 mips nobrillo
     __ptrace; # arm x86 mips
     __putlong;
     __putshort;
@@ -203,8 +203,8 @@
     __sched_cpufree;
     __sched_getaffinity; # arm x86 mips
     __sclose; # arm x86 mips
-    __sdidinit; # arm x86 mips
-    __set_errno; # arm x86 mips
+    __sdidinit; # arm x86 mips nobrillo
+    __set_errno; # arm x86 mips nobrillo
     __set_thread_area; # x86
     __set_tid_address; # arm x86 mips
     __set_tls; # arm mips
@@ -215,7 +215,7 @@
     __sglue; # arm x86 mips
     __sigaction; # arm x86 mips
     __signalfd4; # arm x86 mips
-    __sinit; # arm x86 mips
+    __sinit; # arm x86 mips nobrillo
     __smakebuf; # arm x86 mips
     __snprintf_chk;
     __socket; # arm x86 mips
@@ -277,7 +277,7 @@
     __unordsf2; # arm
     __vsnprintf_chk;
     __vsprintf_chk;
-    __wait4; # arm x86 mips
+    __wait4; # arm x86 mips nobrillo
     __waitid; # arm x86 mips
     _ctype_;
     _Exit;
@@ -311,9 +311,9 @@
     android_gethostbynamefornet;
     android_set_abort_message;
     arc4random;
-    arc4random_addrandom; # arm x86 mips
+    arc4random_addrandom; # arm x86 mips nobrillo
     arc4random_buf;
-    arc4random_stir; # arm x86 mips
+    arc4random_stir; # arm x86 mips nobrillo
     arc4random_uniform;
     asctime;
     asctime64; # arm x86 mips
@@ -327,11 +327,11 @@
     atoll;
     basename;
     basename_r; # arm x86 mips
-    bcopy; # arm x86 mips
+    bcopy; # arm x86 mips nobrillo
     bind;
     bindresvport;
     brk;
-    bsd_signal; # arm x86 mips
+    bsd_signal; # arm x86 mips nobrillo
     bsearch;
     btowc;
     bzero; # arm x86 mips
@@ -387,7 +387,7 @@
     dup3;
     duplocale;
     endmntent;
-    endpwent;
+    endpwent; # arm x86 mips nobrillo
     endservent;
     endutent;
     environ;
@@ -434,7 +434,7 @@
     fdatasync;
     fdopen;
     fdopendir;
-    fdprintf; # arm x86 mips
+    fdprintf; # arm x86 mips nobrillo
     feof;
     feof_unlocked;
     ferror;
@@ -487,7 +487,7 @@
     fsync;
     ftell;
     ftello;
-    ftime; # arm x86 mips
+    ftime; # arm x86 mips nobrillo
     ftok;
     ftruncate;
     ftruncate64;
@@ -520,8 +520,8 @@
     getchar_unlocked;
     getcwd;
     getdelim;
-    getdents; # arm x86 mips
-    getdtablesize; # arm x86 mips
+    getdents; # arm x86 mips nobrillo
+    getdtablesize; # arm x86 mips nobrillo
     getegid;
     getenv;
     geteuid;
@@ -596,7 +596,7 @@
     if_nametoindex;
     imaxabs;
     imaxdiv;
-    index; # arm x86 mips
+    index; # arm x86 mips nobrillo
     inet_addr;
     inet_aton;
     inet_lnaof;
@@ -649,7 +649,7 @@
     isprint_l;
     ispunct;
     ispunct_l;
-    issetugid; # arm x86 mips
+    issetugid; # arm x86 mips nobrillo
     isspace;
     isspace_l;
     isupper;
@@ -739,7 +739,7 @@
     mempcpy;
     memrchr;
     memset;
-    memswap; # arm x86 mips
+    memswap; # arm x86 mips nobrillo
     mincore;
     mkdir;
     mkdirat;
@@ -853,7 +853,7 @@
     pthread_attr_getschedpolicy;
     pthread_attr_getscope;
     pthread_attr_getstack;
-    pthread_attr_getstackaddr; # arm x86 mips
+    pthread_attr_getstackaddr; # arm x86 mips nobrillo
     pthread_attr_getstacksize;
     pthread_attr_init;
     pthread_attr_setdetachstate;
@@ -862,7 +862,7 @@
     pthread_attr_setschedpolicy;
     pthread_attr_setscope;
     pthread_attr_setstack;
-    pthread_attr_setstackaddr; # arm x86 mips
+    pthread_attr_setstackaddr; # arm x86 mips nobrillo
     pthread_attr_setstacksize;
     pthread_cond_broadcast;
     pthread_cond_destroy;
@@ -1121,8 +1121,8 @@
     strncpy;
     strndup;
     strnlen;
-    strntoimax; # arm x86 mips
-    strntoumax; # arm x86 mips
+    strntoimax; # arm x86 mips nobrillo
+    strntoumax; # arm x86 mips nobrillo
     strpbrk;
     strptime;
     strrchr;
@@ -1141,7 +1141,7 @@
     strtoll;
     strtoll_l;
     strtoq;
-    strtotimeval; # arm x86 mips
+    strtotimeval; # arm x86 mips nobrillo
     strtoul;
     strtoull;
     strtoull_l;
@@ -1163,7 +1163,7 @@
     sysinfo;
     syslog;
     system;
-    sysv_signal; # arm x86 mips
+    sysv_signal; # arm x86 mips nobrillo
     tcdrain;
     tcflow;
     tcflush;
@@ -1195,7 +1195,7 @@
     timerfd_settime;
     times;
     timezone;
-    tkill; # arm x86 mips
+    tkill; # arm x86 mips nobrillo
     tmpfile;
     tmpnam;
     toascii;
@@ -1237,7 +1237,7 @@
     vdprintf;
     verr;
     verrx;
-    vfdprintf; # arm x86 mips
+    vfdprintf; # arm x86 mips nobrillo
     vfork;
     vfprintf;
     vfscanf;
@@ -1257,7 +1257,7 @@
     vwprintf;
     vwscanf;
     wait;
-    wait3; # arm x86 mips
+    wait3; # arm x86 mips nobrillo
     wait4;
     waitid;
     waitpid;
@@ -1306,7 +1306,7 @@
     wcstoull;
     wcstoull_l;
     wcstoumax;
-    wcswcs; # arm x86 mips
+    wcswcs; # arm x86 mips nobrillo
     wcswidth;
     wcsxfrm;
     wcsxfrm_l;
@@ -1438,7 +1438,6 @@
     __ashrdi3; # arm
     __bionic_brk; # arm x86 mips
     __bionic_libgcc_compat_symbols; # arm x86
-    __bionic_libgcc_unwind_symbols; # arm
     __dso_handle; # arm
     __gnu_Unwind_Backtrace; # arm
     __gnu_unwind_execute; # arm
@@ -1474,10 +1473,10 @@
     _Unwind_VRS_Pop; # arm
     _Unwind_VRS_Set; # arm
     atexit; # arm
-    dlmalloc; # arm x86 mips
-    dlmalloc_inspect_all;
-    dlmalloc_trim;
-    dlmalloc_usable_size; # arm x86 mips
+    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
     gMallocLeakZygoteChild;
     SHA1Final; # arm x86 mips
     SHA1Init; # arm x86 mips
diff --git a/libc/libc.mips.brillo.map b/libc/libc.mips.brillo.map
new file mode 100644
index 0000000..d4a17ea
--- /dev/null
+++ b/libc/libc.mips.brillo.map
@@ -0,0 +1,1276 @@
+# Generated by genversionscripts.py. Do not edit.
+LIBC {
+  global:
+    __assert;
+    __assert2;
+    __b64_ntop;
+    __b64_pton;
+    __brk; # arm x86 mips
+    __cmsg_nxthdr;
+    __connect; # arm x86 mips
+    __ctype_get_mb_cur_max;
+    __cxa_atexit;
+    __cxa_finalize;
+    __cxa_thread_atexit_impl;
+    __divdi3; # arm x86 mips
+    __dn_comp;
+    __dn_count_labels;
+    __dn_skipname;
+    __epoll_pwait; # arm x86 mips
+    __errno;
+    __exit; # arm x86 mips
+    __fadvise64; # x86 mips
+    __fbufsize;
+    __fcntl64; # arm x86 mips
+    __FD_CLR_chk;
+    __FD_ISSET_chk;
+    __FD_SET_chk;
+    __fgets_chk;
+    __flbf;
+    __fp_nquery;
+    __fp_query;
+    __fpclassify;
+    __fpclassifyd;
+    __fpclassifyf;
+    __fpclassifyl;
+    __fpending;
+    __fpurge;
+    __freadable;
+    __fsetlocking;
+    __fstatfs64; # arm x86 mips
+    __fwritable;
+    __get_h_errno;
+    __getcpu; # arm x86 mips
+    __getcwd; # arm x86 mips
+    __getdents64; # arm x86 mips
+    __getpid; # arm x86 mips
+    __getpriority; # arm x86 mips
+    __gnu_basename;
+    __gnu_strerror_r;
+    __hostalias;
+    __ioctl; # arm x86 mips
+    __isfinite;
+    __isfinitef;
+    __isfinitel;
+    __isinf;
+    __isinff;
+    __isinfl;
+    __isnan;
+    __isnanf;
+    __isnanl;
+    __isnormal;
+    __isnormalf;
+    __isnormall;
+    __isthreaded;
+    __libc_current_sigrtmax;
+    __libc_current_sigrtmin;
+    __libc_init;
+    __llseek; # arm x86 mips
+    __loc_aton;
+    __loc_ntoa;
+    __memchr_chk;
+    __memcpy_chk;
+    __memmove_chk;
+    __memrchr_chk;
+    __memset_chk;
+    __mmap2; # arm x86 mips
+    __moddi3; # 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;
+    __openat; # arm x86 mips
+    __openat_2;
+    __p_cdname;
+    __p_cdnname;
+    __p_class;
+    __p_class_syms;
+    __p_fqname;
+    __p_fqnname;
+    __p_option;
+    __p_query;
+    __p_rcode;
+    __p_secstodate;
+    __p_time;
+    __p_type;
+    __p_type_syms;
+    __poll_chk;
+    __popcountsi2; # arm x86 mips
+    __ppoll; # arm x86 mips
+    __ppoll_chk;
+    __pread64_chk;
+    __pread_chk;
+    __progname;
+    __pselect6; # arm x86 mips
+    __pthread_cleanup_pop;
+    __pthread_cleanup_push;
+    __ptrace; # arm x86 mips
+    __putlong;
+    __putshort;
+    __read_chk;
+    __readlink_chk;
+    __readlinkat_chk;
+    __reboot; # arm x86 mips
+    __recvfrom_chk;
+    __register_atfork;
+    __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
+    __rt_sigprocmask; # arm x86 mips
+    __rt_sigsuspend; # arm x86 mips
+    __rt_sigtimedwait; # arm x86 mips
+    __sched_cpualloc;
+    __sched_cpucount;
+    __sched_cpufree;
+    __sched_getaffinity; # arm x86 mips
+    __sclose; # arm x86 mips
+    __set_tid_address; # arm x86 mips
+    __set_tls; # arm mips
+    __sF;
+    __sflags; # arm x86 mips
+    __sflush; # arm x86 mips
+    __sfp; # arm x86 mips
+    __sglue; # arm x86 mips
+    __sigaction; # arm x86 mips
+    __signalfd4; # arm x86 mips
+    __smakebuf; # arm x86 mips
+    __snprintf_chk;
+    __socket; # arm x86 mips
+    __sprintf_chk;
+    __sread; # arm x86 mips
+    __srefill; # arm x86 mips
+    __srget; # arm x86 mips
+    __sseek; # arm x86 mips
+    __stack_chk_fail;
+    __stack_chk_guard;
+    __statfs64; # arm x86 mips
+    __stpcpy_chk;
+    __stpncpy_chk;
+    __stpncpy_chk2;
+    __strcat_chk;
+    __strchr_chk;
+    __strcpy_chk;
+    __strlcat_chk;
+    __strlcpy_chk;
+    __strlen_chk;
+    __strncat_chk;
+    __strncpy_chk;
+    __strncpy_chk2;
+    __strrchr_chk;
+    __swbuf; # arm x86 mips
+    __swrite; # arm x86 mips
+    __swsetup; # arm x86 mips
+    __sym_ntop;
+    __sym_ntos;
+    __sym_ston;
+    __system_properties_init;
+    __system_property_add;
+    __system_property_area__;
+    __system_property_area_init;
+    __system_property_area_serial;
+    __system_property_find;
+    __system_property_find_nth;
+    __system_property_foreach;
+    __system_property_get;
+    __system_property_read;
+    __system_property_serial;
+    __system_property_set;
+    __system_property_set_filename;
+    __system_property_update;
+    __system_property_wait_any;
+    __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
+    __udivdi3; # arm x86 mips
+    __umask_chk;
+    __umoddi3; # x86 mips
+    __vsnprintf_chk;
+    __vsprintf_chk;
+    __waitid; # arm x86 mips
+    _ctype_;
+    _Exit;
+    _exit;
+    _flush_cache; # mips
+    _flushlbf;
+    _fwalk; # arm x86 mips
+    _getlong;
+    _getshort;
+    _longjmp;
+    _resolv_delete_cache_for_net;
+    _resolv_flush_cache_for_net;
+    _resolv_set_nameservers_for_net;
+    _setjmp;
+    _tolower;
+    _tolower_tab_; # arm x86 mips
+    _toupper;
+    _toupper_tab_; # arm x86 mips
+    abort;
+    abs;
+    accept;
+    accept4;
+    access;
+    acct;
+    alarm;
+    alphasort;
+    alphasort64;
+    android_getaddrinfofornet;
+    android_getaddrinfofornetcontext;
+    android_gethostbyaddrfornet;
+    android_gethostbynamefornet;
+    android_set_abort_message;
+    arc4random;
+    arc4random_buf;
+    arc4random_uniform;
+    asctime;
+    asctime64; # arm x86 mips
+    asctime64_r; # arm x86 mips
+    asctime_r;
+    asprintf;
+    at_quick_exit;
+    atof;
+    atoi;
+    atol;
+    atoll;
+    basename;
+    basename_r; # arm x86 mips
+    bind;
+    bindresvport;
+    brk;
+    bsearch;
+    btowc;
+    bzero; # arm x86 mips
+    c16rtomb;
+    c32rtomb;
+    cacheflush; # arm mips
+    calloc;
+    capget;
+    capset;
+    cfgetispeed;
+    cfgetospeed;
+    cfmakeraw;
+    cfsetispeed;
+    cfsetospeed;
+    cfsetspeed;
+    chdir;
+    chmod;
+    chown;
+    chroot;
+    clearenv;
+    clearerr;
+    clearerr_unlocked;
+    clock;
+    clock_getcpuclockid;
+    clock_getres;
+    clock_gettime;
+    clock_nanosleep;
+    clock_settime;
+    clone;
+    close;
+    closedir;
+    closelog;
+    connect;
+    creat;
+    creat64;
+    ctime;
+    ctime64; # arm x86 mips
+    ctime64_r; # arm x86 mips
+    ctime_r;
+    daemon;
+    daylight;
+    delete_module;
+    difftime;
+    dirfd;
+    dirname;
+    dirname_r; # arm x86 mips
+    div;
+    dn_expand;
+    dprintf;
+    drand48;
+    dup;
+    dup2;
+    dup3;
+    duplocale;
+    endmntent;
+    endservent;
+    endutent;
+    environ;
+    epoll_create;
+    epoll_create1;
+    epoll_ctl;
+    epoll_pwait;
+    epoll_wait;
+    erand48;
+    err;
+    error;
+    error_at_line;
+    error_message_count;
+    error_one_per_line;
+    error_print_progname;
+    errx;
+    ether_aton;
+    ether_aton_r;
+    ether_ntoa;
+    ether_ntoa_r;
+    eventfd;
+    eventfd_read;
+    eventfd_write;
+    execl;
+    execle;
+    execlp;
+    execv;
+    execve;
+    execvp;
+    execvpe;
+    exit;
+    faccessat;
+    fake_gmtime_r; # arm x86 mips
+    fake_localtime_r; # arm x86 mips
+    fallocate;
+    fallocate64;
+    fchdir;
+    fchmod;
+    fchmodat;
+    fchown;
+    fchownat;
+    fclose;
+    fcntl;
+    fdatasync;
+    fdopen;
+    fdopendir;
+    feof;
+    feof_unlocked;
+    ferror;
+    ferror_unlocked;
+    fflush;
+    ffs;
+    fgetc;
+    fgetln;
+    fgetpos;
+    fgets;
+    fgetwc;
+    fgetws;
+    fgetxattr;
+    fileno;
+    flistxattr;
+    flock;
+    flockfile;
+    fmemopen;
+    fnmatch;
+    fopen;
+    fork;
+    forkpty;
+    fpathconf;
+    fprintf;
+    fpurge;
+    fputc;
+    fputs;
+    fputwc;
+    fputws;
+    fread;
+    free;
+    free_malloc_leak_info;
+    freeaddrinfo;
+    freelocale;
+    fremovexattr;
+    freopen;
+    fscanf;
+    fseek;
+    fseeko;
+    fsetpos;
+    fsetxattr;
+    fstat;
+    fstat64;
+    fstatat;
+    fstatat64;
+    fstatfs;
+    fstatfs64;
+    fstatvfs;
+    fstatvfs64;
+    fsync;
+    ftell;
+    ftello;
+    ftok;
+    ftruncate;
+    ftruncate64;
+    ftrylockfile;
+    fts_children;
+    fts_close;
+    fts_open;
+    fts_read;
+    fts_set;
+    ftw;
+    ftw64;
+    funlockfile;
+    funopen;
+    futimens;
+    fwide;
+    fwprintf;
+    fwrite;
+    fwscanf;
+    gai_strerror;
+    get_avphys_pages;
+    get_malloc_leak_info;
+    get_nprocs;
+    get_nprocs_conf;
+    get_phys_pages;
+    getaddrinfo;
+    getauxval;
+    getc;
+    getc_unlocked;
+    getchar;
+    getchar_unlocked;
+    getcwd;
+    getdelim;
+    getegid;
+    getenv;
+    geteuid;
+    getgid;
+    getgrgid;
+    getgrnam;
+    getgrouplist;
+    getgroups;
+    gethostbyaddr;
+    gethostbyaddr_r;
+    gethostbyname;
+    gethostbyname2;
+    gethostbyname2_r;
+    gethostbyname_r;
+    gethostent;
+    gethostname;
+    getitimer;
+    getline;
+    getlogin;
+    getmntent;
+    getmntent_r;
+    getnameinfo;
+    getnetbyaddr;
+    getnetbyname;
+    getopt;
+    getopt_long;
+    getopt_long_only;
+    getpagesize;
+    getpeername;
+    getpgid;
+    getpgrp;
+    getpid;
+    getppid;
+    getpriority;
+    getprogname;
+    getprotobyname;
+    getprotobynumber;
+    getpt;
+    getpwnam;
+    getpwnam_r;
+    getpwuid;
+    getpwuid_r;
+    getresgid;
+    getresuid;
+    getrlimit;
+    getrlimit64;
+    getrusage;
+    gets;
+    getservbyname;
+    getservbyport;
+    getservent;
+    getsid;
+    getsockname;
+    getsockopt;
+    gettid;
+    gettimeofday;
+    getuid;
+    getutent;
+    getwc;
+    getwchar;
+    getxattr;
+    gmtime;
+    gmtime64; # arm x86 mips
+    gmtime64_r; # arm x86 mips
+    gmtime_r;
+    grantpt;
+    herror;
+    hstrerror;
+    htonl;
+    htons;
+    if_indextoname;
+    if_nametoindex;
+    imaxabs;
+    imaxdiv;
+    inet_addr;
+    inet_aton;
+    inet_lnaof;
+    inet_makeaddr;
+    inet_netof;
+    inet_network;
+    inet_nsap_addr;
+    inet_nsap_ntoa;
+    inet_ntoa;
+    inet_ntop;
+    inet_pton;
+    init_module;
+    initgroups;
+    initstate;
+    inotify_add_watch;
+    inotify_init;
+    inotify_init1;
+    inotify_rm_watch;
+    insque;
+    ioctl;
+    isalnum;
+    isalnum_l;
+    isalpha;
+    isalpha_l;
+    isascii;
+    isatty;
+    isblank;
+    isblank_l;
+    iscntrl;
+    iscntrl_l;
+    isdigit;
+    isdigit_l;
+    isfinite;
+    isfinitef;
+    isfinitel;
+    isgraph;
+    isgraph_l;
+    isinf;
+    isinff;
+    isinfl;
+    islower;
+    islower_l;
+    isnan;
+    isnanf;
+    isnanl;
+    isnormal;
+    isnormalf;
+    isnormall;
+    isprint;
+    isprint_l;
+    ispunct;
+    ispunct_l;
+    isspace;
+    isspace_l;
+    isupper;
+    isupper_l;
+    iswalnum;
+    iswalnum_l;
+    iswalpha;
+    iswalpha_l;
+    iswblank;
+    iswblank_l;
+    iswcntrl;
+    iswcntrl_l;
+    iswctype;
+    iswctype_l;
+    iswdigit;
+    iswdigit_l;
+    iswgraph;
+    iswgraph_l;
+    iswlower;
+    iswlower_l;
+    iswprint;
+    iswprint_l;
+    iswpunct;
+    iswpunct_l;
+    iswspace;
+    iswspace_l;
+    iswupper;
+    iswupper_l;
+    iswxdigit;
+    iswxdigit_l;
+    isxdigit;
+    isxdigit_l;
+    jrand48;
+    kill;
+    killpg;
+    klogctl;
+    labs;
+    lchown;
+    lcong48;
+    ldexp;
+    ldiv;
+    lfind;
+    lgetxattr;
+    link;
+    linkat;
+    listen;
+    listxattr;
+    llabs;
+    lldiv;
+    llistxattr;
+    localeconv;
+    localtime;
+    localtime64; # arm x86 mips
+    localtime64_r; # arm x86 mips
+    localtime_r;
+    login_tty;
+    longjmp;
+    lrand48;
+    lremovexattr;
+    lsearch;
+    lseek;
+    lseek64;
+    lsetxattr;
+    lstat;
+    lstat64;
+    madvise;
+    mallinfo;
+    malloc;
+    malloc_info;
+    malloc_usable_size;
+    mbrlen;
+    mbrtoc16;
+    mbrtoc32;
+    mbrtowc;
+    mbsinit;
+    mbsnrtowcs;
+    mbsrtowcs;
+    mbstowcs;
+    mbtowc;
+    memalign;
+    memccpy;
+    memchr;
+    memcmp;
+    memcpy;
+    memmem;
+    memmove;
+    mempcpy;
+    memrchr;
+    memset;
+    mincore;
+    mkdir;
+    mkdirat;
+    mkdtemp;
+    mkfifo;
+    mkfifoat;
+    mknod;
+    mknodat;
+    mkostemp;
+    mkostemp64;
+    mkostemps;
+    mkostemps64;
+    mkstemp;
+    mkstemp64;
+    mkstemps;
+    mkstemps64;
+    mktemp;
+    mktime;
+    mktime64; # arm x86 mips
+    mktime_tz;
+    mlock;
+    mlockall;
+    mmap;
+    mmap64;
+    mount;
+    mprotect;
+    mrand48;
+    mremap;
+    msync;
+    munlock;
+    munlockall;
+    munmap;
+    nanosleep;
+    newlocale;
+    nftw;
+    nftw64;
+    nice;
+    nrand48;
+    nsdispatch;
+    ntohl;
+    ntohs;
+    open;
+    open64;
+    open_memstream;
+    open_wmemstream;
+    openat;
+    openat64;
+    opendir;
+    openlog;
+    openpty;
+    optarg;
+    opterr;
+    optind;
+    optopt;
+    optreset;
+    pathconf;
+    pause;
+    pclose;
+    perror;
+    personality;
+    pipe;
+    pipe2;
+    poll;
+    popen;
+    posix_fadvise;
+    posix_fadvise64;
+    posix_fallocate;
+    posix_fallocate64;
+    posix_madvise;
+    posix_memalign;
+    posix_openpt;
+    ppoll;
+    prctl;
+    pread;
+    pread64;
+    printf;
+    prlimit64;
+    process_vm_readv;
+    process_vm_writev;
+    pselect;
+    psiginfo;
+    psignal;
+    pthread_atfork;
+    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;
+    pthread_condattr_getpshared;
+    pthread_condattr_init;
+    pthread_condattr_setclock;
+    pthread_condattr_setpshared;
+    pthread_create;
+    pthread_detach;
+    pthread_equal;
+    pthread_exit;
+    pthread_getattr_np;
+    pthread_getcpuclockid;
+    pthread_getschedparam;
+    pthread_getspecific;
+    pthread_gettid_np;
+    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;
+    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;
+    pthread_rwlockattr_getpshared;
+    pthread_rwlockattr_init;
+    pthread_rwlockattr_setkind_np;
+    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
+    pwrite;
+    pwrite64;
+    qsort;
+    quick_exit;
+    raise;
+    rand;
+    rand_r;
+    random;
+    read;
+    readahead;
+    readdir;
+    readdir64;
+    readdir64_r;
+    readdir_r;
+    readlink;
+    readlinkat;
+    readv;
+    realloc;
+    realpath;
+    reboot;
+    recv;
+    recvfrom;
+    recvmmsg;
+    recvmsg;
+    regcomp;
+    regerror;
+    regexec;
+    regfree;
+    remove;
+    removexattr;
+    remque;
+    rename;
+    renameat;
+    res_init;
+    res_mkquery;
+    res_query;
+    res_search;
+    rewind;
+    rewinddir;
+    rmdir;
+    sbrk;
+    scandir;
+    scandir64;
+    scanf;
+    sched_get_priority_max;
+    sched_get_priority_min;
+    sched_getaffinity;
+    sched_getcpu;
+    sched_getparam;
+    sched_getscheduler;
+    sched_rr_get_interval;
+    sched_setaffinity;
+    sched_setparam;
+    sched_setscheduler;
+    sched_yield;
+    seed48;
+    seekdir;
+    select;
+    sem_close;
+    sem_destroy;
+    sem_getvalue;
+    sem_init;
+    sem_open;
+    sem_post;
+    sem_timedwait;
+    sem_trywait;
+    sem_unlink;
+    sem_wait;
+    send;
+    sendfile;
+    sendfile64;
+    sendmmsg;
+    sendmsg;
+    sendto;
+    setbuf;
+    setbuffer;
+    setegid;
+    setenv;
+    seteuid;
+    setfsgid;
+    setfsuid;
+    setgid;
+    setgroups;
+    sethostname;
+    setitimer;
+    setjmp;
+    setlinebuf;
+    setlocale;
+    setlogmask;
+    setmntent;
+    setns;
+    setpgid;
+    setpgrp;
+    setpriority;
+    setprogname;
+    setregid;
+    setresgid;
+    setresuid;
+    setreuid;
+    setrlimit;
+    setrlimit64;
+    setservent;
+    setsid;
+    setsockopt;
+    setstate;
+    settimeofday;
+    setuid;
+    setutent;
+    setvbuf;
+    setxattr;
+    shutdown;
+    sigaction;
+    sigaddset;
+    sigaltstack;
+    sigblock;
+    sigdelset;
+    sigemptyset;
+    sigfillset;
+    siginterrupt;
+    sigismember;
+    siglongjmp;
+    signal;
+    signalfd;
+    sigpending;
+    sigprocmask;
+    sigqueue;
+    sigsetjmp;
+    sigsetmask;
+    sigsuspend;
+    sigtimedwait;
+    sigwait;
+    sigwaitinfo;
+    sleep;
+    snprintf;
+    socket;
+    socketpair;
+    splice;
+    sprintf;
+    srand;
+    srand48;
+    srandom;
+    sscanf;
+    stat;
+    stat64;
+    statfs;
+    statfs64;
+    statvfs;
+    statvfs64;
+    stderr;
+    stdin;
+    stdout;
+    stpcpy;
+    stpncpy;
+    strcasecmp;
+    strcasecmp_l;
+    strcasestr;
+    strcat;
+    strchr;
+    strcmp;
+    strcoll;
+    strcoll_l;
+    strcpy;
+    strcspn;
+    strdup;
+    strerror;
+    strerror_l;
+    strerror_r;
+    strftime;
+    strftime_l;
+    strlcat;
+    strlcpy;
+    strlen;
+    strncasecmp;
+    strncasecmp_l;
+    strncat;
+    strncmp;
+    strncpy;
+    strndup;
+    strnlen;
+    strpbrk;
+    strptime;
+    strrchr;
+    strsep;
+    strsignal;
+    strspn;
+    strstr;
+    strtod;
+    strtof;
+    strtoimax;
+    strtok;
+    strtok_r;
+    strtol;
+    strtold;
+    strtold_l;
+    strtoll;
+    strtoll_l;
+    strtoq;
+    strtoul;
+    strtoull;
+    strtoull_l;
+    strtoumax;
+    strtouq;
+    strxfrm;
+    strxfrm_l;
+    swapoff;
+    swapon;
+    swprintf;
+    swscanf;
+    symlink;
+    symlinkat;
+    sync;
+    sys_siglist;
+    sys_signame;
+    syscall;
+    sysconf;
+    sysinfo;
+    syslog;
+    system;
+    tcdrain;
+    tcflow;
+    tcflush;
+    tcgetattr;
+    tcgetpgrp;
+    tcgetsid;
+    tcsendbreak;
+    tcsetattr;
+    tcsetpgrp;
+    tdelete;
+    tdestroy;
+    tee;
+    telldir;
+    tempnam;
+    tfind;
+    tgkill;
+    time;
+    timegm;
+    timegm64; # arm x86 mips
+    timelocal;
+    timelocal64; # arm x86 mips
+    timer_create;
+    timer_delete;
+    timer_getoverrun;
+    timer_gettime;
+    timer_settime;
+    timerfd_create;
+    timerfd_gettime;
+    timerfd_settime;
+    times;
+    timezone;
+    tmpfile;
+    tmpnam;
+    toascii;
+    tolower;
+    tolower_l;
+    toupper;
+    toupper_l;
+    towlower;
+    towlower_l;
+    towupper;
+    towupper_l;
+    truncate;
+    truncate64;
+    tsearch;
+    ttyname;
+    ttyname_r;
+    twalk;
+    tzname;
+    tzset;
+    umask;
+    umount;
+    umount2;
+    uname;
+    ungetc;
+    ungetwc;
+    unlink;
+    unlinkat;
+    unlockpt;
+    unsetenv;
+    unshare;
+    uselocale;
+    usleep;
+    utime;
+    utimensat;
+    utimes;
+    utmpname;
+    valloc; # arm x86 mips
+    vasprintf;
+    vdprintf;
+    verr;
+    verrx;
+    vfork;
+    vfprintf;
+    vfscanf;
+    vfwprintf;
+    vfwscanf;
+    vmsplice;
+    vprintf;
+    vscanf;
+    vsnprintf;
+    vsprintf;
+    vsscanf;
+    vswprintf;
+    vswscanf;
+    vsyslog;
+    vwarn;
+    vwarnx;
+    vwprintf;
+    vwscanf;
+    wait;
+    wait4;
+    waitid;
+    waitpid;
+    warn;
+    warnx;
+    wcpcpy;
+    wcpncpy;
+    wcrtomb;
+    wcscasecmp;
+    wcscasecmp_l;
+    wcscat;
+    wcschr;
+    wcscmp;
+    wcscoll;
+    wcscoll_l;
+    wcscpy;
+    wcscspn;
+    wcsdup;
+    wcsftime;
+    wcslcat;
+    wcslcpy;
+    wcslen;
+    wcsncasecmp;
+    wcsncasecmp_l;
+    wcsncat;
+    wcsncmp;
+    wcsncpy;
+    wcsnlen;
+    wcsnrtombs;
+    wcspbrk;
+    wcsrchr;
+    wcsrtombs;
+    wcsspn;
+    wcsstr;
+    wcstod;
+    wcstof;
+    wcstoimax;
+    wcstok;
+    wcstol;
+    wcstold;
+    wcstold_l;
+    wcstoll;
+    wcstoll_l;
+    wcstombs;
+    wcstoul;
+    wcstoull;
+    wcstoull_l;
+    wcstoumax;
+    wcswidth;
+    wcsxfrm;
+    wcsxfrm_l;
+    wctob;
+    wctomb;
+    wctype;
+    wctype_l;
+    wcwidth;
+    wmemchr;
+    wmemcmp;
+    wmemcpy;
+    wmemmove;
+    wmempcpy;
+    wmemset;
+    wprintf;
+    write;
+    writev;
+    wscanf;
+  local:
+    *;
+};
+
+LIBC_N {
+  global:
+    __fread_chk;
+    __fwrite_chk;
+    __getcwd_chk;
+    __pwrite_chk;
+    __pwrite64_chk;
+    __write_chk;
+    fileno_unlocked;
+    getgrgid_r;
+    getgrnam_r;
+    preadv;
+    preadv64;
+    prlimit; # arm mips x86
+    pthread_barrierattr_destroy;
+    pthread_barrierattr_getpshared;
+    pthread_barrierattr_init;
+    pthread_barrierattr_setpshared;
+    pthread_barrier_destroy;
+    pthread_barrier_init;
+    pthread_barrier_wait;
+    pthread_spin_destroy;
+    pthread_spin_init;
+    pthread_spin_lock;
+    pthread_spin_trylock;
+    pthread_spin_unlock;
+    pwritev;
+    pwritev64;
+    scandirat;
+    scandirat64;
+    strchrnul;
+} LIBC;
+
+LIBC_PRIVATE {
+  global:
+    __accept4; # arm x86 mips
+    __bionic_brk; # arm x86 mips
+    gMallocLeakZygoteChild;
+    SHA1Final; # arm x86 mips
+    SHA1Init; # arm x86 mips
+    SHA1Transform; # arm x86 mips
+    SHA1Update; # arm x86 mips
+} LIBC_N;
diff --git a/libc/libc.mips.map b/libc/libc.mips.map
index e268bad..5bee67e 100644
--- a/libc/libc.mips.map
+++ b/libc/libc.mips.map
@@ -38,12 +38,12 @@
     __freadable;
     __fsetlocking;
     __fstatfs64; # arm x86 mips
-    __futex_wait; # arm x86 mips
-    __futex_wake; # arm x86 mips
+    __futex_wait; # arm x86 mips nobrillo
+    __futex_wake; # arm x86 mips nobrillo
     __fwritable;
     __get_h_errno;
-    __get_thread; # arm x86 mips
-    __get_tls; # arm x86 mips
+    __get_thread; # arm x86 mips nobrillo
+    __get_tls; # arm x86 mips nobrillo
     __getcpu; # arm x86 mips
     __getcwd; # arm x86 mips
     __getdents64; # arm x86 mips
@@ -101,7 +101,7 @@
     __ns_skiprr; # arm x86 mips
     __ns_sprintrr; # arm x86 mips
     __ns_sprintrrf; # arm x86 mips
-    __open; # arm x86 mips
+    __open; # arm x86 mips nobrillo
     __open_2;
     __openat; # arm x86 mips
     __openat_2;
@@ -118,8 +118,8 @@
     __p_time;
     __p_type;
     __p_type_syms;
-    __page_shift; # arm x86 mips
-    __page_size; # arm x86 mips
+    __page_shift; # arm x86 mips nobrillo
+    __page_size; # arm x86 mips nobrillo
     __poll_chk;
     __popcountsi2; # arm x86 mips
     __ppoll; # arm x86 mips
@@ -130,7 +130,7 @@
     __pselect6; # arm x86 mips
     __pthread_cleanup_pop;
     __pthread_cleanup_push;
-    __pthread_gettid; # arm x86 mips
+    __pthread_gettid; # arm x86 mips nobrillo
     __ptrace; # arm x86 mips
     __putlong;
     __putshort;
@@ -170,8 +170,8 @@
     __sched_cpufree;
     __sched_getaffinity; # arm x86 mips
     __sclose; # arm x86 mips
-    __sdidinit; # arm x86 mips
-    __set_errno; # arm x86 mips
+    __sdidinit; # arm x86 mips nobrillo
+    __set_errno; # arm x86 mips nobrillo
     __set_tid_address; # arm x86 mips
     __set_tls; # arm mips
     __sF;
@@ -181,7 +181,7 @@
     __sglue; # arm x86 mips
     __sigaction; # arm x86 mips
     __signalfd4; # arm x86 mips
-    __sinit; # arm x86 mips
+    __sinit; # arm x86 mips nobrillo
     __smakebuf; # arm x86 mips
     __snprintf_chk;
     __socket; # arm x86 mips
@@ -237,7 +237,7 @@
     __umoddi3; # x86 mips
     __vsnprintf_chk;
     __vsprintf_chk;
-    __wait4; # arm x86 mips
+    __wait4; # arm x86 mips nobrillo
     __waitid; # arm x86 mips
     _ctype_;
     _Exit;
@@ -271,9 +271,9 @@
     android_gethostbynamefornet;
     android_set_abort_message;
     arc4random;
-    arc4random_addrandom; # arm x86 mips
+    arc4random_addrandom; # arm x86 mips nobrillo
     arc4random_buf;
-    arc4random_stir; # arm x86 mips
+    arc4random_stir; # arm x86 mips nobrillo
     arc4random_uniform;
     asctime;
     asctime64; # arm x86 mips
@@ -287,11 +287,11 @@
     atoll;
     basename;
     basename_r; # arm x86 mips
-    bcopy; # arm x86 mips
+    bcopy; # arm x86 mips nobrillo
     bind;
     bindresvport;
     brk;
-    bsd_signal; # arm x86 mips
+    bsd_signal; # arm x86 mips nobrillo
     bsearch;
     btowc;
     bzero; # arm x86 mips
@@ -347,7 +347,7 @@
     dup3;
     duplocale;
     endmntent;
-    endpwent;
+    endpwent; # arm x86 mips nobrillo
     endservent;
     endutent;
     environ;
@@ -394,7 +394,7 @@
     fdatasync;
     fdopen;
     fdopendir;
-    fdprintf; # arm x86 mips
+    fdprintf; # arm x86 mips nobrillo
     feof;
     feof_unlocked;
     ferror;
@@ -447,7 +447,7 @@
     fsync;
     ftell;
     ftello;
-    ftime; # arm x86 mips
+    ftime; # arm x86 mips nobrillo
     ftok;
     ftruncate;
     ftruncate64;
@@ -480,8 +480,8 @@
     getchar_unlocked;
     getcwd;
     getdelim;
-    getdents; # arm x86 mips
-    getdtablesize; # arm x86 mips
+    getdents; # arm x86 mips nobrillo
+    getdtablesize; # arm x86 mips nobrillo
     getegid;
     getenv;
     geteuid;
@@ -556,7 +556,7 @@
     if_nametoindex;
     imaxabs;
     imaxdiv;
-    index; # arm x86 mips
+    index; # arm x86 mips nobrillo
     inet_addr;
     inet_aton;
     inet_lnaof;
@@ -609,7 +609,7 @@
     isprint_l;
     ispunct;
     ispunct_l;
-    issetugid; # arm x86 mips
+    issetugid; # arm x86 mips nobrillo
     isspace;
     isspace_l;
     isupper;
@@ -699,7 +699,7 @@
     mempcpy;
     memrchr;
     memset;
-    memswap; # arm x86 mips
+    memswap; # arm x86 mips nobrillo
     mincore;
     mkdir;
     mkdirat;
@@ -790,7 +790,7 @@
     pthread_attr_getschedpolicy;
     pthread_attr_getscope;
     pthread_attr_getstack;
-    pthread_attr_getstackaddr; # arm x86 mips
+    pthread_attr_getstackaddr; # arm x86 mips nobrillo
     pthread_attr_getstacksize;
     pthread_attr_init;
     pthread_attr_setdetachstate;
@@ -799,7 +799,7 @@
     pthread_attr_setschedpolicy;
     pthread_attr_setscope;
     pthread_attr_setstack;
-    pthread_attr_setstackaddr; # arm x86 mips
+    pthread_attr_setstackaddr; # arm x86 mips nobrillo
     pthread_attr_setstacksize;
     pthread_cond_broadcast;
     pthread_cond_destroy;
@@ -1057,8 +1057,8 @@
     strncpy;
     strndup;
     strnlen;
-    strntoimax; # arm x86 mips
-    strntoumax; # arm x86 mips
+    strntoimax; # arm x86 mips nobrillo
+    strntoumax; # arm x86 mips nobrillo
     strpbrk;
     strptime;
     strrchr;
@@ -1077,7 +1077,7 @@
     strtoll;
     strtoll_l;
     strtoq;
-    strtotimeval; # arm x86 mips
+    strtotimeval; # arm x86 mips nobrillo
     strtoul;
     strtoull;
     strtoull_l;
@@ -1099,7 +1099,7 @@
     sysinfo;
     syslog;
     system;
-    sysv_signal; # arm x86 mips
+    sysv_signal; # arm x86 mips nobrillo
     tcdrain;
     tcflow;
     tcflush;
@@ -1131,7 +1131,7 @@
     timerfd_settime;
     times;
     timezone;
-    tkill; # arm x86 mips
+    tkill; # arm x86 mips nobrillo
     tmpfile;
     tmpnam;
     toascii;
@@ -1173,7 +1173,7 @@
     vdprintf;
     verr;
     verrx;
-    vfdprintf; # arm x86 mips
+    vfdprintf; # arm x86 mips nobrillo
     vfork;
     vfprintf;
     vfscanf;
@@ -1193,7 +1193,7 @@
     vwprintf;
     vwscanf;
     wait;
-    wait3; # arm x86 mips
+    wait3; # arm x86 mips nobrillo
     wait4;
     waitid;
     waitpid;
@@ -1242,7 +1242,7 @@
     wcstoull;
     wcstoull_l;
     wcstoumax;
-    wcswcs; # arm x86 mips
+    wcswcs; # arm x86 mips nobrillo
     wcswidth;
     wcsxfrm;
     wcsxfrm_l;
@@ -1302,10 +1302,10 @@
   global:
     __accept4; # arm x86 mips
     __bionic_brk; # arm x86 mips
-    dlmalloc; # arm x86 mips
-    dlmalloc_inspect_all;
-    dlmalloc_trim;
-    dlmalloc_usable_size; # arm x86 mips
+    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
     gMallocLeakZygoteChild;
     SHA1Final; # arm x86 mips
     SHA1Init; # arm x86 mips
diff --git a/libc/libc.mips64.map b/libc/libc.mips64.map
index 763f77e..8fa46a8 100644
--- a/libc/libc.mips64.map
+++ b/libc/libc.mips64.map
@@ -241,7 +241,6 @@
     dup3;
     duplocale;
     endmntent;
-    endpwent;
     endservent;
     endutent;
     environ;
@@ -1182,7 +1181,5 @@
 
 LIBC_PRIVATE {
   global:
-    dlmalloc_inspect_all;
-    dlmalloc_trim;
     gMallocLeakZygoteChild;
 } LIBC_N;
diff --git a/libc/libc.x86.brillo.map b/libc/libc.x86.brillo.map
new file mode 100644
index 0000000..f66f21b
--- /dev/null
+++ b/libc/libc.x86.brillo.map
@@ -0,0 +1,1275 @@
+# Generated by genversionscripts.py. Do not edit.
+LIBC {
+  global:
+    __assert;
+    __assert2;
+    __b64_ntop;
+    __b64_pton;
+    __brk; # arm x86 mips
+    __cmsg_nxthdr;
+    __connect; # arm x86 mips
+    __ctype_get_mb_cur_max;
+    __cxa_atexit;
+    __cxa_finalize;
+    __cxa_thread_atexit_impl;
+    __divdi3; # arm x86 mips
+    __dn_comp;
+    __dn_count_labels;
+    __dn_skipname;
+    __epoll_pwait; # arm x86 mips
+    __errno;
+    __exit; # arm x86 mips
+    __fadvise64; # x86 mips
+    __fbufsize;
+    __fcntl64; # arm x86 mips
+    __FD_CLR_chk;
+    __FD_ISSET_chk;
+    __FD_SET_chk;
+    __fgets_chk;
+    __flbf;
+    __fp_nquery;
+    __fp_query;
+    __fpclassify;
+    __fpclassifyd;
+    __fpclassifyf;
+    __fpclassifyl;
+    __fpending;
+    __fpurge;
+    __freadable;
+    __fsetlocking;
+    __fstatfs64; # arm x86 mips
+    __fwritable;
+    __get_h_errno;
+    __getcpu; # arm x86 mips
+    __getcwd; # arm x86 mips
+    __getdents64; # arm x86 mips
+    __getpid; # arm x86 mips
+    __getpriority; # arm x86 mips
+    __gnu_basename;
+    __gnu_strerror_r;
+    __hostalias;
+    __ioctl; # arm x86 mips
+    __isfinite;
+    __isfinitef;
+    __isfinitel;
+    __isinf;
+    __isinff;
+    __isinfl;
+    __isnan;
+    __isnanf;
+    __isnanl;
+    __isnormal;
+    __isnormalf;
+    __isnormall;
+    __isthreaded;
+    __libc_current_sigrtmax;
+    __libc_current_sigrtmin;
+    __libc_init;
+    __llseek; # arm x86 mips
+    __loc_aton;
+    __loc_ntoa;
+    __memchr_chk;
+    __memcpy_chk;
+    __memmove_chk;
+    __memrchr_chk;
+    __memset_chk;
+    __mmap2; # arm x86 mips
+    __moddi3; # 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;
+    __openat; # arm x86 mips
+    __openat_2;
+    __p_cdname;
+    __p_cdnname;
+    __p_class;
+    __p_class_syms;
+    __p_fqname;
+    __p_fqnname;
+    __p_option;
+    __p_query;
+    __p_rcode;
+    __p_secstodate;
+    __p_time;
+    __p_type;
+    __p_type_syms;
+    __poll_chk;
+    __popcountsi2; # arm x86 mips
+    __ppoll; # arm x86 mips
+    __ppoll_chk;
+    __pread64_chk;
+    __pread_chk;
+    __progname;
+    __pselect6; # arm x86 mips
+    __pthread_cleanup_pop;
+    __pthread_cleanup_push;
+    __ptrace; # arm x86 mips
+    __putlong;
+    __putshort;
+    __read_chk;
+    __readlink_chk;
+    __readlinkat_chk;
+    __reboot; # arm x86 mips
+    __recvfrom_chk;
+    __register_atfork;
+    __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
+    __rt_sigprocmask; # arm x86 mips
+    __rt_sigsuspend; # arm x86 mips
+    __rt_sigtimedwait; # arm x86 mips
+    __sched_cpualloc;
+    __sched_cpucount;
+    __sched_cpufree;
+    __sched_getaffinity; # arm x86 mips
+    __sclose; # arm x86 mips
+    __set_thread_area; # x86
+    __set_tid_address; # arm x86 mips
+    __sF;
+    __sflags; # arm x86 mips
+    __sflush; # arm x86 mips
+    __sfp; # arm x86 mips
+    __sglue; # arm x86 mips
+    __sigaction; # arm x86 mips
+    __signalfd4; # arm x86 mips
+    __smakebuf; # arm x86 mips
+    __snprintf_chk;
+    __socket; # arm x86 mips
+    __sprintf_chk;
+    __sread; # arm x86 mips
+    __srefill; # arm x86 mips
+    __srget; # arm x86 mips
+    __sseek; # arm x86 mips
+    __stack_chk_fail;
+    __stack_chk_guard;
+    __statfs64; # arm x86 mips
+    __stpcpy_chk;
+    __stpncpy_chk;
+    __stpncpy_chk2;
+    __strcat_chk;
+    __strchr_chk;
+    __strcpy_chk;
+    __strlcat_chk;
+    __strlcpy_chk;
+    __strlen_chk;
+    __strncat_chk;
+    __strncpy_chk;
+    __strncpy_chk2;
+    __strrchr_chk;
+    __swbuf; # arm x86 mips
+    __swrite; # arm x86 mips
+    __swsetup; # arm x86 mips
+    __sym_ntop;
+    __sym_ntos;
+    __sym_ston;
+    __system_properties_init;
+    __system_property_add;
+    __system_property_area__;
+    __system_property_area_init;
+    __system_property_area_serial;
+    __system_property_find;
+    __system_property_find_nth;
+    __system_property_foreach;
+    __system_property_get;
+    __system_property_read;
+    __system_property_serial;
+    __system_property_set;
+    __system_property_set_filename;
+    __system_property_update;
+    __system_property_wait_any;
+    __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
+    __udivdi3; # arm x86 mips
+    __umask_chk;
+    __umoddi3; # x86 mips
+    __vsnprintf_chk;
+    __vsprintf_chk;
+    __waitid; # arm x86 mips
+    _ctype_;
+    _Exit;
+    _exit;
+    _flushlbf;
+    _fwalk; # arm x86 mips
+    _getlong;
+    _getshort;
+    _longjmp;
+    _resolv_delete_cache_for_net;
+    _resolv_flush_cache_for_net;
+    _resolv_set_nameservers_for_net;
+    _setjmp;
+    _tolower;
+    _tolower_tab_; # arm x86 mips
+    _toupper;
+    _toupper_tab_; # arm x86 mips
+    abort;
+    abs;
+    accept;
+    accept4;
+    access;
+    acct;
+    alarm;
+    alphasort;
+    alphasort64;
+    android_getaddrinfofornet;
+    android_getaddrinfofornetcontext;
+    android_gethostbyaddrfornet;
+    android_gethostbynamefornet;
+    android_set_abort_message;
+    arc4random;
+    arc4random_buf;
+    arc4random_uniform;
+    asctime;
+    asctime64; # arm x86 mips
+    asctime64_r; # arm x86 mips
+    asctime_r;
+    asprintf;
+    at_quick_exit;
+    atof;
+    atoi;
+    atol;
+    atoll;
+    basename;
+    basename_r; # arm x86 mips
+    bind;
+    bindresvport;
+    brk;
+    bsearch;
+    btowc;
+    bzero; # arm x86 mips
+    c16rtomb;
+    c32rtomb;
+    calloc;
+    capget;
+    capset;
+    cfgetispeed;
+    cfgetospeed;
+    cfmakeraw;
+    cfsetispeed;
+    cfsetospeed;
+    cfsetspeed;
+    chdir;
+    chmod;
+    chown;
+    chroot;
+    clearenv;
+    clearerr;
+    clearerr_unlocked;
+    clock;
+    clock_getcpuclockid;
+    clock_getres;
+    clock_gettime;
+    clock_nanosleep;
+    clock_settime;
+    clone;
+    close;
+    closedir;
+    closelog;
+    connect;
+    creat;
+    creat64;
+    ctime;
+    ctime64; # arm x86 mips
+    ctime64_r; # arm x86 mips
+    ctime_r;
+    daemon;
+    daylight;
+    delete_module;
+    difftime;
+    dirfd;
+    dirname;
+    dirname_r; # arm x86 mips
+    div;
+    dn_expand;
+    dprintf;
+    drand48;
+    dup;
+    dup2;
+    dup3;
+    duplocale;
+    endmntent;
+    endservent;
+    endutent;
+    environ;
+    epoll_create;
+    epoll_create1;
+    epoll_ctl;
+    epoll_pwait;
+    epoll_wait;
+    erand48;
+    err;
+    error;
+    error_at_line;
+    error_message_count;
+    error_one_per_line;
+    error_print_progname;
+    errx;
+    ether_aton;
+    ether_aton_r;
+    ether_ntoa;
+    ether_ntoa_r;
+    eventfd;
+    eventfd_read;
+    eventfd_write;
+    execl;
+    execle;
+    execlp;
+    execv;
+    execve;
+    execvp;
+    execvpe;
+    exit;
+    faccessat;
+    fake_gmtime_r; # arm x86 mips
+    fake_localtime_r; # arm x86 mips
+    fallocate;
+    fallocate64;
+    fchdir;
+    fchmod;
+    fchmodat;
+    fchown;
+    fchownat;
+    fclose;
+    fcntl;
+    fdatasync;
+    fdopen;
+    fdopendir;
+    feof;
+    feof_unlocked;
+    ferror;
+    ferror_unlocked;
+    fflush;
+    ffs;
+    fgetc;
+    fgetln;
+    fgetpos;
+    fgets;
+    fgetwc;
+    fgetws;
+    fgetxattr;
+    fileno;
+    flistxattr;
+    flock;
+    flockfile;
+    fmemopen;
+    fnmatch;
+    fopen;
+    fork;
+    forkpty;
+    fpathconf;
+    fprintf;
+    fpurge;
+    fputc;
+    fputs;
+    fputwc;
+    fputws;
+    fread;
+    free;
+    free_malloc_leak_info;
+    freeaddrinfo;
+    freelocale;
+    fremovexattr;
+    freopen;
+    fscanf;
+    fseek;
+    fseeko;
+    fsetpos;
+    fsetxattr;
+    fstat;
+    fstat64;
+    fstatat;
+    fstatat64;
+    fstatfs;
+    fstatfs64;
+    fstatvfs;
+    fstatvfs64;
+    fsync;
+    ftell;
+    ftello;
+    ftok;
+    ftruncate;
+    ftruncate64;
+    ftrylockfile;
+    fts_children;
+    fts_close;
+    fts_open;
+    fts_read;
+    fts_set;
+    ftw;
+    ftw64;
+    funlockfile;
+    funopen;
+    futimens;
+    fwide;
+    fwprintf;
+    fwrite;
+    fwscanf;
+    gai_strerror;
+    get_avphys_pages;
+    get_malloc_leak_info;
+    get_nprocs;
+    get_nprocs_conf;
+    get_phys_pages;
+    getaddrinfo;
+    getauxval;
+    getc;
+    getc_unlocked;
+    getchar;
+    getchar_unlocked;
+    getcwd;
+    getdelim;
+    getegid;
+    getenv;
+    geteuid;
+    getgid;
+    getgrgid;
+    getgrnam;
+    getgrouplist;
+    getgroups;
+    gethostbyaddr;
+    gethostbyaddr_r;
+    gethostbyname;
+    gethostbyname2;
+    gethostbyname2_r;
+    gethostbyname_r;
+    gethostent;
+    gethostname;
+    getitimer;
+    getline;
+    getlogin;
+    getmntent;
+    getmntent_r;
+    getnameinfo;
+    getnetbyaddr;
+    getnetbyname;
+    getopt;
+    getopt_long;
+    getopt_long_only;
+    getpagesize;
+    getpeername;
+    getpgid;
+    getpgrp;
+    getpid;
+    getppid;
+    getpriority;
+    getprogname;
+    getprotobyname;
+    getprotobynumber;
+    getpt;
+    getpwnam;
+    getpwnam_r;
+    getpwuid;
+    getpwuid_r;
+    getresgid;
+    getresuid;
+    getrlimit;
+    getrlimit64;
+    getrusage;
+    gets;
+    getservbyname;
+    getservbyport;
+    getservent;
+    getsid;
+    getsockname;
+    getsockopt;
+    gettid;
+    gettimeofday;
+    getuid;
+    getutent;
+    getwc;
+    getwchar;
+    getxattr;
+    gmtime;
+    gmtime64; # arm x86 mips
+    gmtime64_r; # arm x86 mips
+    gmtime_r;
+    grantpt;
+    herror;
+    hstrerror;
+    htonl;
+    htons;
+    if_indextoname;
+    if_nametoindex;
+    imaxabs;
+    imaxdiv;
+    inet_addr;
+    inet_aton;
+    inet_lnaof;
+    inet_makeaddr;
+    inet_netof;
+    inet_network;
+    inet_nsap_addr;
+    inet_nsap_ntoa;
+    inet_ntoa;
+    inet_ntop;
+    inet_pton;
+    init_module;
+    initgroups;
+    initstate;
+    inotify_add_watch;
+    inotify_init;
+    inotify_init1;
+    inotify_rm_watch;
+    insque;
+    ioctl;
+    isalnum;
+    isalnum_l;
+    isalpha;
+    isalpha_l;
+    isascii;
+    isatty;
+    isblank;
+    isblank_l;
+    iscntrl;
+    iscntrl_l;
+    isdigit;
+    isdigit_l;
+    isfinite;
+    isfinitef;
+    isfinitel;
+    isgraph;
+    isgraph_l;
+    isinf;
+    isinff;
+    isinfl;
+    islower;
+    islower_l;
+    isnan;
+    isnanf;
+    isnanl;
+    isnormal;
+    isnormalf;
+    isnormall;
+    isprint;
+    isprint_l;
+    ispunct;
+    ispunct_l;
+    isspace;
+    isspace_l;
+    isupper;
+    isupper_l;
+    iswalnum;
+    iswalnum_l;
+    iswalpha;
+    iswalpha_l;
+    iswblank;
+    iswblank_l;
+    iswcntrl;
+    iswcntrl_l;
+    iswctype;
+    iswctype_l;
+    iswdigit;
+    iswdigit_l;
+    iswgraph;
+    iswgraph_l;
+    iswlower;
+    iswlower_l;
+    iswprint;
+    iswprint_l;
+    iswpunct;
+    iswpunct_l;
+    iswspace;
+    iswspace_l;
+    iswupper;
+    iswupper_l;
+    iswxdigit;
+    iswxdigit_l;
+    isxdigit;
+    isxdigit_l;
+    jrand48;
+    kill;
+    killpg;
+    klogctl;
+    labs;
+    lchown;
+    lcong48;
+    ldexp;
+    ldiv;
+    lfind;
+    lgetxattr;
+    link;
+    linkat;
+    listen;
+    listxattr;
+    llabs;
+    lldiv;
+    llistxattr;
+    localeconv;
+    localtime;
+    localtime64; # arm x86 mips
+    localtime64_r; # arm x86 mips
+    localtime_r;
+    login_tty;
+    longjmp;
+    lrand48;
+    lremovexattr;
+    lsearch;
+    lseek;
+    lseek64;
+    lsetxattr;
+    lstat;
+    lstat64;
+    madvise;
+    mallinfo;
+    malloc;
+    malloc_info;
+    malloc_usable_size;
+    mbrlen;
+    mbrtoc16;
+    mbrtoc32;
+    mbrtowc;
+    mbsinit;
+    mbsnrtowcs;
+    mbsrtowcs;
+    mbstowcs;
+    mbtowc;
+    memalign;
+    memccpy;
+    memchr;
+    memcmp;
+    memcpy;
+    memmem;
+    memmove;
+    mempcpy;
+    memrchr;
+    memset;
+    mincore;
+    mkdir;
+    mkdirat;
+    mkdtemp;
+    mkfifo;
+    mkfifoat;
+    mknod;
+    mknodat;
+    mkostemp;
+    mkostemp64;
+    mkostemps;
+    mkostemps64;
+    mkstemp;
+    mkstemp64;
+    mkstemps;
+    mkstemps64;
+    mktemp;
+    mktime;
+    mktime64; # arm x86 mips
+    mktime_tz;
+    mlock;
+    mlockall;
+    mmap;
+    mmap64;
+    mount;
+    mprotect;
+    mrand48;
+    mremap;
+    msync;
+    munlock;
+    munlockall;
+    munmap;
+    nanosleep;
+    newlocale;
+    nftw;
+    nftw64;
+    nice;
+    nrand48;
+    nsdispatch;
+    ntohl;
+    ntohs;
+    open;
+    open64;
+    open_memstream;
+    open_wmemstream;
+    openat;
+    openat64;
+    opendir;
+    openlog;
+    openpty;
+    optarg;
+    opterr;
+    optind;
+    optopt;
+    optreset;
+    pathconf;
+    pause;
+    pclose;
+    perror;
+    personality;
+    pipe;
+    pipe2;
+    poll;
+    popen;
+    posix_fadvise;
+    posix_fadvise64;
+    posix_fallocate;
+    posix_fallocate64;
+    posix_madvise;
+    posix_memalign;
+    posix_openpt;
+    ppoll;
+    prctl;
+    pread;
+    pread64;
+    printf;
+    prlimit64;
+    process_vm_readv;
+    process_vm_writev;
+    pselect;
+    psiginfo;
+    psignal;
+    pthread_atfork;
+    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;
+    pthread_condattr_getpshared;
+    pthread_condattr_init;
+    pthread_condattr_setclock;
+    pthread_condattr_setpshared;
+    pthread_create;
+    pthread_detach;
+    pthread_equal;
+    pthread_exit;
+    pthread_getattr_np;
+    pthread_getcpuclockid;
+    pthread_getschedparam;
+    pthread_getspecific;
+    pthread_gettid_np;
+    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;
+    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;
+    pthread_rwlockattr_getpshared;
+    pthread_rwlockattr_init;
+    pthread_rwlockattr_setkind_np;
+    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
+    pwrite;
+    pwrite64;
+    qsort;
+    quick_exit;
+    raise;
+    rand;
+    rand_r;
+    random;
+    read;
+    readahead;
+    readdir;
+    readdir64;
+    readdir64_r;
+    readdir_r;
+    readlink;
+    readlinkat;
+    readv;
+    realloc;
+    realpath;
+    reboot;
+    recv;
+    recvfrom;
+    recvmmsg;
+    recvmsg;
+    regcomp;
+    regerror;
+    regexec;
+    regfree;
+    remove;
+    removexattr;
+    remque;
+    rename;
+    renameat;
+    res_init;
+    res_mkquery;
+    res_query;
+    res_search;
+    rewind;
+    rewinddir;
+    rmdir;
+    sbrk;
+    scandir;
+    scandir64;
+    scanf;
+    sched_get_priority_max;
+    sched_get_priority_min;
+    sched_getaffinity;
+    sched_getcpu;
+    sched_getparam;
+    sched_getscheduler;
+    sched_rr_get_interval;
+    sched_setaffinity;
+    sched_setparam;
+    sched_setscheduler;
+    sched_yield;
+    seed48;
+    seekdir;
+    select;
+    sem_close;
+    sem_destroy;
+    sem_getvalue;
+    sem_init;
+    sem_open;
+    sem_post;
+    sem_timedwait;
+    sem_trywait;
+    sem_unlink;
+    sem_wait;
+    send;
+    sendfile;
+    sendfile64;
+    sendmmsg;
+    sendmsg;
+    sendto;
+    setbuf;
+    setbuffer;
+    setegid;
+    setenv;
+    seteuid;
+    setfsgid;
+    setfsuid;
+    setgid;
+    setgroups;
+    sethostname;
+    setitimer;
+    setjmp;
+    setlinebuf;
+    setlocale;
+    setlogmask;
+    setmntent;
+    setns;
+    setpgid;
+    setpgrp;
+    setpriority;
+    setprogname;
+    setregid;
+    setresgid;
+    setresuid;
+    setreuid;
+    setrlimit;
+    setrlimit64;
+    setservent;
+    setsid;
+    setsockopt;
+    setstate;
+    settimeofday;
+    setuid;
+    setutent;
+    setvbuf;
+    setxattr;
+    shutdown;
+    sigaction;
+    sigaddset;
+    sigaltstack;
+    sigblock;
+    sigdelset;
+    sigemptyset;
+    sigfillset;
+    siginterrupt;
+    sigismember;
+    siglongjmp;
+    signal;
+    signalfd;
+    sigpending;
+    sigprocmask;
+    sigqueue;
+    sigsetjmp;
+    sigsetmask;
+    sigsuspend;
+    sigtimedwait;
+    sigwait;
+    sigwaitinfo;
+    sleep;
+    snprintf;
+    socket;
+    socketpair;
+    splice;
+    sprintf;
+    srand;
+    srand48;
+    srandom;
+    sscanf;
+    stat;
+    stat64;
+    statfs;
+    statfs64;
+    statvfs;
+    statvfs64;
+    stderr;
+    stdin;
+    stdout;
+    stpcpy;
+    stpncpy;
+    strcasecmp;
+    strcasecmp_l;
+    strcasestr;
+    strcat;
+    strchr;
+    strcmp;
+    strcoll;
+    strcoll_l;
+    strcpy;
+    strcspn;
+    strdup;
+    strerror;
+    strerror_l;
+    strerror_r;
+    strftime;
+    strftime_l;
+    strlcat;
+    strlcpy;
+    strlen;
+    strncasecmp;
+    strncasecmp_l;
+    strncat;
+    strncmp;
+    strncpy;
+    strndup;
+    strnlen;
+    strpbrk;
+    strptime;
+    strrchr;
+    strsep;
+    strsignal;
+    strspn;
+    strstr;
+    strtod;
+    strtof;
+    strtoimax;
+    strtok;
+    strtok_r;
+    strtol;
+    strtold;
+    strtold_l;
+    strtoll;
+    strtoll_l;
+    strtoq;
+    strtoul;
+    strtoull;
+    strtoull_l;
+    strtoumax;
+    strtouq;
+    strxfrm;
+    strxfrm_l;
+    swapoff;
+    swapon;
+    swprintf;
+    swscanf;
+    symlink;
+    symlinkat;
+    sync;
+    sys_siglist;
+    sys_signame;
+    syscall;
+    sysconf;
+    sysinfo;
+    syslog;
+    system;
+    tcdrain;
+    tcflow;
+    tcflush;
+    tcgetattr;
+    tcgetpgrp;
+    tcgetsid;
+    tcsendbreak;
+    tcsetattr;
+    tcsetpgrp;
+    tdelete;
+    tdestroy;
+    tee;
+    telldir;
+    tempnam;
+    tfind;
+    tgkill;
+    time;
+    timegm;
+    timegm64; # arm x86 mips
+    timelocal;
+    timelocal64; # arm x86 mips
+    timer_create;
+    timer_delete;
+    timer_getoverrun;
+    timer_gettime;
+    timer_settime;
+    timerfd_create;
+    timerfd_gettime;
+    timerfd_settime;
+    times;
+    timezone;
+    tmpfile;
+    tmpnam;
+    toascii;
+    tolower;
+    tolower_l;
+    toupper;
+    toupper_l;
+    towlower;
+    towlower_l;
+    towupper;
+    towupper_l;
+    truncate;
+    truncate64;
+    tsearch;
+    ttyname;
+    ttyname_r;
+    twalk;
+    tzname;
+    tzset;
+    umask;
+    umount;
+    umount2;
+    uname;
+    ungetc;
+    ungetwc;
+    unlink;
+    unlinkat;
+    unlockpt;
+    unsetenv;
+    unshare;
+    uselocale;
+    usleep;
+    utime;
+    utimensat;
+    utimes;
+    utmpname;
+    valloc; # arm x86 mips
+    vasprintf;
+    vdprintf;
+    verr;
+    verrx;
+    vfork;
+    vfprintf;
+    vfscanf;
+    vfwprintf;
+    vfwscanf;
+    vmsplice;
+    vprintf;
+    vscanf;
+    vsnprintf;
+    vsprintf;
+    vsscanf;
+    vswprintf;
+    vswscanf;
+    vsyslog;
+    vwarn;
+    vwarnx;
+    vwprintf;
+    vwscanf;
+    wait;
+    wait4;
+    waitid;
+    waitpid;
+    warn;
+    warnx;
+    wcpcpy;
+    wcpncpy;
+    wcrtomb;
+    wcscasecmp;
+    wcscasecmp_l;
+    wcscat;
+    wcschr;
+    wcscmp;
+    wcscoll;
+    wcscoll_l;
+    wcscpy;
+    wcscspn;
+    wcsdup;
+    wcsftime;
+    wcslcat;
+    wcslcpy;
+    wcslen;
+    wcsncasecmp;
+    wcsncasecmp_l;
+    wcsncat;
+    wcsncmp;
+    wcsncpy;
+    wcsnlen;
+    wcsnrtombs;
+    wcspbrk;
+    wcsrchr;
+    wcsrtombs;
+    wcsspn;
+    wcsstr;
+    wcstod;
+    wcstof;
+    wcstoimax;
+    wcstok;
+    wcstol;
+    wcstold;
+    wcstold_l;
+    wcstoll;
+    wcstoll_l;
+    wcstombs;
+    wcstoul;
+    wcstoull;
+    wcstoull_l;
+    wcstoumax;
+    wcswidth;
+    wcsxfrm;
+    wcsxfrm_l;
+    wctob;
+    wctomb;
+    wctype;
+    wctype_l;
+    wcwidth;
+    wmemchr;
+    wmemcmp;
+    wmemcpy;
+    wmemmove;
+    wmempcpy;
+    wmemset;
+    wprintf;
+    write;
+    writev;
+    wscanf;
+  local:
+    *;
+};
+
+LIBC_N {
+  global:
+    __fread_chk;
+    __fwrite_chk;
+    __getcwd_chk;
+    __pwrite_chk;
+    __pwrite64_chk;
+    __write_chk;
+    fileno_unlocked;
+    getgrgid_r;
+    getgrnam_r;
+    preadv;
+    preadv64;
+    prlimit; # arm mips x86
+    pthread_barrierattr_destroy;
+    pthread_barrierattr_getpshared;
+    pthread_barrierattr_init;
+    pthread_barrierattr_setpshared;
+    pthread_barrier_destroy;
+    pthread_barrier_init;
+    pthread_barrier_wait;
+    pthread_spin_destroy;
+    pthread_spin_init;
+    pthread_spin_lock;
+    pthread_spin_trylock;
+    pthread_spin_unlock;
+    pwritev;
+    pwritev64;
+    scandirat;
+    scandirat64;
+    strchrnul;
+} LIBC;
+
+LIBC_PRIVATE {
+  global:
+    __accept4; # arm x86 mips
+    __bionic_brk; # arm x86 mips
+    __bionic_libgcc_compat_symbols; # arm x86
+    gMallocLeakZygoteChild;
+    SHA1Final; # arm x86 mips
+    SHA1Init; # arm x86 mips
+    SHA1Transform; # arm x86 mips
+    SHA1Update; # arm x86 mips
+} LIBC_N;
diff --git a/libc/libc.x86.map b/libc/libc.x86.map
index 6578370..7120e7a 100644
--- a/libc/libc.x86.map
+++ b/libc/libc.x86.map
@@ -38,12 +38,12 @@
     __freadable;
     __fsetlocking;
     __fstatfs64; # arm x86 mips
-    __futex_wait; # arm x86 mips
-    __futex_wake; # arm x86 mips
+    __futex_wait; # arm x86 mips nobrillo
+    __futex_wake; # arm x86 mips nobrillo
     __fwritable;
     __get_h_errno;
-    __get_thread; # arm x86 mips
-    __get_tls; # arm x86 mips
+    __get_thread; # arm x86 mips nobrillo
+    __get_tls; # arm x86 mips nobrillo
     __getcpu; # arm x86 mips
     __getcwd; # arm x86 mips
     __getdents64; # arm x86 mips
@@ -101,7 +101,7 @@
     __ns_skiprr; # arm x86 mips
     __ns_sprintrr; # arm x86 mips
     __ns_sprintrrf; # arm x86 mips
-    __open; # arm x86 mips
+    __open; # arm x86 mips nobrillo
     __open_2;
     __openat; # arm x86 mips
     __openat_2;
@@ -118,8 +118,8 @@
     __p_time;
     __p_type;
     __p_type_syms;
-    __page_shift; # arm x86 mips
-    __page_size; # arm x86 mips
+    __page_shift; # arm x86 mips nobrillo
+    __page_size; # arm x86 mips nobrillo
     __poll_chk;
     __popcountsi2; # arm x86 mips
     __ppoll; # arm x86 mips
@@ -130,7 +130,7 @@
     __pselect6; # arm x86 mips
     __pthread_cleanup_pop;
     __pthread_cleanup_push;
-    __pthread_gettid; # arm x86 mips
+    __pthread_gettid; # arm x86 mips nobrillo
     __ptrace; # arm x86 mips
     __putlong;
     __putshort;
@@ -170,8 +170,8 @@
     __sched_cpufree;
     __sched_getaffinity; # arm x86 mips
     __sclose; # arm x86 mips
-    __sdidinit; # arm x86 mips
-    __set_errno; # arm x86 mips
+    __sdidinit; # arm x86 mips nobrillo
+    __set_errno; # arm x86 mips nobrillo
     __set_thread_area; # x86
     __set_tid_address; # arm x86 mips
     __sF;
@@ -181,7 +181,7 @@
     __sglue; # arm x86 mips
     __sigaction; # arm x86 mips
     __signalfd4; # arm x86 mips
-    __sinit; # arm x86 mips
+    __sinit; # arm x86 mips nobrillo
     __smakebuf; # arm x86 mips
     __snprintf_chk;
     __socket; # arm x86 mips
@@ -237,7 +237,7 @@
     __umoddi3; # x86 mips
     __vsnprintf_chk;
     __vsprintf_chk;
-    __wait4; # arm x86 mips
+    __wait4; # arm x86 mips nobrillo
     __waitid; # arm x86 mips
     _ctype_;
     _Exit;
@@ -270,9 +270,9 @@
     android_gethostbynamefornet;
     android_set_abort_message;
     arc4random;
-    arc4random_addrandom; # arm x86 mips
+    arc4random_addrandom; # arm x86 mips nobrillo
     arc4random_buf;
-    arc4random_stir; # arm x86 mips
+    arc4random_stir; # arm x86 mips nobrillo
     arc4random_uniform;
     asctime;
     asctime64; # arm x86 mips
@@ -286,11 +286,11 @@
     atoll;
     basename;
     basename_r; # arm x86 mips
-    bcopy; # arm x86 mips
+    bcopy; # arm x86 mips nobrillo
     bind;
     bindresvport;
     brk;
-    bsd_signal; # arm x86 mips
+    bsd_signal; # arm x86 mips nobrillo
     bsearch;
     btowc;
     bzero; # arm x86 mips
@@ -345,7 +345,7 @@
     dup3;
     duplocale;
     endmntent;
-    endpwent;
+    endpwent; # arm x86 mips nobrillo
     endservent;
     endutent;
     environ;
@@ -392,7 +392,7 @@
     fdatasync;
     fdopen;
     fdopendir;
-    fdprintf; # arm x86 mips
+    fdprintf; # arm x86 mips nobrillo
     feof;
     feof_unlocked;
     ferror;
@@ -445,7 +445,7 @@
     fsync;
     ftell;
     ftello;
-    ftime; # arm x86 mips
+    ftime; # arm x86 mips nobrillo
     ftok;
     ftruncate;
     ftruncate64;
@@ -478,8 +478,8 @@
     getchar_unlocked;
     getcwd;
     getdelim;
-    getdents; # arm x86 mips
-    getdtablesize; # arm x86 mips
+    getdents; # arm x86 mips nobrillo
+    getdtablesize; # arm x86 mips nobrillo
     getegid;
     getenv;
     geteuid;
@@ -554,7 +554,7 @@
     if_nametoindex;
     imaxabs;
     imaxdiv;
-    index; # arm x86 mips
+    index; # arm x86 mips nobrillo
     inet_addr;
     inet_aton;
     inet_lnaof;
@@ -607,7 +607,7 @@
     isprint_l;
     ispunct;
     ispunct_l;
-    issetugid; # arm x86 mips
+    issetugid; # arm x86 mips nobrillo
     isspace;
     isspace_l;
     isupper;
@@ -697,7 +697,7 @@
     mempcpy;
     memrchr;
     memset;
-    memswap; # arm x86 mips
+    memswap; # arm x86 mips nobrillo
     mincore;
     mkdir;
     mkdirat;
@@ -788,7 +788,7 @@
     pthread_attr_getschedpolicy;
     pthread_attr_getscope;
     pthread_attr_getstack;
-    pthread_attr_getstackaddr; # arm x86 mips
+    pthread_attr_getstackaddr; # arm x86 mips nobrillo
     pthread_attr_getstacksize;
     pthread_attr_init;
     pthread_attr_setdetachstate;
@@ -797,7 +797,7 @@
     pthread_attr_setschedpolicy;
     pthread_attr_setscope;
     pthread_attr_setstack;
-    pthread_attr_setstackaddr; # arm x86 mips
+    pthread_attr_setstackaddr; # arm x86 mips nobrillo
     pthread_attr_setstacksize;
     pthread_cond_broadcast;
     pthread_cond_destroy;
@@ -1055,8 +1055,8 @@
     strncpy;
     strndup;
     strnlen;
-    strntoimax; # arm x86 mips
-    strntoumax; # arm x86 mips
+    strntoimax; # arm x86 mips nobrillo
+    strntoumax; # arm x86 mips nobrillo
     strpbrk;
     strptime;
     strrchr;
@@ -1075,7 +1075,7 @@
     strtoll;
     strtoll_l;
     strtoq;
-    strtotimeval; # arm x86 mips
+    strtotimeval; # arm x86 mips nobrillo
     strtoul;
     strtoull;
     strtoull_l;
@@ -1097,7 +1097,7 @@
     sysinfo;
     syslog;
     system;
-    sysv_signal; # arm x86 mips
+    sysv_signal; # arm x86 mips nobrillo
     tcdrain;
     tcflow;
     tcflush;
@@ -1129,7 +1129,7 @@
     timerfd_settime;
     times;
     timezone;
-    tkill; # arm x86 mips
+    tkill; # arm x86 mips nobrillo
     tmpfile;
     tmpnam;
     toascii;
@@ -1171,7 +1171,7 @@
     vdprintf;
     verr;
     verrx;
-    vfdprintf; # arm x86 mips
+    vfdprintf; # arm x86 mips nobrillo
     vfork;
     vfprintf;
     vfscanf;
@@ -1191,7 +1191,7 @@
     vwprintf;
     vwscanf;
     wait;
-    wait3; # arm x86 mips
+    wait3; # arm x86 mips nobrillo
     wait4;
     waitid;
     waitpid;
@@ -1240,7 +1240,7 @@
     wcstoull;
     wcstoull_l;
     wcstoumax;
-    wcswcs; # arm x86 mips
+    wcswcs; # arm x86 mips nobrillo
     wcswidth;
     wcsxfrm;
     wcsxfrm_l;
@@ -1301,10 +1301,10 @@
     __accept4; # arm x86 mips
     __bionic_brk; # arm x86 mips
     __bionic_libgcc_compat_symbols; # arm x86
-    dlmalloc; # arm x86 mips
-    dlmalloc_inspect_all;
-    dlmalloc_trim;
-    dlmalloc_usable_size; # arm x86 mips
+    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
     gMallocLeakZygoteChild;
     SHA1Final; # arm x86 mips
     SHA1Init; # arm x86 mips
diff --git a/libc/libc.x86_64.map b/libc/libc.x86_64.map
index 763f77e..8fa46a8 100644
--- a/libc/libc.x86_64.map
+++ b/libc/libc.x86_64.map
@@ -241,7 +241,6 @@
     dup3;
     duplocale;
     endmntent;
-    endpwent;
     endservent;
     endutent;
     environ;
@@ -1182,7 +1181,5 @@
 
 LIBC_PRIVATE {
   global:
-    dlmalloc_inspect_all;
-    dlmalloc_trim;
     gMallocLeakZygoteChild;
 } LIBC_N;
diff --git a/libc/private/bionic_macros.h b/libc/private/bionic_macros.h
index 4f3cf89..4969bd9 100644
--- a/libc/private/bionic_macros.h
+++ b/libc/private/bionic_macros.h
@@ -42,8 +42,8 @@
   (((value) + (alignment) - 1) & ~((alignment) - 1))
 
 #define BIONIC_ROUND_UP_POWER_OF_2(value) \
-  (sizeof(value) == 8) \
+  ((sizeof(value) == 8) \
     ? (1UL << (64 - __builtin_clzl(static_cast<unsigned long>(value)))) \
-    : (1UL << (32 - __builtin_clz(static_cast<unsigned int>(value))))
+    : (1UL << (32 - __builtin_clz(static_cast<unsigned int>(value)))))
 
 #endif // _BIONIC_MACROS_H_
diff --git a/libc/private/bionic_time_conversions.h b/libc/private/bionic_time_conversions.h
index 294c29a..a834843 100644
--- a/libc/private/bionic_time_conversions.h
+++ b/libc/private/bionic_time_conversions.h
@@ -47,14 +47,17 @@
 
 __END_DECLS
 
-static inline int check_timespec(const timespec* ts) {
-  if (ts != nullptr) {
-    if (ts->tv_nsec < 0 || ts->tv_nsec >= NS_PER_S) {
-      return EINVAL;
-    }
-    if (ts->tv_sec < 0) {
-      return ETIMEDOUT;
-    }
+static inline int check_timespec(const timespec* ts, bool null_allowed) {
+  if (null_allowed && ts == nullptr) {
+    return 0;
+  }
+  // glibc just segfaults if you pass a null timespec.
+  // That seems a lot more likely to catch bad code than returning EINVAL.
+  if (ts->tv_nsec < 0 || ts->tv_nsec >= NS_PER_S) {
+    return EINVAL;
+  }
+  if (ts->tv_sec < 0) {
+    return ETIMEDOUT;
   }
   return 0;
 }
diff --git a/libc/stdio/findfp.c b/libc/stdio/findfp.c
index 2696cfd..6e20562 100644
--- a/libc/stdio/findfp.c
+++ b/libc/stdio/findfp.c
@@ -44,37 +44,44 @@
 #define ALIGNBYTES (sizeof(uintptr_t) - 1)
 #define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
 
-int	__sdidinit;
-
 #define	NDYNAMIC 10		/* add ten more whenever necessary */
 
 #define	std(flags, file) \
 	{0,0,0,flags,file,{0,0},0,__sF+file,__sclose,__sread,__sseek,__swrite, \
 	    {(unsigned char *)(__sFext+file), 0},NULL,0,{0},{0},{0,0},0,0}
 
-				/* the usual - (stdin + stdout + stderr) */
-static FILE usual[FOPEN_MAX - 3];
-static struct __sfileext usualext[FOPEN_MAX - 3];
-static struct glue uglue = { 0, FOPEN_MAX - 3, usual };
-static struct glue *lastglue = &uglue;
 _THREAD_PRIVATE_MUTEX(__sfp_mutex);
 
-static struct __sfileext __sFext[3];
+// TODO: when we no longer have to support both clang and GCC, we can simplify all this.
+#define SBUF_INIT {0,0}
+#if defined(__LP64__)
+#define MBSTATE_T_INIT {{0},{0}}
+#else
+#define MBSTATE_T_INIT {{0}}
+#endif
+#define WCHAR_IO_DATA_INIT {MBSTATE_T_INIT,MBSTATE_T_INIT,{0},0,0}
+
+static struct __sfileext __sFext[3] = {
+  { SBUF_INIT, WCHAR_IO_DATA_INIT, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, false },
+  { SBUF_INIT, WCHAR_IO_DATA_INIT, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, false },
+  { SBUF_INIT, WCHAR_IO_DATA_INIT, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, false },
+};
 
 // __sF is exported for backwards compatibility. Until M, we didn't have symbols
 // for stdin/stdout/stderr; they were macros accessing __sF.
 FILE __sF[3] = {
-	std(__SRD, STDIN_FILENO),		/* stdin */
-	std(__SWR, STDOUT_FILENO),		/* stdout */
-	std(__SWR|__SNBF, STDERR_FILENO)	/* stderr */
+  std(__SRD, STDIN_FILENO),
+  std(__SWR, STDOUT_FILENO),
+  std(__SWR|__SNBF, STDERR_FILENO),
 };
 
-struct glue __sglue = { &uglue, 3, __sF };
-
 FILE* stdin = &__sF[0];
 FILE* stdout = &__sF[1];
 FILE* stderr = &__sF[2];
 
+struct glue __sglue = { NULL, 3, __sF };
+static struct glue* lastglue = &__sglue;
+
 static struct glue *
 moreglue(int n)
 {
@@ -114,9 +121,6 @@
 	int n;
 	struct glue *g;
 
-	if (!__sdidinit)
-		__sinit();
-
 	_THREAD_PRIVATE_MUTEX_LOCK(__sfp_mutex);
 	for (g = &__sglue; g != NULL; g = g->next) {
 		for (fp = g->iobs, n = g->niobs; --n >= 0; fp++)
@@ -149,48 +153,7 @@
 	return (fp);
 }
 
-/*
- * exit() and abort() call _cleanup() through the callback registered
- * with __atexit_register_cleanup(), set whenever we open or buffer a
- * file. This chicanery is done so that programs that do not use stdio
- * need not link it all in.
- *
- * The name `_cleanup' is, alas, fairly well known outside stdio.
- */
-void
-_cleanup(void)
-{
+__LIBC_HIDDEN__ void __libc_stdio_cleanup(void) {
 	/* (void) _fwalk(fclose); */
 	(void) _fwalk(__sflush);		/* `cheating' */
 }
-
-/*
- * __sinit() is called whenever stdio's internal variables must be set up.
- */
-void
-__sinit(void)
-{
-	_THREAD_PRIVATE_MUTEX(__sinit_mutex);
-
-	_THREAD_PRIVATE_MUTEX_LOCK(__sinit_mutex);
-	if (__sdidinit) {
-		/* bail out if caller lost the race */
-		_THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex);
-		return;
-	}
-
-	/* Initialize stdin/stdout/stderr (for the recursive mutex). http://b/18208568. */
-	for (size_t i = 0; i < 3; ++i) {
-		_FILEEXT_SETUP(__sF+i, __sFext+i);
-	}
-	/* Initialize the pre-allocated (but initially unused) streams. */
-	for (size_t i = 0; i < FOPEN_MAX - 3; ++i) {
-		_FILEEXT_SETUP(usual+i, usualext+i);
-	}
-
-	/* make sure we clean up on exit */
-	__atexit_register_cleanup(_cleanup); /* conservative */
-	__sdidinit = 1;
-
-	_THREAD_PRIVATE_MUTEX_UNLOCK(__sinit_mutex);
-}
diff --git a/libc/stdio/local.h b/libc/stdio/local.h
index 3ae7059..6dcd3ae 100644
--- a/libc/stdio/local.h
+++ b/libc/stdio/local.h
@@ -153,10 +153,8 @@
 __LIBC32_LEGACY_PUBLIC__ int __swsetup(FILE*);
 
 /* These were referenced by a couple of different pieces of middleware and the Crystax NDK. */
-__LIBC32_LEGACY_PUBLIC__ extern int __sdidinit;
 __LIBC32_LEGACY_PUBLIC__ int __sflags(const char*, int*);
 __LIBC32_LEGACY_PUBLIC__ FILE* __sfp(void);
-__LIBC32_LEGACY_PUBLIC__ void __sinit(void);
 __LIBC32_LEGACY_PUBLIC__ void __smakebuf(FILE*);
 
 /* These are referenced by the Greed for Glory franchise. */
@@ -170,7 +168,6 @@
 #pragma GCC visibility push(hidden)
 
 int	__sflush_locked(FILE *);
-void	_cleanup(void);
 int	__swhatbuf(FILE *, size_t *, int *);
 wint_t __fgetwc_unlock(FILE *);
 wint_t	__ungetwc(wint_t, FILE *);
@@ -179,8 +176,6 @@
 int	__vfwprintf(FILE * __restrict, const wchar_t * __restrict, __va_list);
 int	__vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list);
 
-extern void __atexit_register_cleanup(void (*)(void));
-
 /*
  * Return true if the given FILE cannot be written now.
  */
@@ -237,6 +232,10 @@
 extern int __sfvwrite(FILE *, struct __suio *);
 wint_t __fputwc_unlock(wchar_t wc, FILE *fp);
 
+/* Remove the if (!__sdidinit) __sinit() idiom from untouched upstream stdio code. */
+extern void __sinit(void); // Not actually implemented.
+#define __sdidinit 1
+
 #pragma GCC visibility pop
 
 __END_DECLS
diff --git a/libc/stdio/refill.c b/libc/stdio/refill.c
index e87c7b9..5b0811f 100644
--- a/libc/stdio/refill.c
+++ b/libc/stdio/refill.c
@@ -51,11 +51,6 @@
 int
 __srefill(FILE *fp)
 {
-
-	/* make sure stdio is set up */
-	if (!__sdidinit)
-		__sinit();
-
 	fp->_r = 0;		/* largely a convenience for callers */
 
 #if !defined(__ANDROID__)
diff --git a/libc/stdlib/atexit.c b/libc/stdlib/atexit.c
index 34a4db1..c817b63 100644
--- a/libc/stdlib/atexit.c
+++ b/libc/stdlib/atexit.c
@@ -185,51 +185,12 @@
 	}
 	_ATEXIT_UNLOCK();
 
+  extern void __libc_stdio_cleanup(void);
+  __libc_stdio_cleanup();
+
   /* BEGIN android-changed: call __unregister_atfork if dso is not null */
   if (dso != NULL) {
     __unregister_atfork(dso);
   }
   /* END android-changed */
 }
-
-/*
- * Register the cleanup function
- */
-void
-__atexit_register_cleanup(void (*func)(void))
-{
-	struct atexit *p;
-	size_t pgsize = getpagesize();
-
-	if (pgsize < sizeof(*p))
-		return;
-	_ATEXIT_LOCK();
-	p = __atexit;
-	while (p != NULL && p->next != NULL)
-		p = p->next;
-	if (p == NULL) {
-		p = mmap(NULL, pgsize, PROT_READ | PROT_WRITE,
-		    MAP_ANON | MAP_PRIVATE, -1, 0);
-		if (p == MAP_FAILED)
-			goto unlock;
-/* BEGIN android-changed */
-		prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, p, pgsize,
-		    "atexit handlers");
-/* END android-changed */
-		p->ind = 1;
-		p->max = (pgsize - ((char *)&p->fns[0] - (char *)p)) /
-		    sizeof(p->fns[0]);
-		p->next = NULL;
-		__atexit = p;
-	} else {
-		if (mprotect(p, pgsize, PROT_READ | PROT_WRITE))
-			goto unlock;
-	}
-	p->fns[0].fn_ptr = (void (*)(void *))func;
-	p->fns[0].fn_arg = NULL;
-	p->fns[0].fn_dso = NULL;
-	mprotect(p, pgsize, PROT_READ);
-	restartloop = 1;
-unlock:
-	_ATEXIT_UNLOCK();
-}
diff --git a/libc/tools/genversion-scripts.py b/libc/tools/genversion-scripts.py
index 37fb5e9..e15c04e 100755
--- a/libc/tools/genversion-scripts.py
+++ b/libc/tools/genversion-scripts.py
@@ -36,20 +36,26 @@
       basename = os.path.basename(script)
       dirname = os.path.dirname(script)
       for arch in all_arches:
-        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:
-                arches = line[index+1:].split()
-                if arch not in arches:
-                  continue
-              fout.write(line)
-        shutil.copyfile(tmp_path, dest_path)
+        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:
+                    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)
 
 
 generator = VersionScriptGenerator()
diff --git a/libc/upstream-dlmalloc/malloc.c b/libc/upstream-dlmalloc/malloc.c
index 3c9d36b..a61c0da 100644
--- a/libc/upstream-dlmalloc/malloc.c
+++ b/libc/upstream-dlmalloc/malloc.c
@@ -4822,8 +4822,13 @@
       req = MAX_SIZE_T; /* force downstream failure on overflow */
   }
   mem = dlmalloc(req);
-  if (mem != 0 && calloc_must_clear(mem2chunk(mem)))
-    memset(mem, 0, req);
+  if (mem != 0) {
+    mchunkptr p = mem2chunk(mem);
+    if (calloc_must_clear(p)) {
+      /* Make sure to clear all of the buffer, not just the requested size. */
+      memset(mem, 0, chunksize(p) - overhead_for(p));
+    }
+  }
   return mem;
 }
 
diff --git a/libc/upstream-netbsd/android/include/netbsd-compat.h b/libc/upstream-netbsd/android/include/netbsd-compat.h
index 0212d16..8d1c46b 100644
--- a/libc/upstream-netbsd/android/include/netbsd-compat.h
+++ b/libc/upstream-netbsd/android/include/netbsd-compat.h
@@ -32,6 +32,6 @@
 #define __unlockenv() 0
 
 #include <stddef.h>
-int reallocarr(void*, size_t, size_t);
+__LIBC_HIDDEN__ int reallocarr(void*, size_t, size_t);
 
 #endif
diff --git a/libdl/libdl.arm.map b/libdl/libdl.arm.map
index 5ad9f9d..b9e494a 100644
--- a/libdl/libdl.arm.map
+++ b/libdl/libdl.arm.map
@@ -18,6 +18,7 @@
   global:
     android_init_namespaces;
     android_create_namespace;
+    dlvsym;
 } LIBC;
 
 LIBC_PRIVATE {
diff --git a/libdl/libdl.arm64.map b/libdl/libdl.arm64.map
index 3535774..a8c98da 100644
--- a/libdl/libdl.arm64.map
+++ b/libdl/libdl.arm64.map
@@ -17,6 +17,7 @@
   global:
     android_init_namespaces;
     android_create_namespace;
+    dlvsym;
 } LIBC;
 
 LIBC_PRIVATE {
diff --git a/libdl/libdl.c b/libdl/libdl.c
index 3928ba2..0604d3e 100644
--- a/libdl/libdl.c
+++ b/libdl/libdl.c
@@ -24,9 +24,17 @@
 // in the dynamic linker and hijacked at runtime.
 
 void* dlopen(const char* filename __unused, int flag __unused) { return 0; }
+
 const char* dlerror(void) { return 0; }
+
 void* dlsym(void* handle __unused, const char* symbol __unused) { return 0; }
+
+void* dlvsym(void* handle __unused, const char* symbol __unused, const char* version __unused) {
+  return 0;
+}
+
 int dladdr(const void* addr __unused, Dl_info* info __unused) { return 0; }
+
 int dlclose(void* handle __unused) { return 0; }
 
 #if defined(__arm__)
@@ -57,6 +65,7 @@
 struct android_namespace_t* android_create_namespace(const char* name __unused,
                                                      const char* ld_library_path __unused,
                                                      const char* default_library_path __unused,
-                                                     bool isolated __unused) {
+                                                     bool isolated __unused,
+                                                     const char* permitted_when_isolated_path __unused) {
   return 0;
 }
diff --git a/libdl/libdl.map.txt b/libdl/libdl.map.txt
index 8d123fe..55a03cb 100644
--- a/libdl/libdl.map.txt
+++ b/libdl/libdl.map.txt
@@ -32,6 +32,7 @@
   global:
     android_init_namespaces;
     android_create_namespace;
+    dlvsym;
 } LIBC;
 
 LIBC_PRIVATE {
diff --git a/libdl/libdl.mips.map b/libdl/libdl.mips.map
index 3535774..a8c98da 100644
--- a/libdl/libdl.mips.map
+++ b/libdl/libdl.mips.map
@@ -17,6 +17,7 @@
   global:
     android_init_namespaces;
     android_create_namespace;
+    dlvsym;
 } LIBC;
 
 LIBC_PRIVATE {
diff --git a/libdl/libdl.mips64.map b/libdl/libdl.mips64.map
index 3535774..a8c98da 100644
--- a/libdl/libdl.mips64.map
+++ b/libdl/libdl.mips64.map
@@ -17,6 +17,7 @@
   global:
     android_init_namespaces;
     android_create_namespace;
+    dlvsym;
 } LIBC;
 
 LIBC_PRIVATE {
diff --git a/libdl/libdl.x86.map b/libdl/libdl.x86.map
index 3535774..a8c98da 100644
--- a/libdl/libdl.x86.map
+++ b/libdl/libdl.x86.map
@@ -17,6 +17,7 @@
   global:
     android_init_namespaces;
     android_create_namespace;
+    dlvsym;
 } LIBC;
 
 LIBC_PRIVATE {
diff --git a/libdl/libdl.x86_64.map b/libdl/libdl.x86_64.map
index 3535774..a8c98da 100644
--- a/libdl/libdl.x86_64.map
+++ b/libdl/libdl.x86_64.map
@@ -17,6 +17,7 @@
   global:
     android_init_namespaces;
     android_create_namespace;
+    dlvsym;
 } LIBC;
 
 LIBC_PRIVATE {
diff --git a/libm/Android.bp b/libm/Android.bp
index 0fc860a..081a139 100644
--- a/libm/Android.bp
+++ b/libm/Android.bp
@@ -3,18 +3,7 @@
 
 bionic_coverage = false
 
-// TODO: this comes from from upstream's libc, not libm, but it's an
-// implementation detail that should have hidden visibility, so it needs
-// to be in whatever library the math code is in.
-libm_common_src_files = ["digittoint.c"]
-
-// TODO: this is not in the BSDs.
-libm_common_src_files += [
-    "significandl.c",
-    "sincos.c",
-]
-
-libm_common_src_files += [
+libm_common_src_files = [
     "upstream-freebsd/lib/msun/bsdsrc/b_exp.c",
     "upstream-freebsd/lib/msun/bsdsrc/b_log.c",
     "upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c",
@@ -186,8 +175,19 @@
 ]
 
 libm_common_src_files += [
-    "fake_long_double.c",
+    // TODO: this comes from from upstream's libc, not libm, but it's an
+    // implementation detail that should have hidden visibility, so it needs
+    // to be in whatever library the math code is in.
+    "digittoint.c",
+
+    // Functionality not in the BSDs.
+    "significandl.c",
+    "sincos.c",
+
+    // Modified versions of BSD code.
     "signbit.c",
+
+    // Home-grown stuff.
     "fabs.cpp",
 ]
 
@@ -292,6 +292,9 @@
     sanitize: ["never"],
 
     multilib: {
+        lib32: {
+            srcs: ["fake_long_double.c"],
+        },
         lib64: {
             srcs: libm_ld128_src_files,
             local_include_dirs: libm_ld_local_includes,
@@ -307,15 +310,18 @@
         arm: {
             srcs: [
                 "arm/fenv.c",
-                "arm/sqrt.S",
-                "arm/floor.S",
             ],
-            exclude_srcs: [
-                // TODO: these require neon not available in arm
-                "upstream-freebsd/lib/msun/src/e_sqrt.c",
-                "upstream-freebsd/lib/msun/src/e_sqrtf.c",
-                "upstream-freebsd/lib/msun/src/s_floor.c",
-            ],
+            armv7_a_neon: {
+                srcs: [
+                    "arm/sqrt.S",
+                    "arm/floor.S",
+                ],
+                exclude_srcs: [
+                    "upstream-freebsd/lib/msun/src/e_sqrt.c",
+                    "upstream-freebsd/lib/msun/src/e_sqrtf.c",
+                    "upstream-freebsd/lib/msun/src/s_floor.c",
+                ],
+            },
             instruction_set: "arm",
             ldflags: ["-Wl,--hash-style=both"],
             version_script: "libm.arm.map",
@@ -323,8 +329,8 @@
 
         arm64: {
             srcs: [
-                "arm64/fenv.c",
                 "arm64/ceil.S",
+                "arm64/fenv.c",
                 "arm64/fma.S",
                 "arm64/floor.S",
                 "arm64/lrint.S",
@@ -333,6 +339,8 @@
                 "arm64/trunc.S",
             ],
             exclude_srcs: [
+                "upstream-freebsd/lib/msun/src/e_sqrt.c",
+                "upstream-freebsd/lib/msun/src/e_sqrtf.c",
                 "upstream-freebsd/lib/msun/src/s_ceil.c",
                 "upstream-freebsd/lib/msun/src/s_ceilf.c",
                 "upstream-freebsd/lib/msun/src/s_fma.c",
@@ -345,8 +353,6 @@
                 "upstream-freebsd/lib/msun/src/s_lrintf.c",
                 "upstream-freebsd/lib/msun/src/s_rint.c",
                 "upstream-freebsd/lib/msun/src/s_rintf.c",
-                "upstream-freebsd/lib/msun/src/e_sqrt.c",
-                "upstream-freebsd/lib/msun/src/e_sqrtf.c",
                 "upstream-freebsd/lib/msun/src/s_trunc.c",
                 "upstream-freebsd/lib/msun/src/s_truncf.c",
             ],
@@ -364,8 +370,73 @@
         },
 
         x86: {
+            srcs: [
+                "i387/fenv.c",
+                "x86/sqrt.S",
+                "x86/sqrtf.S",
+                "x86/e_acos.S",
+                "x86/e_asin.S",
+                "x86/e_atan2.S",
+                "x86/e_cosh.S",
+                "x86/e_exp.S",
+                "x86/e_hypot.S",
+                "x86/e_log10.S",
+                "x86/e_log.S",
+                "x86/e_pow.S",
+                "x86/e_sinh.S",
+                "x86/libm_reduce_pi04l.S",
+                "x86/libm_sincos_huge.S",
+                "x86/libm_tancot_huge.S",
+                "x86/s_atan.S",
+                "x86/s_cbrt.S",
+                "x86/s_cos.S",
+                "x86/s_expm1.S",
+                "x86/s_log1p.S",
+                "x86/s_sin.S",
+                "x86/s_tanh.S",
+                "x86/s_tan.S",
+            ],
+            exclude_srcs: [
+                "upstream-freebsd/lib/msun/src/e_acos.c",
+                "upstream-freebsd/lib/msun/src/e_asin.c",
+                "upstream-freebsd/lib/msun/src/e_atan2.c",
+                "upstream-freebsd/lib/msun/src/e_cosh.c",
+                "upstream-freebsd/lib/msun/src/e_exp.c",
+                "upstream-freebsd/lib/msun/src/e_hypot.c",
+                "upstream-freebsd/lib/msun/src/e_log.c",
+                "upstream-freebsd/lib/msun/src/e_log10.c",
+                "upstream-freebsd/lib/msun/src/e_pow.c",
+                "upstream-freebsd/lib/msun/src/e_sinh.c",
+                "upstream-freebsd/lib/msun/src/e_sqrt.c",
+                "upstream-freebsd/lib/msun/src/e_sqrtf.c",
+                "upstream-freebsd/lib/msun/src/s_atan.c",
+                "upstream-freebsd/lib/msun/src/s_cbrt.c",
+                "upstream-freebsd/lib/msun/src/s_cos.c",
+                "upstream-freebsd/lib/msun/src/s_expm1.c",
+                "upstream-freebsd/lib/msun/src/s_log1p.c",
+                "upstream-freebsd/lib/msun/src/s_sin.c",
+                "upstream-freebsd/lib/msun/src/s_tan.c",
+                "upstream-freebsd/lib/msun/src/s_tanh.c",
+            ],
+            sse4_1: {
+                srcs: [
+                    "x86/ceil.S",
+                    "x86/ceilf.S",
+                    "x86/floor.S",
+                    "x86/floorf.S",
+                    "x86/trunc.S",
+                    "x86/truncf.S",
+                ],
+                exclude_srcs: [
+                    "upstream-freebsd/lib/msun/src/s_ceil.c",
+                    "upstream-freebsd/lib/msun/src/s_ceilf.c",
+                    "upstream-freebsd/lib/msun/src/s_floor.c",
+                    "upstream-freebsd/lib/msun/src/s_floorf.c",
+                    "upstream-freebsd/lib/msun/src/s_trunc.c",
+                    "upstream-freebsd/lib/msun/src/s_truncf.c",
+                ],
+            },
             local_include_dirs: ["i387"],
-            srcs: ["i387/fenv.c"],
             // Clang has wrong long double sizes for x86.
             clang: false,
             ldflags: ["-Wl,--hash-style=both"],
@@ -373,7 +444,69 @@
         },
 
         x86_64: {
-            srcs: ["amd64/fenv.c"],
+            srcs: [
+                "amd64/fenv.c",
+                "x86_64/sqrt.S",
+                "x86_64/sqrtf.S",
+                "x86_64/e_acos.S",
+                "x86_64/e_asin.S",
+                "x86_64/e_atan2.S",
+                "x86_64/e_cosh.S",
+                "x86_64/e_exp.S",
+                "x86_64/e_hypot.S",
+                "x86_64/e_log10.S",
+                "x86_64/e_log.S",
+                "x86_64/e_pow.S",
+                "x86_64/e_sinh.S",
+                "x86_64/s_atan.S",
+                "x86_64/s_cbrt.S",
+                "x86_64/s_cos.S",
+                "x86_64/s_expm1.S",
+                "x86_64/s_log1p.S",
+                "x86_64/s_sin.S",
+                "x86_64/s_tanh.S",
+                "x86_64/s_tan.S",
+            ],
+            exclude_srcs: [
+                "upstream-freebsd/lib/msun/src/e_acos.c",
+                "upstream-freebsd/lib/msun/src/e_asin.c",
+                "upstream-freebsd/lib/msun/src/e_atan2.c",
+                "upstream-freebsd/lib/msun/src/e_cosh.c",
+                "upstream-freebsd/lib/msun/src/e_exp.c",
+                "upstream-freebsd/lib/msun/src/e_hypot.c",
+                "upstream-freebsd/lib/msun/src/e_log.c",
+                "upstream-freebsd/lib/msun/src/e_log10.c",
+                "upstream-freebsd/lib/msun/src/e_pow.c",
+                "upstream-freebsd/lib/msun/src/e_sinh.c",
+                "upstream-freebsd/lib/msun/src/e_sqrt.c",
+                "upstream-freebsd/lib/msun/src/e_sqrtf.c",
+                "upstream-freebsd/lib/msun/src/s_atan.c",
+                "upstream-freebsd/lib/msun/src/s_cbrt.c",
+                "upstream-freebsd/lib/msun/src/s_cos.c",
+                "upstream-freebsd/lib/msun/src/s_expm1.c",
+                "upstream-freebsd/lib/msun/src/s_log1p.c",
+                "upstream-freebsd/lib/msun/src/s_sin.c",
+                "upstream-freebsd/lib/msun/src/s_tan.c",
+                "upstream-freebsd/lib/msun/src/s_tanh.c",
+            ],
+            sse4_1: {
+                srcs: [
+                    "x86_64/ceil.S",
+                    "x86_64/ceilf.S",
+                    "x86_64/floor.S",
+                    "x86_64/floorf.S",
+                    "x86_64/trunc.S",
+                    "x86_64/truncf.S",
+                ],
+                exclude_srcs: [
+                    "upstream-freebsd/lib/msun/src/s_ceil.c",
+                    "upstream-freebsd/lib/msun/src/s_ceilf.c",
+                    "upstream-freebsd/lib/msun/src/s_floor.c",
+                    "upstream-freebsd/lib/msun/src/s_floorf.c",
+                    "upstream-freebsd/lib/msun/src/s_trunc.c",
+                    "upstream-freebsd/lib/msun/src/s_truncf.c",
+                ],
+            },
             // Clang has wrong long double sizes for x86.
             clang: false,
             version_script: "libm.x86_64.map",
diff --git a/libm/Android.mk b/libm/Android.mk
index bd51e7c..faf3c50 100644
--- a/libm/Android.mk
+++ b/libm/Android.mk
@@ -22,14 +22,19 @@
     upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c \
     upstream-freebsd/lib/msun/src/catrig.c \
     upstream-freebsd/lib/msun/src/catrigf.c \
+    upstream-freebsd/lib/msun/src/e_acos.c \
     upstream-freebsd/lib/msun/src/e_acosf.c \
     upstream-freebsd/lib/msun/src/e_acosh.c \
     upstream-freebsd/lib/msun/src/e_acoshf.c \
+    upstream-freebsd/lib/msun/src/e_asin.c \
     upstream-freebsd/lib/msun/src/e_asinf.c \
+    upstream-freebsd/lib/msun/src/e_atan2.c \
     upstream-freebsd/lib/msun/src/e_atan2f.c \
     upstream-freebsd/lib/msun/src/e_atanh.c \
     upstream-freebsd/lib/msun/src/e_atanhf.c \
+    upstream-freebsd/lib/msun/src/e_cosh.c \
     upstream-freebsd/lib/msun/src/e_coshf.c \
+    upstream-freebsd/lib/msun/src/e_exp.c \
     upstream-freebsd/lib/msun/src/e_expf.c \
     upstream-freebsd/lib/msun/src/e_fmod.c \
     upstream-freebsd/lib/msun/src/e_fmodf.c \
@@ -37,6 +42,7 @@
     upstream-freebsd/lib/msun/src/e_gammaf.c \
     upstream-freebsd/lib/msun/src/e_gammaf_r.c \
     upstream-freebsd/lib/msun/src/e_gamma_r.c \
+    upstream-freebsd/lib/msun/src/e_hypot.c \
     upstream-freebsd/lib/msun/src/e_hypotf.c \
     upstream-freebsd/lib/msun/src/e_j0.c \
     upstream-freebsd/lib/msun/src/e_j0f.c \
@@ -48,10 +54,13 @@
     upstream-freebsd/lib/msun/src/e_lgammaf.c \
     upstream-freebsd/lib/msun/src/e_lgammaf_r.c \
     upstream-freebsd/lib/msun/src/e_lgamma_r.c \
+    upstream-freebsd/lib/msun/src/e_log10.c \
     upstream-freebsd/lib/msun/src/e_log10f.c \
     upstream-freebsd/lib/msun/src/e_log2.c \
     upstream-freebsd/lib/msun/src/e_log2f.c \
+    upstream-freebsd/lib/msun/src/e_log.c \
     upstream-freebsd/lib/msun/src/e_logf.c \
+    upstream-freebsd/lib/msun/src/e_pow.c \
     upstream-freebsd/lib/msun/src/e_powf.c \
     upstream-freebsd/lib/msun/src/e_remainder.c \
     upstream-freebsd/lib/msun/src/e_remainderf.c \
@@ -59,7 +68,10 @@
     upstream-freebsd/lib/msun/src/e_rem_pio2f.c \
     upstream-freebsd/lib/msun/src/e_scalb.c \
     upstream-freebsd/lib/msun/src/e_scalbf.c \
+    upstream-freebsd/lib/msun/src/e_sinh.c \
     upstream-freebsd/lib/msun/src/e_sinhf.c \
+    upstream-freebsd/lib/msun/src/e_sqrt.c \
+    upstream-freebsd/lib/msun/src/e_sqrtf.c \
     upstream-freebsd/lib/msun/src/imprecise.c \
     upstream-freebsd/lib/msun/src/k_cos.c \
     upstream-freebsd/lib/msun/src/k_cosf.c \
@@ -72,13 +84,17 @@
     upstream-freebsd/lib/msun/src/k_tanf.c \
     upstream-freebsd/lib/msun/src/s_asinh.c \
     upstream-freebsd/lib/msun/src/s_asinhf.c \
+    upstream-freebsd/lib/msun/src/s_atan.c \
     upstream-freebsd/lib/msun/src/s_atanf.c \
     upstream-freebsd/lib/msun/src/s_carg.c \
     upstream-freebsd/lib/msun/src/s_cargf.c \
     upstream-freebsd/lib/msun/src/s_cargl.c \
+    upstream-freebsd/lib/msun/src/s_cbrt.c \
     upstream-freebsd/lib/msun/src/s_cbrtf.c \
     upstream-freebsd/lib/msun/src/s_ccosh.c \
     upstream-freebsd/lib/msun/src/s_ccoshf.c \
+    upstream-freebsd/lib/msun/src/s_ceil.c \
+    upstream-freebsd/lib/msun/src/s_ceilf.c \
     upstream-freebsd/lib/msun/src/s_cexp.c \
     upstream-freebsd/lib/msun/src/s_cexpf.c \
     upstream-freebsd/lib/msun/src/s_cimag.c \
@@ -89,6 +105,7 @@
     upstream-freebsd/lib/msun/src/s_conjl.c \
     upstream-freebsd/lib/msun/src/s_copysign.c \
     upstream-freebsd/lib/msun/src/s_copysignf.c \
+    upstream-freebsd/lib/msun/src/s_cos.c \
     upstream-freebsd/lib/msun/src/s_cosf.c \
     upstream-freebsd/lib/msun/src/s_cproj.c \
     upstream-freebsd/lib/msun/src/s_cprojf.c \
@@ -107,10 +124,15 @@
     upstream-freebsd/lib/msun/src/s_erff.c \
     upstream-freebsd/lib/msun/src/s_exp2.c \
     upstream-freebsd/lib/msun/src/s_exp2f.c \
+    upstream-freebsd/lib/msun/src/s_expm1.c \
     upstream-freebsd/lib/msun/src/s_expm1f.c \
     upstream-freebsd/lib/msun/src/s_fdim.c \
     upstream-freebsd/lib/msun/src/s_finite.c \
     upstream-freebsd/lib/msun/src/s_finitef.c \
+    upstream-freebsd/lib/msun/src/s_floor.c \
+    upstream-freebsd/lib/msun/src/s_floorf.c \
+    upstream-freebsd/lib/msun/src/s_fma.c \
+    upstream-freebsd/lib/msun/src/s_fmaf.c \
     upstream-freebsd/lib/msun/src/s_fmax.c \
     upstream-freebsd/lib/msun/src/s_fmaxf.c \
     upstream-freebsd/lib/msun/src/s_fmin.c \
@@ -119,11 +141,16 @@
     upstream-freebsd/lib/msun/src/s_frexpf.c \
     upstream-freebsd/lib/msun/src/s_ilogb.c \
     upstream-freebsd/lib/msun/src/s_ilogbf.c \
+    upstream-freebsd/lib/msun/src/s_llrint.c \
+    upstream-freebsd/lib/msun/src/s_llrintf.c \
     upstream-freebsd/lib/msun/src/s_llround.c \
     upstream-freebsd/lib/msun/src/s_llroundf.c \
+    upstream-freebsd/lib/msun/src/s_log1p.c \
     upstream-freebsd/lib/msun/src/s_log1pf.c \
     upstream-freebsd/lib/msun/src/s_logb.c \
     upstream-freebsd/lib/msun/src/s_logbf.c \
+    upstream-freebsd/lib/msun/src/s_lrint.c \
+    upstream-freebsd/lib/msun/src/s_lrintf.c \
     upstream-freebsd/lib/msun/src/s_lround.c \
     upstream-freebsd/lib/msun/src/s_lroundf.c \
     upstream-freebsd/lib/msun/src/s_modf.c \
@@ -134,6 +161,8 @@
     upstream-freebsd/lib/msun/src/s_nextafterf.c \
     upstream-freebsd/lib/msun/src/s_remquo.c \
     upstream-freebsd/lib/msun/src/s_remquof.c \
+    upstream-freebsd/lib/msun/src/s_rint.c \
+    upstream-freebsd/lib/msun/src/s_rintf.c \
     upstream-freebsd/lib/msun/src/s_round.c \
     upstream-freebsd/lib/msun/src/s_roundf.c \
     upstream-freebsd/lib/msun/src/s_scalbln.c \
@@ -142,10 +171,15 @@
     upstream-freebsd/lib/msun/src/s_signgam.c \
     upstream-freebsd/lib/msun/src/s_significand.c \
     upstream-freebsd/lib/msun/src/s_significandf.c \
+    upstream-freebsd/lib/msun/src/s_sin.c \
     upstream-freebsd/lib/msun/src/s_sinf.c \
+    upstream-freebsd/lib/msun/src/s_tan.c \
     upstream-freebsd/lib/msun/src/s_tanf.c \
+    upstream-freebsd/lib/msun/src/s_tanh.c \
     upstream-freebsd/lib/msun/src/s_tanhf.c \
     upstream-freebsd/lib/msun/src/s_tgammaf.c \
+    upstream-freebsd/lib/msun/src/s_trunc.c \
+    upstream-freebsd/lib/msun/src/s_truncf.c \
     upstream-freebsd/lib/msun/src/w_cabs.c \
     upstream-freebsd/lib/msun/src/w_cabsf.c \
     upstream-freebsd/lib/msun/src/w_cabsl.c \
@@ -236,37 +270,6 @@
 # -----------------------------------------------------------------------------
 LOCAL_SRC_FILES_arm += \
     arm/fenv.c \
-    upstream-freebsd/lib/msun/src/e_acos.c \
-    upstream-freebsd/lib/msun/src/e_asin.c \
-    upstream-freebsd/lib/msun/src/e_atan2.c \
-    upstream-freebsd/lib/msun/src/e_cosh.c \
-    upstream-freebsd/lib/msun/src/e_exp.c \
-    upstream-freebsd/lib/msun/src/e_hypot.c \
-    upstream-freebsd/lib/msun/src/e_log.c \
-    upstream-freebsd/lib/msun/src/e_log10.c \
-    upstream-freebsd/lib/msun/src/e_pow.c \
-    upstream-freebsd/lib/msun/src/e_sinh.c \
-    upstream-freebsd/lib/msun/src/s_atan.c \
-    upstream-freebsd/lib/msun/src/s_cbrt.c \
-    upstream-freebsd/lib/msun/src/s_ceil.c \
-    upstream-freebsd/lib/msun/src/s_ceilf.c \
-    upstream-freebsd/lib/msun/src/s_cos.c \
-    upstream-freebsd/lib/msun/src/s_fma.c \
-    upstream-freebsd/lib/msun/src/s_fmaf.c \
-    upstream-freebsd/lib/msun/src/s_floorf.c \
-    upstream-freebsd/lib/msun/src/s_expm1.c \
-    upstream-freebsd/lib/msun/src/s_llrint.c \
-    upstream-freebsd/lib/msun/src/s_llrintf.c \
-    upstream-freebsd/lib/msun/src/s_log1p.c \
-    upstream-freebsd/lib/msun/src/s_lrint.c \
-    upstream-freebsd/lib/msun/src/s_lrintf.c \
-    upstream-freebsd/lib/msun/src/s_rint.c \
-    upstream-freebsd/lib/msun/src/s_rintf.c \
-    upstream-freebsd/lib/msun/src/s_sin.c \
-    upstream-freebsd/lib/msun/src/s_tan.c \
-    upstream-freebsd/lib/msun/src/s_tanh.c \
-    upstream-freebsd/lib/msun/src/s_trunc.c \
-    upstream-freebsd/lib/msun/src/s_truncf.c \
 
 # s_floor.S requires neon instructions.
 ifdef TARGET_2ND_ARCH
@@ -276,17 +279,16 @@
 endif
 
 # Use the C version on armv7-a since it doesn't support neon instructions.
-ifeq ($(arch_variant),armv7-a)
-LOCAL_SRC_FILES_arm += \
-    upstream-freebsd/lib/msun/src/e_sqrt.c \
-    upstream-freebsd/lib/msun/src/e_sqrtf.c \
-    upstream-freebsd/lib/msun/src/s_floor.c \
-
-else
+ifneq ($(arch_variant),armv7-a)
 LOCAL_SRC_FILES_arm += \
     arm/sqrt.S \
     arm/floor.S \
 
+LOCAL_SRC_FILES_EXCLUDE_arm += \
+    upstream-freebsd/lib/msun/src/e_sqrt.c \
+    upstream-freebsd/lib/msun/src/e_sqrtf.c \
+    upstream-freebsd/lib/msun/src/s_floor.c \
+
 endif
 
 # -----------------------------------------------------------------------------
@@ -301,64 +303,30 @@
     arm64/rint.S \
     arm64/sqrt.S \
     arm64/trunc.S \
-    upstream-freebsd/lib/msun/src/e_acos.c \
-    upstream-freebsd/lib/msun/src/e_asin.c \
-    upstream-freebsd/lib/msun/src/e_atan2.c \
-    upstream-freebsd/lib/msun/src/e_cosh.c \
-    upstream-freebsd/lib/msun/src/e_exp.c \
-    upstream-freebsd/lib/msun/src/e_hypot.c \
-    upstream-freebsd/lib/msun/src/e_log.c \
-    upstream-freebsd/lib/msun/src/e_log10.c \
-    upstream-freebsd/lib/msun/src/e_pow.c \
-    upstream-freebsd/lib/msun/src/e_sinh.c \
-    upstream-freebsd/lib/msun/src/s_atan.c \
-    upstream-freebsd/lib/msun/src/s_cbrt.c \
-    upstream-freebsd/lib/msun/src/s_cos.c \
-    upstream-freebsd/lib/msun/src/s_expm1.c \
-    upstream-freebsd/lib/msun/src/s_log1p.c \
-    upstream-freebsd/lib/msun/src/s_sin.c \
-    upstream-freebsd/lib/msun/src/s_tan.c \
-    upstream-freebsd/lib/msun/src/s_tanh.c \
+
+LOCAL_SRC_FILES_EXCLUDE_arm64 += \
+    upstream-freebsd/lib/msun/src/e_sqrt.c \
+    upstream-freebsd/lib/msun/src/e_sqrtf.c \
+    upstream-freebsd/lib/msun/src/s_ceil.c \
+    upstream-freebsd/lib/msun/src/s_ceilf.c \
+    upstream-freebsd/lib/msun/src/s_fma.c \
+    upstream-freebsd/lib/msun/src/s_fmaf.c \
+    upstream-freebsd/lib/msun/src/s_floor.c \
+    upstream-freebsd/lib/msun/src/s_floorf.c \
+    upstream-freebsd/lib/msun/src/s_llrint.c \
+    upstream-freebsd/lib/msun/src/s_llrintf.c \
+    upstream-freebsd/lib/msun/src/s_lrint.c \
+    upstream-freebsd/lib/msun/src/s_lrintf.c \
+    upstream-freebsd/lib/msun/src/s_rint.c \
+    upstream-freebsd/lib/msun/src/s_rintf.c \
+    upstream-freebsd/lib/msun/src/s_trunc.c \
+    upstream-freebsd/lib/msun/src/s_truncf.c \
 
 # -----------------------------------------------------------------------------
 # mips
 # -----------------------------------------------------------------------------
 libm_mips_arch_files := \
     mips/fenv.c \
-    upstream-freebsd/lib/msun/src/e_acos.c \
-    upstream-freebsd/lib/msun/src/e_asin.c \
-    upstream-freebsd/lib/msun/src/e_atan2.c \
-    upstream-freebsd/lib/msun/src/e_cosh.c \
-    upstream-freebsd/lib/msun/src/e_exp.c \
-    upstream-freebsd/lib/msun/src/e_hypot.c \
-    upstream-freebsd/lib/msun/src/e_log.c \
-    upstream-freebsd/lib/msun/src/e_log10.c \
-    upstream-freebsd/lib/msun/src/e_pow.c \
-    upstream-freebsd/lib/msun/src/e_sinh.c \
-    upstream-freebsd/lib/msun/src/e_sqrt.c \
-    upstream-freebsd/lib/msun/src/e_sqrtf.c \
-    upstream-freebsd/lib/msun/src/s_atan.c \
-    upstream-freebsd/lib/msun/src/s_cbrt.c \
-    upstream-freebsd/lib/msun/src/s_ceil.c \
-    upstream-freebsd/lib/msun/src/s_ceilf.c \
-    upstream-freebsd/lib/msun/src/s_cos.c \
-    upstream-freebsd/lib/msun/src/s_fma.c \
-    upstream-freebsd/lib/msun/src/s_fmaf.c \
-    upstream-freebsd/lib/msun/src/s_floor.c \
-    upstream-freebsd/lib/msun/src/s_floorf.c \
-    upstream-freebsd/lib/msun/src/s_expm1.c \
-    upstream-freebsd/lib/msun/src/s_llrint.c \
-    upstream-freebsd/lib/msun/src/s_llrintf.c \
-    upstream-freebsd/lib/msun/src/s_log1p.c \
-    upstream-freebsd/lib/msun/src/s_lrint.c \
-    upstream-freebsd/lib/msun/src/s_lrintf.c \
-    upstream-freebsd/lib/msun/src/s_rint.c \
-    upstream-freebsd/lib/msun/src/s_rintf.c \
-    upstream-freebsd/lib/msun/src/s_sin.c \
-    upstream-freebsd/lib/msun/src/s_tan.c \
-    upstream-freebsd/lib/msun/src/s_tanh.c \
-    upstream-freebsd/lib/msun/src/s_trunc.c \
-    upstream-freebsd/lib/msun/src/s_truncf.c \
 
 LOCAL_SRC_FILES_mips += $(libm_mips_arch_files)
 LOCAL_SRC_FILES_mips64 += $(libm_mips_arch_files)
@@ -368,14 +336,6 @@
 # -----------------------------------------------------------------------------
 LOCAL_SRC_FILES_x86 += \
     i387/fenv.c \
-    upstream-freebsd/lib/msun/src/s_fma.c \
-    upstream-freebsd/lib/msun/src/s_fmaf.c \
-    upstream-freebsd/lib/msun/src/s_llrint.c \
-    upstream-freebsd/lib/msun/src/s_llrintf.c \
-    upstream-freebsd/lib/msun/src/s_lrint.c \
-    upstream-freebsd/lib/msun/src/s_lrintf.c \
-    upstream-freebsd/lib/msun/src/s_rint.c \
-    upstream-freebsd/lib/msun/src/s_rintf.c \
     x86/sqrt.S \
     x86/sqrtf.S \
     x86/e_acos.S \
@@ -400,6 +360,28 @@
     x86/s_tanh.S \
     x86/s_tan.S \
 
+LOCAL_SRC_FILES_EXCLUDE_x86 += \
+    upstream-freebsd/lib/msun/src/e_acos.c \
+    upstream-freebsd/lib/msun/src/e_asin.c \
+    upstream-freebsd/lib/msun/src/e_atan2.c \
+    upstream-freebsd/lib/msun/src/e_cosh.c \
+    upstream-freebsd/lib/msun/src/e_exp.c \
+    upstream-freebsd/lib/msun/src/e_hypot.c \
+    upstream-freebsd/lib/msun/src/e_log.c \
+    upstream-freebsd/lib/msun/src/e_log10.c \
+    upstream-freebsd/lib/msun/src/e_pow.c \
+    upstream-freebsd/lib/msun/src/e_sinh.c \
+    upstream-freebsd/lib/msun/src/e_sqrt.c \
+    upstream-freebsd/lib/msun/src/e_sqrtf.c \
+    upstream-freebsd/lib/msun/src/s_atan.c \
+    upstream-freebsd/lib/msun/src/s_cbrt.c \
+    upstream-freebsd/lib/msun/src/s_cos.c \
+    upstream-freebsd/lib/msun/src/s_expm1.c \
+    upstream-freebsd/lib/msun/src/s_log1p.c \
+    upstream-freebsd/lib/msun/src/s_sin.c \
+    upstream-freebsd/lib/msun/src/s_tan.c \
+    upstream-freebsd/lib/msun/src/s_tanh.c \
+
 ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
 LOCAL_SRC_FILES_x86 += \
     x86/ceil.S \
@@ -409,8 +391,7 @@
     x86/trunc.S \
     x86/truncf.S \
 
-else
-LOCAL_SRC_FILES_x86 += \
+LOCAL_SRC_FILES_EXCLUDE_x86 += \
     upstream-freebsd/lib/msun/src/s_ceil.c \
     upstream-freebsd/lib/msun/src/s_ceilf.c \
     upstream-freebsd/lib/msun/src/s_floor.c \
@@ -425,14 +406,6 @@
 # -----------------------------------------------------------------------------
 LOCAL_SRC_FILES_x86_64 += \
     amd64/fenv.c \
-    upstream-freebsd/lib/msun/src/s_fma.c \
-    upstream-freebsd/lib/msun/src/s_fmaf.c \
-    upstream-freebsd/lib/msun/src/s_llrint.c \
-    upstream-freebsd/lib/msun/src/s_llrintf.c \
-    upstream-freebsd/lib/msun/src/s_lrint.c \
-    upstream-freebsd/lib/msun/src/s_lrintf.c \
-    upstream-freebsd/lib/msun/src/s_rint.c \
-    upstream-freebsd/lib/msun/src/s_rintf.c \
     x86_64/sqrt.S \
     x86_64/sqrtf.S \
     x86_64/e_acos.S \
@@ -454,6 +427,28 @@
     x86_64/s_tanh.S \
     x86_64/s_tan.S \
 
+LOCAL_SRC_FILES_EXCLUDE_x86_64 += \
+    upstream-freebsd/lib/msun/src/e_acos.c \
+    upstream-freebsd/lib/msun/src/e_asin.c \
+    upstream-freebsd/lib/msun/src/e_atan2.c \
+    upstream-freebsd/lib/msun/src/e_cosh.c \
+    upstream-freebsd/lib/msun/src/e_exp.c \
+    upstream-freebsd/lib/msun/src/e_hypot.c \
+    upstream-freebsd/lib/msun/src/e_log.c \
+    upstream-freebsd/lib/msun/src/e_log10.c \
+    upstream-freebsd/lib/msun/src/e_pow.c \
+    upstream-freebsd/lib/msun/src/e_sinh.c \
+    upstream-freebsd/lib/msun/src/e_sqrt.c \
+    upstream-freebsd/lib/msun/src/e_sqrtf.c \
+    upstream-freebsd/lib/msun/src/s_atan.c \
+    upstream-freebsd/lib/msun/src/s_cbrt.c \
+    upstream-freebsd/lib/msun/src/s_cos.c \
+    upstream-freebsd/lib/msun/src/s_expm1.c \
+    upstream-freebsd/lib/msun/src/s_log1p.c \
+    upstream-freebsd/lib/msun/src/s_sin.c \
+    upstream-freebsd/lib/msun/src/s_tan.c \
+    upstream-freebsd/lib/msun/src/s_tanh.c \
+
 ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
 LOCAL_SRC_FILES_x86_64 += \
     x86_64/ceil.S \
@@ -463,8 +458,7 @@
     x86_64/trunc.S \
     x86_64/truncf.S \
 
-else
-LOCAL_SRC_FILES_x86_64 += \
+LOCAL_SRC_FILES_EXCLUDE_x86_64 += \
     upstream-freebsd/lib/msun/src/s_ceil.c \
     upstream-freebsd/lib/msun/src/s_ceilf.c \
     upstream-freebsd/lib/msun/src/s_floor.c \
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index d07ec86..ba54d39 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -16,12 +16,10 @@
 
 #include "linker.h"
 
-#include <dlfcn.h>
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <android/dlext.h>
 #include <android/api-level.h>
 
 #include <bionic/pthread_internal.h>
@@ -70,8 +68,7 @@
 static void* dlopen_ext(const char* filename, int flags,
                         const android_dlextinfo* extinfo, void* caller_addr) {
   ScopedPthreadMutexLocker locker(&g_dl_mutex);
-  soinfo* caller = find_containing_library(caller_addr);
-  soinfo* result = do_dlopen(filename, flags, extinfo, caller);
+  soinfo* result = do_dlopen(filename, flags, extinfo, caller_addr);
   if (result == nullptr) {
     __bionic_format_dlerror("dlopen failed", linker_get_error_buffer());
     return nullptr;
@@ -91,72 +88,30 @@
 
 extern android_namespace_t* g_anonymous_namespace;
 
-void* dlsym(void* handle, const char* symbol) {
+void* dlsym_impl(void* handle, const char* symbol, const char* version, void* caller_addr) {
   ScopedPthreadMutexLocker locker(&g_dl_mutex);
-
-  // TODO(dimitry): move (most of) the code below to linker.cpp
-#if !defined(__LP64__)
-  if (handle == nullptr) {
-    __bionic_format_dlerror("dlsym library handle is null", nullptr);
-    return nullptr;
-  }
-#endif
-
-  if (symbol == nullptr) {
-    __bionic_format_dlerror("dlsym symbol name is null", nullptr);
+  void* result;
+  if (!do_dlsym(handle, symbol, version, caller_addr, &result)) {
+    __bionic_format_dlerror(linker_get_error_buffer(), nullptr);
     return nullptr;
   }
 
-  soinfo* found = nullptr;
-  const ElfW(Sym)* sym = nullptr;
+  return result;
+}
+
+void* dlsym(void* handle, const char* symbol) {
   void* caller_addr = __builtin_return_address(0);
-  soinfo* caller = find_containing_library(caller_addr);
-  android_namespace_t* ns = caller != nullptr ? caller->get_namespace() : g_anonymous_namespace;
+  return dlsym_impl(handle, symbol, nullptr, caller_addr);
+}
 
-  if (handle == RTLD_DEFAULT || handle == RTLD_NEXT) {
-    sym = dlsym_linear_lookup(ns, symbol, &found, caller, handle);
-  } else {
-    sym = dlsym_handle_lookup(reinterpret_cast<soinfo*>(handle), &found, symbol);
-  }
-
-  if (sym != nullptr) {
-    unsigned bind = ELF_ST_BIND(sym->st_info);
-
-    if ((bind == STB_GLOBAL || bind == STB_WEAK) && sym->st_shndx != 0) {
-      return reinterpret_cast<void*>(found->resolve_symbol_address(sym));
-    }
-
-    __bionic_format_dlerror("symbol found but not global", symbol);
-    return nullptr;
-  } else {
-    __bionic_format_dlerror("undefined symbol", symbol);
-    return nullptr;
-  }
+void* dlvsym(void* handle, const char* symbol, const char* version) {
+  void* caller_addr = __builtin_return_address(0);
+  return dlsym_impl(handle, symbol, version, caller_addr);
 }
 
 int dladdr(const void* addr, Dl_info* info) {
   ScopedPthreadMutexLocker locker(&g_dl_mutex);
-
-  // Determine if this address can be found in any library currently mapped.
-  soinfo* si = find_containing_library(addr);
-  if (si == nullptr) {
-    return 0;
-  }
-
-  memset(info, 0, sizeof(Dl_info));
-
-  info->dli_fname = si->get_realpath();
-  // Address at which the shared object is loaded.
-  info->dli_fbase = reinterpret_cast<void*>(si->base);
-
-  // Determine if any symbol in the library contains the specified address.
-  ElfW(Sym)* sym = si->find_symbol_by_address(addr);
-  if (sym != nullptr) {
-    info->dli_sname = si->get_string(sym->st_name);
-    info->dli_saddr = reinterpret_cast<void*>(si->resolve_symbol_address(sym));
-  }
-
-  return 1;
+  return do_dladdr(addr, info);
 }
 
 int dlclose(void* handle) {
@@ -193,11 +148,12 @@
 }
 
 android_namespace_t* android_create_namespace(const char* name, const char* ld_library_path,
-                                              const char* default_library_path, bool is_isolated) {
+                                              const char* default_library_path, bool is_isolated,
+                                              const char* permitted_when_isolated_path) {
   ScopedPthreadMutexLocker locker(&g_dl_mutex);
 
-  android_namespace_t* result = create_namespace(name, ld_library_path,
-                                                 default_library_path, is_isolated);
+  android_namespace_t* result = create_namespace(name, ld_library_path, default_library_path,
+                                                 is_isolated, permitted_when_isolated_path);
 
   if (result == nullptr) {
     __bionic_format_dlerror("android_create_namespace failed", linker_get_error_buffer());
@@ -232,11 +188,11 @@
   // 00000000001 1111111112222222222 3333333333444444444455555555556666666666777 777777788888888889999999999
   // 01234567890 1234567890123456789 0123456789012345678901234567890123456789012 345678901234567890123456789
     "erate_phdr\0android_dlopen_ext\0android_set_application_target_sdk_version\0android_get_application_tar"
-  // 0000000000111111 111122222222223333333333 4444444444555555555566666
-  // 0123456789012345 678901234567890123456789 0123456789012345678901234
-    "get_sdk_version\0android_init_namespaces\0android_create_namespace\0"
+  // 0000000000111111 111122222222223333333333 4444444444555555555566666 6666677
+  // 0123456789012345 678901234567890123456789 0123456789012345678901234 5678901
+    "get_sdk_version\0android_init_namespaces\0android_create_namespace\0dlvsym\0"
 #if defined(__arm__)
-  // 265
+  // 272
     "dl_unwind_find_exidx\0"
 #endif
     ;
@@ -260,8 +216,9 @@
   ELFW(SYM_INITIALIZER)(173, &android_get_application_target_sdk_version, 1),
   ELFW(SYM_INITIALIZER)(216, &android_init_namespaces, 1),
   ELFW(SYM_INITIALIZER)(240, &android_create_namespace, 1),
+  ELFW(SYM_INITIALIZER)(265, &dlvsym, 1),
 #if defined(__arm__)
-  ELFW(SYM_INITIALIZER)(265, &dl_unwind_find_exidx, 1),
+  ELFW(SYM_INITIALIZER)(272, &dl_unwind_find_exidx, 1),
 #endif
 };
 
@@ -278,9 +235,9 @@
 // Note that adding any new symbols here requires stubbing them out in libdl.
 static unsigned g_libdl_buckets[1] = { 1 };
 #if defined(__arm__)
-static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0 };
+static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 };
 #else
-static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0 };
+static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0 };
 #endif
 
 static uint8_t __libdl_info_buf[sizeof(soinfo)] __attribute__((aligned(8)));
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 82d0d9e..e38e252 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -27,7 +27,6 @@
  */
 
 #include <android/api-level.h>
-#include <dlfcn.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <inttypes.h>
@@ -37,7 +36,6 @@
 #include <string.h>
 #include <sys/mman.h>
 #include <sys/param.h>
-#include <sys/prctl.h>
 #include <unistd.h>
 
 #include <new>
@@ -94,6 +92,10 @@
     default_library_paths_ = library_paths;
   }
 
+  void set_permitted_paths(std::vector<std::string>&& permitted_paths) {
+    permitted_paths_ = permitted_paths;
+  }
+
   soinfo::soinfo_list_t& soinfo_list() { return soinfo_list_; }
 
   // For isolated namespaces - checks if the file is on the search path;
@@ -105,6 +107,7 @@
   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);
@@ -126,11 +129,9 @@
 
 static const char* const kDefaultLdPaths[] = {
 #if defined(__LP64__)
-  "/odm/lib64",
   "/vendor/lib64",
   "/system/lib64",
 #else
-  "/odm/lib",
   "/vendor/lib",
   "/system/lib",
 #endif
@@ -139,15 +140,11 @@
 
 static const char* const kAsanDefaultLdPaths[] = {
 #if defined(__LP64__)
-  "/data/odm/lib64",
-  "/odm/lib64",
   "/data/vendor/lib64",
   "/vendor/lib64",
   "/data/lib64",
   "/system/lib64",
 #else
-  "/data/odm/lib",
-  "/odm/lib",
   "/data/vendor/lib",
   "/vendor/lib",
   "/data/lib",
@@ -316,6 +313,12 @@
     }
   }
 
+  for (const auto& dir : permitted_paths_) {
+    if (file_is_under_dir(file, dir)) {
+      return true;
+    }
+  }
+
   return false;
 }
 
@@ -544,13 +547,6 @@
 static bool realpath_fd(int fd, std::string* realpath) {
   std::vector<char> buf(PATH_MAX), proc_self_fd(PATH_MAX);
   __libc_format_buffer(&proc_self_fd[0], proc_self_fd.size(), "/proc/self/fd/%d", fd);
-  // set DUMPABLE to 1 to access /proc/self/fd
-  int dumpable = prctl(PR_GET_DUMPABLE, 0, 0, 0, 0);
-  prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
-  auto guard = make_scope_guard([&]() {
-    // restore dumpable
-    prctl(PR_SET_DUMPABLE, dumpable, 0, 0, 0);
-  });
   if (readlink(&proc_self_fd[0], &buf[0], buf.size()) == -1) {
     PRINT("readlink('%s') failed: %s [fd=%d]", &proc_self_fd[0], strerror(errno), fd);
     return false;
@@ -888,20 +884,23 @@
   this->namespace_ = ns;
 }
 
+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_) {
-    const uint8_t* name = reinterpret_cast<const uint8_t*>(name_);
-    uint32_t h = 0, g;
-
-    while (*name) {
-      h = (h << 4) + *name++;
-      g = h & 0xf0000000;
-      h ^= g;
-      h ^= g >> 24;
-    }
-
-    elf_hash_ = h;
+    elf_hash_ = calculate_elf_hash(name_);
     has_elf_hash_ = true;
   }
 
@@ -1240,7 +1239,8 @@
 
 
 static const ElfW(Sym)* dlsym_handle_lookup(soinfo* root, soinfo* skip_until,
-                                            soinfo** found, SymbolName& symbol_name) {
+                                            soinfo** found, SymbolName& symbol_name,
+                                            const version_info* vi) {
   const ElfW(Sym)* result = nullptr;
   bool skip_lookup = skip_until != nullptr;
 
@@ -1250,7 +1250,7 @@
       return true;
     }
 
-    if (!current_soinfo->find_symbol_by_name(symbol_name, nullptr, &result)) {
+    if (!current_soinfo->find_symbol_by_name(symbol_name, vi, &result)) {
       result = nullptr;
       return false;
     }
@@ -1266,9 +1266,17 @@
   return result;
 }
 
+static const ElfW(Sym)* dlsym_linear_lookup(android_namespace_t* ns,
+                                            const char* name,
+                                            const version_info* vi,
+                                            soinfo** found,
+                                            soinfo* caller,
+                                            void* handle);
+
 // This is used by dlsym(3).  It performs symbol lookup only within the
 // specified soinfo object and its dependencies in breadth first order.
-const ElfW(Sym)* dlsym_handle_lookup(soinfo* si, soinfo** found, const char* name) {
+static const ElfW(Sym)* dlsym_handle_lookup(soinfo* si, soinfo** found,
+                                            const char* name, const version_info* vi) {
   // According to man dlopen(3) and posix docs in the case when si is handle
   // of the main executable we need to search not only in the executable and its
   // dependencies but also in all libraries loaded with RTLD_GLOBAL.
@@ -1277,11 +1285,11 @@
   // libraries and they are loaded in breath-first (correct) order we can just execute
   // dlsym(RTLD_DEFAULT, ...); instead of doing two stage lookup.
   if (si == somain) {
-    return dlsym_linear_lookup(&g_default_namespace, name, found, nullptr, RTLD_DEFAULT);
+    return dlsym_linear_lookup(&g_default_namespace, name, vi, found, nullptr, RTLD_DEFAULT);
   }
 
   SymbolName symbol_name(name);
-  return dlsym_handle_lookup(si, nullptr, found, symbol_name);
+  return dlsym_handle_lookup(si, nullptr, found, symbol_name, vi);
 }
 
 /* This is used by dlsym(3) to performs a global symbol lookup. If the
@@ -1289,11 +1297,12 @@
    beginning of the global solist. Otherwise the search starts at the
    specified soinfo (for RTLD_NEXT).
  */
-const ElfW(Sym)* dlsym_linear_lookup(android_namespace_t* ns,
-                                     const char* name,
-                                     soinfo** found,
-                                     soinfo* caller,
-                                     void* handle) {
+static const ElfW(Sym)* dlsym_linear_lookup(android_namespace_t* ns,
+                                            const char* name,
+                                            const version_info* vi,
+                                            soinfo** found,
+                                            soinfo* caller,
+                                            void* handle) {
   SymbolName symbol_name(name);
 
   soinfo::soinfo_list_t& soinfo_list = ns->soinfo_list();
@@ -1319,7 +1328,7 @@
       continue;
     }
 
-    if (!si->find_symbol_by_name(symbol_name, nullptr, &s)) {
+    if (!si->find_symbol_by_name(symbol_name, vi, &s)) {
       return nullptr;
     }
 
@@ -1335,7 +1344,7 @@
   if (s == nullptr && caller != nullptr &&
       (caller->get_rtld_flags() & RTLD_GLOBAL) == 0) {
     return dlsym_handle_lookup(caller->get_local_group_root(),
-        (handle == RTLD_NEXT) ? caller : nullptr, found, symbol_name);
+        (handle == RTLD_NEXT) ? caller : nullptr, found, symbol_name, vi);
   }
 
   if (s != nullptr) {
@@ -2173,6 +2182,14 @@
   }
 }
 
+static std::string symbol_display_name(const char* sym_name, const char* sym_ver) {
+  if (sym_ver == nullptr) {
+    return sym_name;
+  }
+
+  return std::string(sym_name) + ", version " + sym_ver;
+}
+
 void do_android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size) {
   // Use basic string manipulation calls to avoid snprintf.
   // snprintf indirectly calls pthread_getspecific to get the size of a buffer.
@@ -2200,7 +2217,10 @@
   parse_LD_LIBRARY_PATH(ld_library_path);
 }
 
-soinfo* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo, soinfo *caller) {
+soinfo* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo,
+                  void* caller_addr) {
+  soinfo* const caller = find_containing_library(caller_addr);
+
   if ((flags & ~(RTLD_NOW|RTLD_LAZY|RTLD_LOCAL|RTLD_GLOBAL|RTLD_NODELETE|RTLD_NOLOAD)) != 0) {
     DL_ERR("invalid flags to dlopen: %x", flags);
     return nullptr;
@@ -2246,6 +2266,79 @@
   return si;
 }
 
+int do_dladdr(const void* addr, Dl_info* info) {
+  // Determine if this address can be found in any library currently mapped.
+  soinfo* si = find_containing_library(addr);
+  if (si == nullptr) {
+    return 0;
+  }
+
+  memset(info, 0, sizeof(Dl_info));
+
+  info->dli_fname = si->get_realpath();
+  // Address at which the shared object is loaded.
+  info->dli_fbase = reinterpret_cast<void*>(si->base);
+
+  // Determine if any symbol in the library contains the specified address.
+  ElfW(Sym)* sym = si->find_symbol_by_address(addr);
+  if (sym != nullptr) {
+    info->dli_sname = si->get_string(sym->st_name);
+    info->dli_saddr = reinterpret_cast<void*>(si->resolve_symbol_address(sym));
+  }
+
+  return 1;
+}
+
+bool do_dlsym(void* handle, const char* sym_name, const char* sym_ver,
+              void* caller_addr, void** symbol) {
+#if !defined(__LP64__)
+  if (handle == nullptr) {
+    DL_ERR("dlsym failed: library handle is null");
+    return false;
+  }
+#endif
+
+  if (sym_name == nullptr) {
+    DL_ERR("dlsym failed: symbol name is null");
+    return false;
+  }
+
+  soinfo* found = nullptr;
+  const ElfW(Sym)* sym = nullptr;
+  soinfo* caller = find_containing_library(caller_addr);
+  android_namespace_t* ns = caller != nullptr ? caller->get_namespace() : g_anonymous_namespace;
+
+  version_info vi_instance;
+  version_info* vi = nullptr;
+
+  if (sym_ver != nullptr) {
+    vi_instance.name = sym_ver;
+    vi_instance.elf_hash = calculate_elf_hash(sym_ver);
+    vi = &vi_instance;
+  }
+
+  if (handle == RTLD_DEFAULT || handle == RTLD_NEXT) {
+    sym = dlsym_linear_lookup(ns, sym_name, vi, &found, caller, handle);
+  } else {
+    sym = dlsym_handle_lookup(reinterpret_cast<soinfo*>(handle), &found, sym_name, vi);
+  }
+
+  if (sym != nullptr) {
+    uint32_t bind = ELF_ST_BIND(sym->st_info);
+
+    if ((bind == STB_GLOBAL || bind == STB_WEAK) && sym->st_shndx != 0) {
+      *symbol = reinterpret_cast<void*>(found->resolve_symbol_address(sym));
+      return true;
+    }
+
+    DL_ERR("symbol \"%s\" found but not global", symbol_display_name(sym_name, sym_ver).c_str());
+    return false;
+  }
+
+  DL_ERR("undefined symbol: %s", symbol_display_name(sym_name, sym_ver).c_str());
+  return false;
+}
+
 void do_dlclose(soinfo* si) {
   ProtectedDataGuard guard;
   soinfo_unload(si);
@@ -2285,7 +2378,7 @@
 
   // create anonymous namespace
   android_namespace_t* anon_ns =
-      create_namespace("(anonymous)", nullptr, anon_ns_library_path, false);
+      create_namespace("(anonymous)", nullptr, anon_ns_library_path, false, nullptr);
 
   if (anon_ns == nullptr) {
     g_public_namespace_initialized = false;
@@ -2299,7 +2392,8 @@
 android_namespace_t* create_namespace(const char* name,
                                       const char* ld_library_path,
                                       const char* default_library_path,
-                                      bool is_isolated) {
+                                      bool is_isolated,
+                                      const char* permitted_when_isolated_path) {
   if (!g_public_namespace_initialized) {
     DL_ERR("cannot create namespace: public namespace is not initialized.");
     return nullptr;
@@ -2308,15 +2402,18 @@
   ProtectedDataGuard guard;
   std::vector<std::string> ld_library_paths;
   std::vector<std::string> default_library_paths;
+  std::vector<std::string> permitted_paths;
 
   parse_path(ld_library_path, ":", &ld_library_paths);
   parse_path(default_library_path, ":", &default_library_paths);
+  parse_path(permitted_when_isolated_path, ":", &permitted_paths);
 
   android_namespace_t* ns = new (g_namespace_allocator.alloc()) android_namespace_t();
   ns->set_name(name);
   ns->set_isolated(is_isolated);
   ns->set_ld_library_paths(std::move(ld_library_paths));
   ns->set_default_library_paths(std::move(default_library_paths));
+  ns->set_permitted_paths(std::move(permitted_paths));
 
   // TODO(dimtiry): Should this be global group of caller's namespace?
   auto global_group = make_global_group(&g_default_namespace);
diff --git a/linker/linker.h b/linker/linker.h
index b391fc3..5ec259e 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -29,6 +29,7 @@
 #ifndef _LINKER_H_
 #define _LINKER_H_
 
+#include <dlfcn.h>
 #include <android/dlext.h>
 #include <elf.h>
 #include <inttypes.h>
@@ -135,7 +136,7 @@
 };
 
 struct version_info {
-  version_info() : elf_hash(0), name(nullptr), target_si(nullptr) {}
+  constexpr version_info() : elf_hash(0), name(nullptr), target_si(nullptr) {}
 
   uint32_t elf_hash;
   const char* name;
@@ -422,17 +423,15 @@
 
 void do_android_get_LD_LIBRARY_PATH(char*, size_t);
 void do_android_update_LD_LIBRARY_PATH(const char* ld_library_path);
-soinfo* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo, soinfo *caller);
+soinfo* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo, void* caller_addr);
 void do_dlclose(soinfo* si);
 
 int do_dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data), void* data);
 
-const ElfW(Sym)* dlsym_linear_lookup(android_namespace_t* ns, const char* name, soinfo** found,
-                                     soinfo* caller, void* handle);
+bool do_dlsym(void* handle, const char* sym_name, const char* sym_ver,
+              void* caller_addr, void** symbol);
 
-soinfo* find_containing_library(const void* addr);
-
-const ElfW(Sym)* dlsym_handle_lookup(soinfo* si, soinfo** found, const char* name);
+int do_dladdr(const void* addr, Dl_info* info);
 
 void debuggerd_init();
 extern "C" abort_msg_t* g_abort_message;
@@ -446,6 +445,7 @@
 
 bool init_namespaces(const char* public_ns_sonames, const char* anon_ns_library_path);
 android_namespace_t* create_namespace(const char* name, const char* ld_library_path,
-                                      const char* default_library_path, bool is_isolated);
+                                      const char* default_library_path, bool is_isolated,
+                                      const char* permitted_when_isolated_path);
 
 #endif
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp
index db43d38..1b0c4e4 100644
--- a/linker/linker_utils.cpp
+++ b/linker/linker_utils.cpp
@@ -66,9 +66,18 @@
   const char* haystack = file.c_str();
   size_t needle_len = strlen(needle);
 
-  return (strncmp(haystack, needle, needle_len) == 0 &&
-          haystack[needle_len] == '/' &&
-          strchr(haystack + needle_len + 1, '/') == nullptr);
+  return strncmp(haystack, needle, needle_len) == 0 &&
+         haystack[needle_len] == '/' &&
+         strchr(haystack + needle_len + 1, '/') == nullptr;
+}
+
+bool file_is_under_dir(const std::string& file, const std::string& dir) {
+  const char* needle = dir.c_str();
+  const char* haystack = file.c_str();
+  size_t needle_len = strlen(needle);
+
+  return strncmp(haystack, needle, needle_len) == 0 &&
+         haystack[needle_len] == '/';
 }
 
 const char* const kZipFileSeparator = "!/";
diff --git a/linker/linker_utils.h b/linker/linker_utils.h
index 65ffbdc5..987eabd 100644
--- a/linker/linker_utils.h
+++ b/linker/linker_utils.h
@@ -22,6 +22,7 @@
 
 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 parse_zip_path(const char* input_path, std::string* zip_path, std::string* entry_path);
 
 off64_t page_start(off64_t offset);
diff --git a/linker/tests/linker_utils_test.cpp b/linker/tests/linker_utils_test.cpp
index 3be9b3f..fd749fa 100644
--- a/linker/tests/linker_utils_test.cpp
+++ b/linker/tests/linker_utils_test.cpp
@@ -54,6 +54,18 @@
   ASSERT_FALSE(file_is_in_dir("/file", "/"));
 }
 
+TEST(linker_utils, file_is_under_dir_smoke) {
+  ASSERT_TRUE(file_is_under_dir("/foo/bar/file", "/foo/bar"));
+  ASSERT_TRUE(file_is_under_dir("/foo/bar/file", "/foo"));
+
+  ASSERT_FALSE(file_is_under_dir("/foo/bar/file", "/bar/foo"));
+
+  ASSERT_TRUE(file_is_under_dir("/file", ""));
+  ASSERT_TRUE(file_is_under_dir("/foo/bar/file", ""));
+  ASSERT_FALSE(file_is_under_dir("/file", "/"));
+  ASSERT_FALSE(file_is_under_dir("/foo/bar/file", "/"));
+}
+
 TEST(linker_utils, parse_zip_path_smoke) {
   std::string zip_path;
   std::string entry_path;
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index 97b5208..5327e36 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -628,10 +628,10 @@
   handle_public = dlopen((lib_path + "/public_namespace_libs/" + g_public_lib).c_str(), RTLD_NOW | RTLD_NOLOAD);
   ASSERT_TRUE(handle_public != nullptr) << dlerror();
 
-  android_namespace_t* ns1 = android_create_namespace("private", nullptr, (lib_path + "/private_namespace_libs").c_str(), false);
+  android_namespace_t* ns1 = android_create_namespace("private", nullptr, (lib_path + "/private_namespace_libs").c_str(), false, nullptr);
   ASSERT_TRUE(ns1 != nullptr) << dlerror();
 
-  android_namespace_t* ns2 = android_create_namespace("private_isolated", nullptr, (lib_path + "/private_namespace_libs").c_str(), true);
+  android_namespace_t* ns2 = android_create_namespace("private_isolated", nullptr, (lib_path + "/private_namespace_libs").c_str(), true, nullptr);
   ASSERT_TRUE(ns2 != nullptr) << dlerror();
 
   // This should not have affect search path for default namespace:
@@ -732,13 +732,13 @@
 
   ASSERT_TRUE(android_init_namespaces(path.c_str(), nullptr)) << dlerror();
 
-  android_namespace_t* ns_not_isolated = android_create_namespace("private", nullptr, (lib_path + "/private_namespace_libs").c_str(), false);
+  android_namespace_t* ns_not_isolated = android_create_namespace("private", nullptr, (lib_path + "/private_namespace_libs").c_str(), false, nullptr);
   ASSERT_TRUE(ns_not_isolated != nullptr) << dlerror();
 
-  android_namespace_t* ns_isolated = android_create_namespace("private_isolated1", nullptr, (lib_path + "/private_namespace_libs").c_str(), true);
+  android_namespace_t* ns_isolated = android_create_namespace("private_isolated1", nullptr, (lib_path + "/private_namespace_libs").c_str(), true, nullptr);
   ASSERT_TRUE(ns_isolated != nullptr) << dlerror();
 
-  android_namespace_t* ns_isolated2 = android_create_namespace("private_isolated2", (lib_path + "/private_namespace_libs").c_str(), nullptr, true);
+  android_namespace_t* ns_isolated2 = android_create_namespace("private_isolated2", (lib_path + "/private_namespace_libs").c_str(), nullptr, true, lib_path.c_str());
   ASSERT_TRUE(ns_isolated2 != nullptr) << dlerror();
 
   ASSERT_TRUE(dlopen(root_lib, RTLD_NOW) == nullptr);
@@ -772,14 +772,15 @@
 
   extinfo.library_namespace = ns_isolated2;
 
+  // this should work because isolation_path for private_isolated2 includes lib_path
   handle2 = android_dlopen_ext(root_lib, RTLD_NOW, &extinfo);
-  ASSERT_TRUE(handle2 == nullptr);
-  ASSERT_STREQ("dlopen failed: library \"libnstest_private_external.so\" not found", dlerror());
+  ASSERT_TRUE(handle2 != nullptr) << dlerror();
+  dlclose(handle2);
 
   // Check dlopen by absolute path
   handle2 = android_dlopen_ext(lib_private_external_path.c_str(), RTLD_NOW, &extinfo);
-  ASSERT_TRUE(handle2 == nullptr);
-  ASSERT_EQ("dlopen failed: library \"" + lib_private_external_path + "\" is not accessible for the namespace \"private_isolated2\"", dlerror());
+  ASSERT_TRUE(handle2 != nullptr) << dlerror();
+  dlclose(handle2);
 
   typedef const char* (*fn_t)();
   fn_t ns_get_local_string = reinterpret_cast<fn_t>(dlsym(handle1, "ns_get_local_string"));
@@ -824,7 +825,7 @@
   android_namespace_t* ns = android_create_namespace(
                                 "private", nullptr,
                                 (lib_path + "/private_namespace_libs").c_str(),
-                                false);
+                                false, nullptr);
 
   ASSERT_TRUE(ns != nullptr) << dlerror();
 
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index ed972ba..81479d5 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -624,8 +624,10 @@
   handle = dlopen("libtest_with_dependency_loop.so", RTLD_NOW | RTLD_NOLOAD);
   ASSERT_TRUE(handle == nullptr);
 #ifdef __BIONIC__
-  // TODO: glibc returns nullptr on dlerror() here. Is it bug?
   ASSERT_STREQ("dlopen failed: library \"libtest_with_dependency_loop.so\" wasn't loaded and RTLD_NOLOAD prevented it", dlerror());
+#else
+  // TODO: glibc returns nullptr on dlerror() here. Is it bug?
+  ASSERT_TRUE(dlerror() == nullptr);
 #endif
 
   handle = dlopen("libtest_with_dependency_a.so", RTLD_NOW | RTLD_NOLOAD);
@@ -760,15 +762,7 @@
   // so it can be distinguished from the NULL handle.
   sym = dlsym(nullptr, "test");
   ASSERT_TRUE(sym == nullptr);
-  ASSERT_SUBSTR("dlsym library handle is null", dlerror());
-#endif
-
-  // NULL symbol name.
-#if defined(__BIONIC__)
-  // glibc marks this parameter non-null and SEGVs if you cheat.
-  sym = dlsym(self, nullptr);
-  ASSERT_TRUE(sym == nullptr);
-  ASSERT_SUBSTR("", dlerror());
+  ASSERT_STREQ("dlsym failed: library handle is null", dlerror());
 #endif
 
   // Symbol that doesn't exist.
@@ -1054,6 +1048,26 @@
   dlclose(handle);
 }
 
+TEST(dlfcn, dlvsym_smoke) {
+  void* handle = dlopen("libtest_versioned_lib.so", RTLD_NOW);
+  ASSERT_TRUE(handle != nullptr) << dlerror();
+  typedef int (*fn_t)();
+
+  {
+    fn_t fn = reinterpret_cast<fn_t>(dlvsym(handle, "versioned_function", "nonversion"));
+    ASSERT_TRUE(fn == nullptr);
+    ASSERT_SUBSTR("undefined symbol: versioned_function, version nonversion", dlerror());
+  }
+
+  {
+    fn_t fn = reinterpret_cast<fn_t>(dlvsym(handle, "versioned_function", "TESTLIB_V2"));
+    ASSERT_TRUE(fn != nullptr) << dlerror();
+    ASSERT_EQ(2, fn());
+  }
+
+  dlclose(handle);
+}
+
 // This preempts the implementation from libtest_versioned_lib.so
 extern "C" int version_zero_function() {
   return 0;
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp
index b76625a..5af5a6f 100644
--- a/tests/malloc_test.cpp
+++ b/tests/malloc_test.cpp
@@ -372,3 +372,22 @@
   }
 #endif
 }
+
+TEST(malloc, calloc_usable_size) {
+  for (size_t size = 1; size <= 2048; size++) {
+    void* pointer = malloc(size);
+    ASSERT_TRUE(pointer != nullptr);
+    memset(pointer, 0xeb, malloc_usable_size(pointer));
+    free(pointer);
+
+    // We should get a previous pointer that has been set to non-zero.
+    // If calloc does not zero out all of the data, this will fail.
+    uint8_t* zero_mem = reinterpret_cast<uint8_t*>(calloc(1, size));
+    ASSERT_TRUE(pointer != nullptr);
+    size_t usable_size = malloc_usable_size(zero_mem);
+    for (size_t i = 0; i < usable_size; i++) {
+      ASSERT_EQ(0, zero_mem[i]) << "Failed at allocation size " << size << " at byte " << i;
+    }
+    free(zero_mem);
+  }
+}
diff --git a/tests/pthread_test.cpp b/tests/pthread_test.cpp
index 27d992b..78dbd39 100755
--- a/tests/pthread_test.cpp
+++ b/tests/pthread_test.cpp
@@ -1536,6 +1536,9 @@
 
   ASSERT_EQ(0, pthread_mutex_lock(&m.lock));
   ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
+  ASSERT_EQ(0, pthread_mutex_trylock(&m.lock));
+  ASSERT_EQ(EBUSY, pthread_mutex_trylock(&m.lock));
+  ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
 }
 
 TEST(pthread, pthread_mutex_lock_ERRORCHECK) {
@@ -1558,6 +1561,8 @@
   ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
   ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
   ASSERT_EQ(0, pthread_mutex_trylock(&m.lock));
+  ASSERT_EQ(0, pthread_mutex_trylock(&m.lock));
+  ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
   ASSERT_EQ(0, pthread_mutex_unlock(&m.lock));
   ASSERT_EQ(EPERM, pthread_mutex_unlock(&m.lock));
 }
diff --git a/tests/semaphore_test.cpp b/tests/semaphore_test.cpp
index b65bfb8..84343da 100644
--- a/tests/semaphore_test.cpp
+++ b/tests/semaphore_test.cpp
@@ -131,6 +131,13 @@
   ASSERT_EQ(0, sem_destroy(&s));
 }
 
+TEST(semaphore_DeathTest, sem_timedwait_null_timeout) {
+  sem_t s;
+  ASSERT_EQ(0, sem_init(&s, 0, 0));
+
+  ASSERT_EXIT(sem_timedwait(&s, nullptr), testing::KilledBySignal(SIGSEGV), "");
+}
+
 TEST(semaphore, sem_getvalue) {
   sem_t s;
   ASSERT_EQ(0, sem_init(&s, 0, 0));
diff --git a/tests/sys_personality_test.cpp b/tests/sys_personality_test.cpp
index 2dfaa65..6bd00ef 100644
--- a/tests/sys_personality_test.cpp
+++ b/tests/sys_personality_test.cpp
@@ -21,7 +21,9 @@
 TEST(sys_personality, current_persona) {
   int persona = personality(0xffffffff) & PER_MASK;
 #if defined(__BIONIC__)
-#if defined(__LP64__)
+// When personality syscall is executed on mips64, for a 32bit process
+// sys_32_personality() is called, which converts PER_LINUX32 -> PER_LINUX
+#if defined(__LP64__) || (__mips==32 && __mips_isa_rev>2)
   ASSERT_EQ(PER_LINUX, persona);
 #else
   ASSERT_EQ(PER_LINUX32, persona);