Merge "Replace MALLOC_IMPL with MALLOC_SVELTE."
diff --git a/libc/Android.bp b/libc/Android.bp
index 74fd22b..d355d4c 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1348,6 +1348,7 @@
         "bionic/getpid.cpp",
         "bionic/gettid.cpp",
         "bionic/__gnu_basename.cpp",
+        "bionic/ifaddrs.cpp",
         "bionic/inotify_init.cpp",
         "bionic/ioctl.cpp",
         "bionic/lchown.cpp",
@@ -1766,7 +1767,6 @@
 
     nocrt: true,
 
-    // special for arm
     arch: {
         arm: {
             //TODO: This is to work around b/24465209. Remove after root cause is fixed
@@ -1774,6 +1774,11 @@
 
             // Don't re-export new/delete and friends, even if the compiler really wants to.
             version_script: "libc.arm.map",
+            product_variables: {
+                brillo: {
+                    version_script: "libc.arm.brillo.map",
+                },
+            },
 
             shared: {
                 srcs: ["arch-arm/bionic/exidx_dynamic.c"],
@@ -1781,6 +1786,8 @@
             static: {
                 srcs: ["arch-arm/bionic/exidx_static.c"],
             },
+
+            // special for arm
             cflags: ["-DCRT_LEGACY_WORKAROUND"],
             srcs: [
                 "arch-arm/bionic/atexit_legacy.c",
@@ -1793,6 +1800,11 @@
         mips: {
             // Don't re-export new/delete and friends, even if the compiler really wants to.
             version_script: "libc.mips.map",
+            product_variables: {
+                brillo: {
+                    version_script: "libc.mips.brillo.map",
+                },
+            },
         },
         mips64: {
             // Don't re-export new/delete and friends, even if the compiler really wants to.
@@ -1804,6 +1816,11 @@
 
             // Don't re-export new/delete and friends, even if the compiler really wants to.
             version_script: "libc.x86.map",
+            product_variables: {
+                brillo: {
+                    version_script: "libc.x86.brillo.map",
+                },
+            },
         },
         x86_64: {
             // Don't re-export new/delete and friends, even if the compiler really wants to.
diff --git a/libc/Android.mk b/libc/Android.mk
index 6e5ae62..5ac0e1d 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -616,6 +616,7 @@
 libc_common_cflags := \
     -D_LIBC=1 \
     -Wall -Wextra -Wunused \
+    -fno-stack-protector \
 
 use_clang := $(USE_CLANG_PLATFORM_BUILD)
 
diff --git a/libc/arch-arm/bionic/__aeabi.c b/libc/arch-arm/bionic/__aeabi.c
index 254c7a6..098c553 100644
--- a/libc/arch-arm/bionic/__aeabi.c
+++ b/libc/arch-arm/bionic/__aeabi.c
@@ -51,34 +51,62 @@
  */
 
 int __attribute__((weak))
-__aeabi_atexit(void *object, void (*destructor) (void *), void *dso_handle) {
+__aeabi_atexit_impl(void *object, void (*destructor) (void *), void *dso_handle) {
+    return __cxa_atexit(destructor, object, dso_handle);
+}
+
+int __attribute__((weak))
+__aeabi_atexit_impl2(void *object, void (*destructor) (void *), void *dso_handle) {
     return __cxa_atexit(destructor, object, dso_handle);
 }
 
 
-void __attribute__((weak))
-__aeabi_memcpy8(void *dest, const void *src, size_t n) {
+void __attribute__((weak)) __aeabi_memcpy8_impl(void *dest, const void *src, size_t n) {
     memcpy(dest, src, n);
 }
 
-void __attribute__((weak)) __aeabi_memcpy4(void *dest, const void *src, size_t n) {
+void __attribute__((weak)) __aeabi_memcpy4_impl(void *dest, const void *src, size_t n) {
     memcpy(dest, src, n);
 }
 
-void __attribute__((weak)) __aeabi_memcpy(void *dest, const void *src, size_t n) {
+void __attribute__((weak)) __aeabi_memcpy_impl(void *dest, const void *src, size_t n) {
+    memcpy(dest, src, n);
+}
+
+void __attribute__((weak)) __aeabi_memcpy8_impl2(void *dest, const void *src, size_t n) {
+    memcpy(dest, src, n);
+}
+
+void __attribute__((weak)) __aeabi_memcpy4_impl2(void *dest, const void *src, size_t n) {
+    memcpy(dest, src, n);
+}
+
+void __attribute__((weak)) __aeabi_memcpy_impl2(void *dest, const void *src, size_t n) {
     memcpy(dest, src, n);
 }
 
 
-void __attribute__((weak)) __aeabi_memmove8(void *dest, const void *src, size_t n) {
+void __attribute__((weak)) __aeabi_memmove8_impl(void *dest, const void *src, size_t n) {
     memmove(dest, src, n);
 }
 
-void __attribute__((weak)) __aeabi_memmove4(void *dest, const void *src, size_t n) {
+void __attribute__((weak)) __aeabi_memmove4_impl(void *dest, const void *src, size_t n) {
     memmove(dest, src, n);
 }
 
-void __attribute__((weak)) __aeabi_memmove(void *dest, const void *src, size_t n) {
+void __attribute__((weak)) __aeabi_memmove_impl(void *dest, const void *src, size_t n) {
+    memmove(dest, src, n);
+}
+
+void __attribute__((weak)) __aeabi_memmove8_impl2(void *dest, const void *src, size_t n) {
+    memmove(dest, src, n);
+}
+
+void __attribute__((weak)) __aeabi_memmove4_impl2(void *dest, const void *src, size_t n) {
+    memmove(dest, src, n);
+}
+
+void __attribute__((weak)) __aeabi_memmove_impl2(void *dest, const void *src, size_t n) {
     memmove(dest, src, n);
 }
 
@@ -87,27 +115,71 @@
  *  This allows __aeabi_memclr to tail-call __aeabi_memset
  */
 
-void __attribute__((weak)) __aeabi_memset8(void *dest, size_t n, int c) {
+void __attribute__((weak)) __aeabi_memset8_impl(void *dest, size_t n, int c) {
     memset(dest, c, n);
 }
 
-void __attribute__((weak)) __aeabi_memset4(void *dest, size_t n, int c) {
+void __attribute__((weak)) __aeabi_memset4_impl(void *dest, size_t n, int c) {
     memset(dest, c, n);
 }
 
-void __attribute__((weak)) __aeabi_memset(void *dest, size_t n, int c) {
+void __attribute__((weak)) __aeabi_memset_impl(void *dest, size_t n, int c) {
+    memset(dest, c, n);
+}
+
+void __attribute__((weak)) __aeabi_memset8_impl2(void *dest, size_t n, int c) {
+    memset(dest, c, n);
+}
+
+void __attribute__((weak)) __aeabi_memset4_impl2(void *dest, size_t n, int c) {
+    memset(dest, c, n);
+}
+
+void __attribute__((weak)) __aeabi_memset_impl2(void *dest, size_t n, int c) {
     memset(dest, c, n);
 }
 
 
-void __attribute__((weak)) __aeabi_memclr8(void *dest, size_t n) {
-    __aeabi_memset8(dest, n, 0);
+void __attribute__((weak)) __aeabi_memclr8_impl(void *dest, size_t n) {
+    __aeabi_memset8_impl(dest, n, 0);
 }
 
-void __attribute__((weak)) __aeabi_memclr4(void *dest, size_t n) {
-    __aeabi_memset4(dest, n, 0);
+void __attribute__((weak)) __aeabi_memclr4_impl(void *dest, size_t n) {
+    __aeabi_memset4_impl(dest, n, 0);
 }
 
-void __attribute__((weak)) __aeabi_memclr(void *dest, size_t n) {
-    __aeabi_memset(dest, n, 0);
+void __attribute__((weak)) __aeabi_memclr_impl(void *dest, size_t n) {
+    __aeabi_memset_impl(dest, n, 0);
 }
+
+void __attribute__((weak)) __aeabi_memclr8_impl2(void *dest, size_t n) {
+    __aeabi_memset8_impl(dest, n, 0);
+}
+
+void __attribute__((weak)) __aeabi_memclr4_impl2(void *dest, size_t n) {
+    __aeabi_memset4_impl(dest, n, 0);
+}
+
+void __attribute__((weak)) __aeabi_memclr_impl2(void *dest, size_t n) {
+    __aeabi_memset_impl(dest, n, 0);
+}
+
+#define __AEABI_SYMVERS(fn_name) \
+__asm__(".symver " #fn_name "_impl, " #fn_name "@@LIBC"); \
+__asm__(".symver " #fn_name "_impl2, " #fn_name "@LIBC_PRIVATE")
+
+__AEABI_SYMVERS(__aeabi_atexit);
+__AEABI_SYMVERS(__aeabi_memcpy8);
+__AEABI_SYMVERS(__aeabi_memcpy4);
+__AEABI_SYMVERS(__aeabi_memcpy);
+__AEABI_SYMVERS(__aeabi_memmove8);
+__AEABI_SYMVERS(__aeabi_memmove4);
+__AEABI_SYMVERS(__aeabi_memmove);
+__AEABI_SYMVERS(__aeabi_memset8);
+__AEABI_SYMVERS(__aeabi_memset4);
+__AEABI_SYMVERS(__aeabi_memset);
+__AEABI_SYMVERS(__aeabi_memclr8);
+__AEABI_SYMVERS(__aeabi_memclr4);
+__AEABI_SYMVERS(__aeabi_memclr);
+
+#undef __AEABI_SYMVERS
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index b0c62d6..d16b452 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -336,7 +336,7 @@
 
   if (getauxval(AT_SECURE)) {
     // If this is a setuid/setgid program, close the security hole described in
-    // ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02:23.stdio.asc
+    // https://www.freebsd.org/security/advisories/FreeBSD-SA-02:23.stdio.asc
     __nullify_closed_stdio();
 
     __sanitize_environment_variables(args.envp);
diff --git a/libc/bionic/ndk_cruft.cpp b/libc/bionic/ndk_cruft.cpp
index 4bbb2c1..dfd0e68 100644
--- a/libc/bionic/ndk_cruft.cpp
+++ b/libc/bionic/ndk_cruft.cpp
@@ -340,10 +340,17 @@
 }
 
 // In L we added a public pthread_gettid_np, but some apps were using the private API.
-pid_t __pthread_gettid(pthread_t t) {
+pid_t __pthread_gettid_libc(pthread_t t) {
   return pthread_gettid_np(t);
 }
 
+pid_t __pthread_gettid_libc_private(pthread_t t) {
+  return pthread_gettid_np(t);
+}
+
+__asm__(".symver __pthread_gettid_libc,__pthread_gettid@LIBC");
+__asm__(".symver __pthread_gettid_libc_private,__pthread_gettid@@LIBC_PRIVATE");
+
 // Older versions of apportable used dlmalloc directly instead of malloc,
 // so export this compatibility shim that simply calls malloc.
 void* dlmalloc(size_t size) {
diff --git a/libc/libc.arm.brillo.map b/libc/libc.arm.brillo.map
index fb729d4..f7033a0 100644
--- a/libc/libc.arm.brillo.map
+++ b/libc/libc.arm.brillo.map
@@ -1,6 +1,19 @@
 # Generated by genversionscripts.py. Do not edit.
 LIBC {
   global:
+    __aeabi_atexit; # 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
     __assert;
     __assert2;
     __atomic_cmpxchg; # arm
@@ -260,7 +273,6 @@
     brk;
     bsearch;
     btowc;
-    bzero; # arm x86 mips
     c16rtomb;
     c32rtomb;
     cacheflush; # arm mips
@@ -675,7 +687,6 @@
     mktemp;
     mktime;
     mktime64; # arm x86 mips
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
@@ -1390,7 +1401,7 @@
     __swrite; # arm x86 mips
     __swsetup; # arm x86 mips
     __truncdfsf2; # arm
-    __udivdi3; # arm x86 mips
+    __udivdi3; # arm mips
     __udivsi3; # arm
     __unorddf2; # arm
     __unordsf2; # arm
diff --git a/libc/libc.arm.map b/libc/libc.arm.map
index 60ca598..a88c549 100644
--- a/libc/libc.arm.map
+++ b/libc/libc.arm.map
@@ -1,6 +1,19 @@
 # Generated by genversionscripts.py. Do not edit.
 LIBC {
   global:
+    __aeabi_atexit; # 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
     __assert;
     __assert2;
     __atomic_cmpxchg; # arm
@@ -122,6 +135,7 @@
     __pselect6; # arm x86 mips
     __pthread_cleanup_pop;
     __pthread_cleanup_push;
+    __pthread_gettid; # arm x86 mips nobrillo
     __ptrace; # arm x86 mips
     __putlong;
     __putshort;
@@ -260,7 +274,6 @@
     brk;
     bsearch;
     btowc;
-    bzero; # arm x86 mips
     c16rtomb;
     c32rtomb;
     cacheflush; # arm mips
@@ -675,7 +688,6 @@
     mktemp;
     mktime;
     mktime64; # arm x86 mips
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
@@ -1401,7 +1413,7 @@
     __swrite; # arm x86 mips
     __swsetup; # arm x86 mips
     __truncdfsf2; # arm
-    __udivdi3; # arm x86 mips
+    __udivdi3; # arm mips
     __udivsi3; # arm
     __unorddf2; # arm
     __unordsf2; # arm
@@ -1426,6 +1438,7 @@
     arc4random_stir; # arm x86 mips nobrillo
     atexit; # arm
     bcopy; # arm x86 mips nobrillo
+    bzero; # arm x86 mips nobrillo
     bsd_signal; # arm x86 mips nobrillo
     dlmalloc; # arm x86 mips nobrillo
     dlmalloc_inspect_all; # arm x86 mips nobrillo
diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map
index 530706d..dcf1e8f 100644
--- a/libc/libc.arm64.map
+++ b/libc/libc.arm64.map
@@ -581,7 +581,6 @@
     mkstemps64;
     mktemp;
     mktime;
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index a91c4d7..dba1b90 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1,5 +1,18 @@
 LIBC {
   global:
+    __aeabi_atexit; # 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
     __assert;
     __assert2;
     __atomic_cmpxchg; # arm
@@ -123,6 +136,7 @@
     __pselect6; # arm x86 mips
     __pthread_cleanup_pop;
     __pthread_cleanup_push;
+    __pthread_gettid; # arm x86 mips nobrillo
     __ptrace; # arm x86 mips
     __putlong;
     __putshort;
@@ -209,6 +223,7 @@
     __timer_getoverrun; # arm x86 mips
     __timer_gettime; # arm x86 mips
     __timer_settime; # arm x86 mips
+    __udivdi3; # x86
     __umask_chk;
     __vsnprintf_chk;
     __vsprintf_chk;
@@ -263,7 +278,6 @@
     brk;
     bsearch;
     btowc;
-    bzero; # arm x86 mips
     c16rtomb;
     c32rtomb;
     cacheflush; # arm mips
@@ -678,7 +692,6 @@
     mktemp;
     mktime;
     mktime64; # arm x86 mips
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
@@ -1442,7 +1455,7 @@
     __system_property_update; # arm64 x86_64 mips64
     __system_property_wait_any; # arm64 x86_64 mips64
     __truncdfsf2; # arm
-    __udivdi3; # arm x86 mips
+    __udivdi3; # arm mips
     __udivsi3; # arm
     __umoddi3; # x86 mips
     __unorddf2; # arm
@@ -1468,6 +1481,7 @@
     arc4random_stir; # arm x86 mips nobrillo
     atexit; # arm
     bcopy; # arm x86 mips nobrillo
+    bzero; # arm x86 mips nobrillo
     bsd_signal; # arm x86 mips nobrillo
     dlmalloc; # arm x86 mips nobrillo
     dlmalloc_inspect_all; # arm x86 mips nobrillo
diff --git a/libc/libc.mips.brillo.map b/libc/libc.mips.brillo.map
index 9a45181..e3b5a5e 100644
--- a/libc/libc.mips.brillo.map
+++ b/libc/libc.mips.brillo.map
@@ -259,7 +259,6 @@
     brk;
     bsearch;
     btowc;
-    bzero; # arm x86 mips
     c16rtomb;
     c32rtomb;
     cacheflush; # arm mips
@@ -674,7 +673,6 @@
     mktemp;
     mktime;
     mktime64; # arm x86 mips
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
@@ -1265,7 +1263,7 @@
     __swbuf; # arm x86 mips
     __swrite; # arm x86 mips
     __swsetup; # arm x86 mips
-    __udivdi3; # arm x86 mips
+    __udivdi3; # arm mips
     __umoddi3; # x86 mips
     _fwalk; # arm x86 mips
     free_malloc_leak_info;
diff --git a/libc/libc.mips.map b/libc/libc.mips.map
index df0e4b7..4d2f826 100644
--- a/libc/libc.mips.map
+++ b/libc/libc.mips.map
@@ -120,6 +120,7 @@
     __pselect6; # arm x86 mips
     __pthread_cleanup_pop;
     __pthread_cleanup_push;
+    __pthread_gettid; # arm x86 mips nobrillo
     __ptrace; # arm x86 mips
     __putlong;
     __putshort;
@@ -259,7 +260,6 @@
     brk;
     bsearch;
     btowc;
-    bzero; # arm x86 mips
     c16rtomb;
     c32rtomb;
     cacheflush; # arm mips
@@ -674,7 +674,6 @@
     mktemp;
     mktime;
     mktime64; # arm x86 mips
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
@@ -1276,13 +1275,14 @@
     __swbuf; # arm x86 mips
     __swrite; # arm x86 mips
     __swsetup; # arm x86 mips
-    __udivdi3; # arm x86 mips
+    __udivdi3; # arm mips
     __umoddi3; # x86 mips
     __wait4; # arm x86 mips nobrillo
     _fwalk; # arm x86 mips
     arc4random_addrandom; # arm x86 mips nobrillo
     arc4random_stir; # arm x86 mips nobrillo
     bcopy; # arm x86 mips nobrillo
+    bzero; # arm x86 mips nobrillo
     bsd_signal; # arm x86 mips nobrillo
     dlmalloc; # arm x86 mips nobrillo
     dlmalloc_inspect_all; # arm x86 mips nobrillo
diff --git a/libc/libc.mips64.map b/libc/libc.mips64.map
index 530706d..dcf1e8f 100644
--- a/libc/libc.mips64.map
+++ b/libc/libc.mips64.map
@@ -581,7 +581,6 @@
     mkstemps64;
     mktemp;
     mktime;
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
diff --git a/libc/libc.x86.brillo.map b/libc/libc.x86.brillo.map
index 9c057c8..637ad06 100644
--- a/libc/libc.x86.brillo.map
+++ b/libc/libc.x86.brillo.map
@@ -205,6 +205,7 @@
     __timer_getoverrun; # arm x86 mips
     __timer_gettime; # arm x86 mips
     __timer_settime; # arm x86 mips
+    __udivdi3; # x86
     __umask_chk;
     __vsnprintf_chk;
     __vsprintf_chk;
@@ -258,7 +259,6 @@
     brk;
     bsearch;
     btowc;
-    bzero; # arm x86 mips
     c16rtomb;
     c32rtomb;
     calloc;
@@ -672,7 +672,6 @@
     mktemp;
     mktime;
     mktime64; # arm x86 mips
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
@@ -1264,7 +1263,6 @@
     __swbuf; # arm x86 mips
     __swrite; # arm x86 mips
     __swsetup; # arm x86 mips
-    __udivdi3; # arm x86 mips
     __umoddi3; # x86 mips
     _fwalk; # arm x86 mips
     free_malloc_leak_info;
diff --git a/libc/libc.x86.map b/libc/libc.x86.map
index 5e8fcb1..76bf9ea 100644
--- a/libc/libc.x86.map
+++ b/libc/libc.x86.map
@@ -120,6 +120,7 @@
     __pselect6; # arm x86 mips
     __pthread_cleanup_pop;
     __pthread_cleanup_push;
+    __pthread_gettid; # arm x86 mips nobrillo
     __ptrace; # arm x86 mips
     __putlong;
     __putshort;
@@ -205,6 +206,7 @@
     __timer_getoverrun; # arm x86 mips
     __timer_gettime; # arm x86 mips
     __timer_settime; # arm x86 mips
+    __udivdi3; # x86
     __umask_chk;
     __vsnprintf_chk;
     __vsprintf_chk;
@@ -258,7 +260,6 @@
     brk;
     bsearch;
     btowc;
-    bzero; # arm x86 mips
     c16rtomb;
     c32rtomb;
     calloc;
@@ -672,7 +673,6 @@
     mktemp;
     mktime;
     mktime64; # arm x86 mips
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
@@ -1275,13 +1275,13 @@
     __swbuf; # arm x86 mips
     __swrite; # arm x86 mips
     __swsetup; # arm x86 mips
-    __udivdi3; # arm x86 mips
     __umoddi3; # x86 mips
     __wait4; # arm x86 mips nobrillo
     _fwalk; # arm x86 mips
     arc4random_addrandom; # arm x86 mips nobrillo
     arc4random_stir; # arm x86 mips nobrillo
     bcopy; # arm x86 mips nobrillo
+    bzero; # arm x86 mips nobrillo
     bsd_signal; # arm x86 mips nobrillo
     dlmalloc; # arm x86 mips nobrillo
     dlmalloc_inspect_all; # arm x86 mips nobrillo
diff --git a/libc/libc.x86_64.map b/libc/libc.x86_64.map
index 530706d..dcf1e8f 100644
--- a/libc/libc.x86_64.map
+++ b/libc/libc.x86_64.map
@@ -581,7 +581,6 @@
     mkstemps64;
     mktemp;
     mktime;
-    mktime_tz;
     mlock;
     mlockall;
     mmap;
diff --git a/libc/private/KernelArgumentBlock.h b/libc/private/KernelArgumentBlock.h
index c8ea497..68d4999 100644
--- a/libc/private/KernelArgumentBlock.h
+++ b/libc/private/KernelArgumentBlock.h
@@ -38,32 +38,25 @@
     argv = reinterpret_cast<char**>(args + 1);
     envp = argv + argc + 1;
 
-    // Skip over all environment variable definitions to find aux vector.
-    // The end of the environment block is marked by two NULL pointers.
+    // Skip over all environment variable definitions to find the aux vector.
+    // The end of the environment block is marked by a NULL pointer.
     char** p = envp;
     while (*p != NULL) {
       ++p;
     }
-    ++p; // Skip second NULL;
+    ++p; // Skip the NULL itself.
 
     auxv = reinterpret_cast<ElfW(auxv_t)*>(p);
   }
 
   // Similar to ::getauxval but doesn't require the libc global variables to be set up,
-  // so it's safe to call this really early on. This function also lets you distinguish
-  // between the inability to find the given type and its value just happening to be 0.
-  unsigned long getauxval(unsigned long type, bool* found_match = NULL) {
+  // so it's safe to call this really early on.
+  unsigned long getauxval(unsigned long type) {
     for (ElfW(auxv_t)* v = auxv; v->a_type != AT_NULL; ++v) {
       if (v->a_type == type) {
-        if (found_match != NULL) {
-            *found_match = true;
-        }
         return v->a_un.a_val;
       }
     }
-    if (found_match != NULL) {
-      *found_match = false;
-    }
     return 0;
   }
 
diff --git a/libc/private/bionic_time.h b/libc/private/bionic_time.h
deleted file mode 100644
index 030dcfd..0000000
--- a/libc/private/bionic_time.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _BIONIC_TIME_H
-#define _BIONIC_TIME_H
-
-#include <time.h>
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-// We can't remove this (and this file) until we fix MtpUtils.cpp.
-time_t mktime_tz(struct tm* const, char const*);
-
-__END_DECLS
-
-#endif /* _BIONIC_TIME_H */
diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c
index b1ebb24..f370e87 100644
--- a/libc/tzcode/localtime.c
+++ b/libc/tzcode/localtime.c
@@ -2462,50 +2462,4 @@
   return fd;
 }
 
-// Caches the most recent timezone (http://b/8270865).
-static int __bionic_tzload_cached(const char* name, struct state* const sp, const int doextend) {
-  lock();
-
-  // Our single-item cache.
-  static char* g_cached_time_zone_name;
-  static struct state g_cached_time_zone;
-
-  // Do we already have this timezone cached?
-  if (g_cached_time_zone_name != NULL && strcmp(name, g_cached_time_zone_name) == 0) {
-    *sp = g_cached_time_zone;
-    unlock();
-    return 0;
-  }
-
-  // Can we load it?
-  int rc = tzload(name, sp, doextend);
-  if (rc == 0) {
-    // Update the cache.
-    free(g_cached_time_zone_name);
-    g_cached_time_zone_name = strdup(name);
-    g_cached_time_zone = *sp;
-  }
-
-  unlock();
-  return rc;
-}
-
-// Non-standard API: mktime(3) but with an explicit timezone parameter.
-// This can't actually be hidden/removed until we fix MtpUtils.cpp
-__attribute__((visibility("default"))) time_t mktime_tz(struct tm* const tmp, const char* tz) {
-  struct state* st = malloc(sizeof(*st));
-  time_t return_value;
-
-  if (st == NULL)
-    return 0;
-  if (__bionic_tzload_cached(tz, st, true) != 0) {
-    // TODO: not sure what's best here, but for now, we fall back to gmt.
-    gmtload(st);
-  }
-
-  return_value = time1(tmp, localsub, st, 0L);
-  free(st);
-  return return_value;
-}
-
 // END android-added
diff --git a/linker/linker.cpp b/linker/linker.cpp
index eb938c7..130e341 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3267,7 +3267,7 @@
   /* We can't log anything until the linker is relocated */
   bool relocating_linker = (flags_ & FLAG_LINKER) != 0;
   if (!relocating_linker) {
-    INFO("[ linking %s ]", get_realpath());
+    INFO("[ Linking '%s' ]", get_realpath());
     DEBUG("si->base = %p si->flags = 0x%08x", reinterpret_cast<void*>(base), flags_);
   }
 
@@ -3954,17 +3954,27 @@
     g_ld_debug_verbosity = atoi(LD_DEBUG);
   }
 
+#if defined(__LP64__)
+  INFO("[ Android dynamic linker (64-bit) ]");
+#else
+  INFO("[ Android dynamic linker (32-bit) ]");
+#endif
+
   // These should have been sanitized by __libc_init_AT_SECURE, but the test
   // doesn't cost us anything.
   const char* ldpath_env = nullptr;
   const char* ldpreload_env = nullptr;
   if (!getauxval(AT_SECURE)) {
     ldpath_env = getenv("LD_LIBRARY_PATH");
+    if (ldpath_env != nullptr) {
+      INFO("[ LD_LIBRARY_PATH set to '%s' ]", ldpath_env);
+    }
     ldpreload_env = getenv("LD_PRELOAD");
+    if (ldpreload_env != nullptr) {
+      INFO("[ LD_PRELOAD set to '%s' ]", ldpreload_env);
+    }
   }
 
-  INFO("[ android linker & debugger ]");
-
   soinfo* si = soinfo_alloc(&g_default_namespace, args.argv[0], nullptr, 0, RTLD_GLOBAL);
   if (si == nullptr) {
     exit(EXIT_FAILURE);
@@ -4213,7 +4223,7 @@
   args.abort_message_ptr = &g_abort_message;
   ElfW(Addr) start_address = __linker_init_post_relocation(args, linker_addr);
 
-  INFO("[ jumping to _start ]");
+  INFO("[ Jumping to _start (%p)... ]", reinterpret_cast<void*>(start_address));
 
   // Return the address that the calling assembly stub should jump to.
   return start_address;