Snap for 8509668 from 44e35a40ecda0c30cc757ae239c31abdf0c496fd to tm-d2-release

Change-Id: Ib72125702685b0ddb65ebe9fbce3bdfb24f4f127
diff --git a/current/source.properties b/current/source.properties
index 1fbecca..d7470d4 100644
--- a/current/source.properties
+++ b/current/source.properties
@@ -1,2 +1,2 @@
 Pkg.Desc = Android NDK
-Pkg.Revision = 23.0.7243079
+Pkg.Revision = 25.0.8474149
diff --git a/current/sources/android/cpufeatures/Android.mk b/current/sources/android/cpufeatures/Android.mk
deleted file mode 100644
index 7b53d23..0000000
--- a/current/sources/android/cpufeatures/Android.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := cpufeatures
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
-LOCAL_SRC_FILES := cpu-features.c
-LOCAL_CFLAGS := -Wall -Wextra -Werror
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
-LOCAL_EXPORT_LDLIBS := -ldl
-include $(BUILD_STATIC_LIBRARY)
diff --git a/current/sources/android/cpufeatures/cpu-features.c b/current/sources/android/cpufeatures/cpu-features.c
index 6dae30c..7569d3e 100644
--- a/current/sources/android/cpufeatures/cpu-features.c
+++ b/current/sources/android/cpufeatures/cpu-features.c
@@ -70,6 +70,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/auxv.h>
 #include <sys/system_properties.h>
 #include <unistd.h>
 
@@ -491,56 +492,6 @@
     HWCAP_IDIVT )
 #endif
 
-#if defined(__mips__)
-// see <uapi/asm/hwcap.h> kernel header
-#define HWCAP_MIPS_R6           (1 << 0)
-#define HWCAP_MIPS_MSA          (1 << 1)
-#endif
-
-#if defined(__arm__) || defined(__aarch64__) || defined(__mips__)
-
-#define AT_HWCAP 16
-#define AT_HWCAP2 26
-
-// Probe the system's C library for a 'getauxval' function and call it if
-// it exits, or return 0 for failure. This function is available since API
-// level 20.
-//
-// This code does *NOT* check for '__ANDROID_API__ >= 20' to support the
-// edge case where some NDK developers use headers for a platform that is
-// newer than the one really targetted by their application.
-// This is typically done to use newer native APIs only when running on more
-// recent Android versions, and requires careful symbol management.
-//
-// Note that getauxval() can't really be re-implemented here, because
-// its implementation does not parse /proc/self/auxv. Instead it depends
-// on values  that are passed by the kernel at process-init time to the
-// C runtime initialization layer.
-static uint32_t
-get_elf_hwcap_from_getauxval(int hwcap_type) {
-    typedef unsigned long getauxval_func_t(unsigned long);
-
-    dlerror();
-    void* libc_handle = dlopen("libc.so", RTLD_NOW);
-    if (!libc_handle) {
-        D("Could not dlopen() C library: %s\n", dlerror());
-        return 0;
-    }
-
-    uint32_t ret = 0;
-    getauxval_func_t* func = (getauxval_func_t*)
-            dlsym(libc_handle, "getauxval");
-    if (!func) {
-        D("Could not find getauxval() in C library\n");
-    } else {
-        // Note: getauxval() returns 0 on failure. Doesn't touch errno.
-        ret = (uint32_t)(*func)(hwcap_type);
-    }
-    dlclose(libc_handle);
-    return ret;
-}
-#endif
-
 #if defined(__arm__)
 // Parse /proc/self/auxv to extract the ELF HW capabilities bitmap for the
 // current CPU. Note that this file is not accessible from regular
@@ -659,11 +610,6 @@
     g_cpuFamily = ANDROID_CPU_FAMILY_ARM;
 #elif defined(__i386__)
     g_cpuFamily = ANDROID_CPU_FAMILY_X86;
-#elif defined(__mips64)
-/* Needs to be before __mips__ since the compiler defines both */
-    g_cpuFamily = ANDROID_CPU_FAMILY_MIPS64;
-#elif defined(__mips__)
-    g_cpuFamily = ANDROID_CPU_FAMILY_MIPS;
 #elif defined(__aarch64__)
     g_cpuFamily = ANDROID_CPU_FAMILY_ARM64;
 #elif defined(__x86_64__)
@@ -775,8 +721,7 @@
         }
 
         /* Extract the list of CPU features from ELF hwcaps */
-        uint32_t hwcaps = 0;
-        hwcaps = get_elf_hwcap_from_getauxval(AT_HWCAP);
+        uint32_t hwcaps = getauxval(AT_HWCAP);
         if (!hwcaps) {
             D("Parsing /proc/self/auxv to extract ELF hwcaps!\n");
             hwcaps = get_elf_hwcap_from_proc_self_auxv();
@@ -849,8 +794,7 @@
         }
 
         /* Extract the list of CPU features from ELF hwcaps2 */
-        uint32_t hwcaps2 = 0;
-        hwcaps2 = get_elf_hwcap_from_getauxval(AT_HWCAP2);
+        uint32_t hwcaps2 = getauxval(AT_HWCAP2);
         if (hwcaps2 != 0) {
             int has_aes     = (hwcaps2 & HWCAP2_AES);
             int has_pmull   = (hwcaps2 & HWCAP2_PMULL);
@@ -959,8 +903,7 @@
 #ifdef __aarch64__
     {
         /* Extract the list of CPU features from ELF hwcaps */
-        uint32_t hwcaps = 0;
-        hwcaps = get_elf_hwcap_from_getauxval(AT_HWCAP);
+        uint32_t hwcaps = getauxval(AT_HWCAP);
         if (hwcaps != 0) {
             int has_fp      = (hwcaps & HWCAP_FP);
             int has_asimd   = (hwcaps & HWCAP_ASIMD);
@@ -1044,21 +987,6 @@
 
 
 #endif
-#if defined( __mips__)
-    {   /* MIPS and MIPS64 */
-        /* Extract the list of CPU features from ELF hwcaps */
-        uint32_t hwcaps = 0;
-        hwcaps = get_elf_hwcap_from_getauxval(AT_HWCAP);
-        if (hwcaps != 0) {
-            int has_r6      = (hwcaps & HWCAP_MIPS_R6);
-            int has_msa     = (hwcaps & HWCAP_MIPS_MSA);
-            if (has_r6)
-                g_cpuFeatures |= ANDROID_CPU_MIPS_FEATURE_R6;
-            if (has_msa)
-                g_cpuFeatures |= ANDROID_CPU_MIPS_FEATURE_MSA;
-        }
-    }
-#endif /* __mips__ */
 
     free(cpuinfo);
 }
diff --git a/current/sources/android/native_app_glue/Android.mk b/current/sources/android/native_app_glue/Android.mk
deleted file mode 100644
index a41b80f..0000000
--- a/current/sources/android/native_app_glue/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= android_native_app_glue
-LOCAL_LICENSE_KINDS:= SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS:= notice
-LOCAL_NOTICE_FILE:= $(LOCAL_PATH)/NOTICE
-LOCAL_SRC_FILES:= android_native_app_glue.c
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
-LOCAL_EXPORT_LDLIBS := -llog -landroid
-# The linker will strip this as "unused" since this is a static library, but we
-# need to keep it around since it's the interface for JNI.
-LOCAL_EXPORT_LDFLAGS := -u ANativeActivity_onCreate
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/current/sources/android/support/Android.mk b/current/sources/android/support/Android.mk
deleted file mode 100644
index 7cefed1..0000000
--- a/current/sources/android/support/Android.mk
+++ /dev/null
@@ -1,138 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-# libandroid_support is only needed on LP32.
-ifeq ($(filter $(NDK_KNOWN_DEVICE_ABI64S),$(TARGET_ARCH_ABI)),)
-
-ifneq ($(LIBCXX_FORCE_REBUILD),true) # Using prebuilt
-
-LIBCXX_LIBS := ../../cxx-stl/llvm-libc++/libs/$(TARGET_ARCH_ABI)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android_support
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
-LOCAL_SRC_FILES := $(LIBCXX_LIBS)/lib$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
-include $(PREBUILT_STATIC_LIBRARY)
-
-else # Building
-
-android_support_cflags := \
-    -D_GNU_SOURCE \
-    -Drestrict=__restrict__ \
-    -ffunction-sections \
-    -fdata-sections \
-    -fvisibility=hidden \
-
-android_support_c_includes := \
-    $(BIONIC_PATH)/libc \
-    $(BIONIC_PATH)/libc/upstream-openbsd/android/include \
-    $(BIONIC_PATH)/libm \
-    $(BIONIC_PATH)/libm/upstream-freebsd/android/include \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src \
-
-android_support_cflags += \
-    -include freebsd-compat.h \
-    -include openbsd-compat.h \
-    -include $(LOCAL_PATH)/src/support_preinclude.h \
-    -D__BIONIC_BUILD_FOR_ANDROID_SUPPORT \
-    -Werror \
-
-android_support_sources := \
-    $(BIONIC_PATH)/libc/bionic/c32rtomb.cpp \
-    $(BIONIC_PATH)/libc/bionic/locale.cpp \
-    $(BIONIC_PATH)/libc/bionic/mbrtoc32.cpp \
-    $(BIONIC_PATH)/libc/bionic/wchar.cpp \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcscat.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcschr.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcslen.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcsncmp.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcsncpy.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcspbrk.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcsrchr.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcsspn.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcsstr.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wcstok.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wmemchr.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wmemcmp.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wmemcpy.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wmemmove.c \
-    $(BIONIC_PATH)/libc/upstream-freebsd/lib/libc/string/wmemset.c \
-    $(BIONIC_PATH)/libc/upstream-openbsd/lib/libc/locale/mbtowc.c \
-    $(BIONIC_PATH)/libc/upstream-openbsd/lib/libc/stdlib/imaxabs.c \
-    $(BIONIC_PATH)/libc/upstream-openbsd/lib/libc/stdlib/imaxdiv.c \
-    $(BIONIC_PATH)/libm/digittoint.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_acos.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_acosh.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_asin.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_atan2.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_atanh.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_cosh.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_exp.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_hypot.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_log.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_log10.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_log2.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_log2f.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_logf.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_remainder.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_sinh.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/e_sqrt.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/k_cos.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/k_exp.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/k_rem_pio2.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/k_sin.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/k_tan.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_asinh.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_atan.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_cbrt.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_cos.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_erf.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_exp2.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_expm1.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_frexp.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_frexpf.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_log1p.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_logb.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_nextafter.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_remquo.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_rint.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_sin.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_tan.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_tanh.c \
-    src/locale_support.cpp \
-    src/posix_memalign.cpp \
-    src/swprintf.cpp \
-    src/wcstox.cpp \
-
-ifeq (x86,$(TARGET_ARCH_ABI))
-# Replaces broken implementations in x86 libm.so
-android_support_sources += \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_scalbln.c \
-    $(BIONIC_PATH)/libm/upstream-freebsd/lib/msun/src/s_scalbn.c \
-
-# fake_long_double.c doesn't define this for x86.
-# TODO: seems like we don't pass .S files to the assembler?
-#android_support_c_includes += $(BIONIC_PATH)/libc/arch-x86/include
-#android_support_sources += $(BIONIC_PATH)/libm/x86/lrint.S
-endif
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android_support
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
-LOCAL_SRC_FILES := $(android_support_sources)
-LOCAL_C_INCLUDES := $(android_support_c_includes)
-LOCAL_CFLAGS := $(android_support_cflags)
-LOCAL_ARM_NEON := false
-
-LOCAL_CPPFLAGS := \
-    -fvisibility-inlines-hidden \
-    -std=gnu++11 \
-
-include $(BUILD_STATIC_LIBRARY)
-
-endif # Prebuilt/building
-
-endif # LP32
diff --git a/current/sources/android/support/include/inttypes.h b/current/sources/android/support/include/inttypes.h
index 834ab91..5182434 100644
--- a/current/sources/android/support/include/inttypes.h
+++ b/current/sources/android/support/include/inttypes.h
@@ -32,11 +32,6 @@
 
 __BEGIN_DECLS
 
-#if __ANDROID_API__ < __ANDROID_API_K__
-intmax_t imaxabs(intmax_t) __attribute_const__;
-imaxdiv_t imaxdiv(intmax_t, intmax_t) __attribute_const__;
-#endif
-
 #if __ANDROID_API__ < __ANDROID_API_L__
 intmax_t wcstoimax(const wchar_t* __restrict, wchar_t** __restrict, int);
 uintmax_t wcstoumax(const wchar_t* __restrict, wchar_t** __restrict, int);
diff --git a/current/sources/android/support/include/math.h b/current/sources/android/support/include/math.h
deleted file mode 100644
index 8c29c6b..0000000
--- a/current/sources/android/support/include/math.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-#pragma once
-
-#include_next <math.h>
-
-__BEGIN_DECLS
-
-#if __ANDROID_API__ < __ANDROID_API_J_MR2__
-double        log2(double);
-float         log2f(float);
-long double   log2l(long double);
-long double   logbl(long double);
-float         tgammaf(float);
-#endif
-
-#if __ANDROID_API__ < __ANDROID_API_L__
-long double   acoshl(long double);
-long double   acosl(long double);
-long double   asinhl(long double);
-long double   asinl(long double);
-long double   atan2l(long double, long double);
-long double   atanhl(long double);
-long double   atanl(long double);
-long double   cbrtl(long double);
-long double   coshl(long double);
-long double   cosl(long double);
-long double   erfcl(long double);
-long double   erfl(long double);
-long double   exp2l(long double);
-long double   expl(long double);
-long double   expm1l(long double);
-long double   fmodl(long double, long double);
-long double   hypotl(long double, long double);
-long double   lgammal(long double);
-long double   log10l(long double);
-long double   log1pl(long double);
-long double   logl(long double);
-long double   modfl(long double, long double*);
-long double   nearbyintl(long double);
-long double   powl(long double, long double);
-long double   remainderl(long double, long double);
-long double   remquol(long double, long double, int*);
-long double   rintl(long double);
-long double   sinhl(long double);
-long double   sinl(long double);
-long double   sqrtl(long double);
-long double   tanhl(long double);
-long double   tanl(long double);
-long double   tgammal(long double);
-long int      lrintl(long double);
-long long int llrintl(long double);
-#endif
-
-__END_DECLS
diff --git a/current/sources/android/support/include/stdlib.h b/current/sources/android/support/include/stdlib.h
index e52e8ce..43c47f3 100644
--- a/current/sources/android/support/include/stdlib.h
+++ b/current/sources/android/support/include/stdlib.h
@@ -32,10 +32,6 @@
 
 __BEGIN_DECLS
 
-#if __ANDROID_API__ < __ANDROID_API_J_MR1__
-int posix_memalign(void** memptr, size_t alignment, size_t size);
-#endif
-
 #if __ANDROID_API__ < __ANDROID_API_L__
 long double strtold_l(const char*, char**, locale_t);
 long long strtoll_l(const char*, char**, int, locale_t);
diff --git a/current/sources/android/support/src/posix_memalign.cpp b/current/sources/android/support/src/posix_memalign.cpp
deleted file mode 100644
index cf7abbb..0000000
--- a/current/sources/android/support/src/posix_memalign.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <errno.h>
-#include <malloc.h>
-#include <stdlib.h>
-
-int posix_memalign(void** memptr, size_t alignment, size_t size) {
-  if ((alignment & (alignment - 1)) != 0 || alignment == 0) {
-    return EINVAL;
-  }
-
-  if (alignment % sizeof(void*) != 0) {
-    return EINVAL;
-  }
-
-  *memptr = memalign(alignment, size);
-  if (*memptr == NULL) {
-    return errno;
-  }
-
-  return 0;
-}
diff --git a/current/sources/android/support/src/support_preinclude.h b/current/sources/android/support/src/support_preinclude.h
deleted file mode 100644
index bf090b0..0000000
--- a/current/sources/android/support/src/support_preinclude.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2018 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.
- */
-
-#pragma once
-
-// Declare cimag and creal for use by __ldexp_cexp. libandroid_runtime doesn't
-// really need __ldexp_cexp, but it does need __ldexp_exp, and both functions
-// are defined in the same C file. complex.h doesn't declare cimag/creal when
-// building libandroid_support, because the functions are only available
-// starting with M, and libandroid_support is compiled for the oldest supported
-// NDK API.
-//
-// The two functions are trivial (and have __builtin_{cimag,creal}
-// equivalents). Clang inlines calls to these functions even with -O0.
-double cimag(double _Complex z);
-double creal(double _Complex z);
diff --git a/current/sources/cxx-stl/llvm-libc++/Android.mk b/current/sources/cxx-stl/llvm-libc++/Android.mk
deleted file mode 100644
index 9c19a9a..0000000
--- a/current/sources/cxx-stl/llvm-libc++/Android.mk
+++ /dev/null
@@ -1,207 +0,0 @@
-# This file is dual licensed under the MIT and the University of Illinois Open
-# Source Licenses. See LICENSE.TXT for details.
-
-LOCAL_PATH := $(call my-dir)
-
-# Normally, we distribute the NDK with prebuilt binaries of libc++
-# in $LOCAL_PATH/libs/<abi>/. However,
-#
-
-LIBCXX_FORCE_REBUILD := $(strip $(LIBCXX_FORCE_REBUILD))
-ifndef LIBCXX_FORCE_REBUILD
-  ifeq (,$(strip $(wildcard $(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/libc++_static$(TARGET_LIB_EXTENSION))))
-    $(call __ndk_info,WARNING: Rebuilding libc++ libraries from sources!)
-    $(call __ndk_info,You might want to use $$NDK/build/tools/build-cxx-stl.sh --stl=libc++)
-    $(call __ndk_info,in order to build prebuilt versions to speed up your builds!)
-    LIBCXX_FORCE_REBUILD := true
-  endif
-endif
-
-libcxx_includes := $(LOCAL_PATH)/include
-libcxx_export_includes := $(libcxx_includes)
-libcxx_sources := \
-    algorithm.cpp \
-    any.cpp \
-    atomic.cpp \
-    barrier.cpp \
-    bind.cpp \
-    charconv.cpp \
-    chrono.cpp \
-    condition_variable.cpp \
-    condition_variable_destructor.cpp \
-    debug.cpp \
-    exception.cpp \
-    filesystem/directory_iterator.cpp \
-    filesystem/int128_builtins.cpp \
-    filesystem/operations.cpp \
-    functional.cpp \
-    future.cpp \
-    hash.cpp \
-    ios.cpp \
-    iostream.cpp \
-    locale.cpp \
-    memory.cpp \
-    mutex.cpp \
-    mutex_destructor.cpp \
-    new.cpp \
-    optional.cpp \
-    random.cpp \
-    regex.cpp \
-    shared_mutex.cpp \
-    stdexcept.cpp \
-    string.cpp \
-    strstream.cpp \
-    system_error.cpp \
-    thread.cpp \
-    typeinfo.cpp \
-    utility.cpp \
-    valarray.cpp \
-    variant.cpp \
-    vector.cpp \
-
-libcxx_sources := $(libcxx_sources:%=src/%)
-
-libcxx_export_cxxflags :=
-
-ifeq (,$(filter clang%,$(NDK_TOOLCHAIN_VERSION)))
-# Add -fno-strict-aliasing because __list_imp::_end_ breaks TBAA rules by declaring
-# simply as __list_node_base then casted to __list_node derived from that.  See
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61571 for details
-libcxx_export_cxxflags += -fno-strict-aliasing
-endif
-
-libcxx_cxxflags := \
-    -std=c++1z \
-    -DLIBCXX_BUILDING_LIBCXXABI \
-    -D_LIBCPP_BUILDING_LIBRARY \
-    -D__STDC_FORMAT_MACROS \
-    $(libcxx_export_cxxflags) \
-
-libcxx_ldflags :=
-libcxx_export_ldflags :=
-
-ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
-    libcxx_cxxflags += -mbranch-protection=standard
-endif
-
-ifneq ($(LIBCXX_FORCE_REBUILD),true)
-
-$(call ndk_log,Using prebuilt libc++ libraries)
-
-libcxxabi_c_includes := $(LOCAL_PATH)/../llvm-libc++abi/include
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := c++_static
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../NOTICE
-LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
-LOCAL_EXPORT_C_INCLUDES := $(libcxx_export_includes)
-LOCAL_STATIC_LIBRARIES := libc++abi
-LOCAL_EXPORT_CPPFLAGS := $(libcxx_export_cxxflags)
-LOCAL_EXPORT_LDFLAGS := $(libcxx_export_ldflags)
-LOCAL_EXPORT_STATIC_LIBRARIES := libc++abi
-
-ifeq ($(NDK_PLATFORM_NEEDS_ANDROID_SUPPORT),true)
-    # This doesn't affect the prebuilt itself since this is a prebuilt library,
-    # but the build system needs to know about the dependency so we can sort the
-    # exported includes properly.
-    LOCAL_STATIC_LIBRARIES += libandroid_support
-    LOCAL_EXPORT_STATIC_LIBRARIES += libandroid_support
-endif
-
-LOCAL_EXPORT_STATIC_LIBRARIES += libunwind
-include $(PREBUILT_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := c++_shared
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../NOTICE
-LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE)$(TARGET_SONAME_EXTENSION)
-LOCAL_EXPORT_C_INCLUDES := \
-    $(libcxx_export_includes) \
-    $(libcxxabi_c_includes) \
-
-LOCAL_EXPORT_CPPFLAGS := $(libcxx_export_cxxflags)
-LOCAL_EXPORT_LDFLAGS := $(libcxx_export_ldflags)
-
-ifeq ($(NDK_PLATFORM_NEEDS_ANDROID_SUPPORT),true)
-    # This doesn't affect the prebuilt itself since this is a prebuilt library,
-    # but the build system needs to know about the dependency so we can sort the
-    # exported includes properly.
-    LOCAL_STATIC_LIBRARIES := libandroid_support
-    LOCAL_EXPORT_STATIC_LIBRARIES := libandroid_support
-endif
-
-LOCAL_EXPORT_STATIC_LIBRARIES += libunwind
-include $(PREBUILT_SHARED_LIBRARY)
-
-$(call import-module, cxx-stl/llvm-libc++abi)
-
-else
-# LIBCXX_FORCE_REBUILD == true
-
-$(call ndk_log,Rebuilding libc++ libraries from sources)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := c++_static
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../NOTICE
-LOCAL_SRC_FILES := $(libcxx_sources)
-LOCAL_C_INCLUDES := $(libcxx_includes)
-LOCAL_CPPFLAGS := $(libcxx_cxxflags) -ffunction-sections -fdata-sections
-LOCAL_CPP_FEATURES := rtti exceptions
-LOCAL_EXPORT_C_INCLUDES := $(libcxx_export_includes)
-LOCAL_EXPORT_CPPFLAGS := $(libcxx_export_cxxflags)
-LOCAL_EXPORT_LDFLAGS := $(libcxx_export_ldflags)
-LOCAL_STATIC_LIBRARIES := libc++abi
-LOCAL_ARM_NEON := false
-
-ifeq ($(NDK_PLATFORM_NEEDS_ANDROID_SUPPORT),true)
-    LOCAL_STATIC_LIBRARIES += android_support
-endif
-
-LOCAL_STATIC_LIBRARIES += libunwind
-LOCAL_EXPORT_STATIC_LIBRARIES += libunwind
-include $(BUILD_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := c++_shared
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../NOTICE
-LOCAL_STRIP_MODE := none
-LOCAL_SRC_FILES := $(libcxx_sources)
-LOCAL_C_INCLUDES := $(libcxx_includes)
-LOCAL_CPPFLAGS := $(libcxx_cxxflags) -fno-function-sections -fno-data-sections
-LOCAL_CPP_FEATURES := rtti exceptions
-LOCAL_WHOLE_STATIC_LIBRARIES := libc++abi
-LOCAL_EXPORT_C_INCLUDES := $(libcxx_export_includes)
-LOCAL_EXPORT_CPPFLAGS := $(libcxx_export_cxxflags)
-LOCAL_EXPORT_LDFLAGS := $(libcxx_export_ldflags)
-ifeq ($(NDK_PLATFORM_NEEDS_ANDROID_SUPPORT),true)
-    LOCAL_STATIC_LIBRARIES := android_support
-endif
-LOCAL_LDFLAGS := $(libcxx_ldflags)
-# Use --as-needed to strip the DT_NEEDED on libstdc++.so (bionic's) that the
-# driver always links for C++ but we don't use.
-# See https://github.com/android-ndk/ndk/issues/105
-LOCAL_LDFLAGS += -Wl,--as-needed
-LOCAL_ARM_NEON := false
-LOCAL_STATIC_LIBRARIES += libunwind
-LOCAL_EXPORT_STATIC_LIBRARIES += libunwind
-
-# But only need -latomic for armeabi.
-ifeq ($(TARGET_ARCH_ABI),armeabi)
-    LOCAL_LDLIBS += -latomic
-endif
-include $(BUILD_SHARED_LIBRARY)
-
-$(call import-add-path, $(LOCAL_PATH)/../../..)
-$(call import-module, toolchain/llvm-project/libcxxabi)
-
-endif # LIBCXX_FORCE_REBUILD == true
-
-$(call import-module, android/support)
diff --git a/current/sources/cxx-stl/llvm-libc++/include/complex b/current/sources/cxx-stl/llvm-libc++/include/complex
index 92295be..36c66db 100644
--- a/current/sources/cxx-stl/llvm-libc++/include/complex
+++ b/current/sources/cxx-stl/llvm-libc++/include/complex
@@ -244,6 +244,7 @@
 #include <stdexcept>
 #include <cmath>
 #include <iosfwd>
+#include <sstream>
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -1441,7 +1442,12 @@
 basic_ostream<_CharT, _Traits>&
 operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
 {
-    return __os << '(' << __x.real() << ',' << __x.imag() << ')';
+    basic_ostringstream<_CharT, _Traits> __s;
+    __s.flags(__os.flags());
+    __s.imbue(__os.getloc());
+    __s.precision(__os.precision());
+    __s << '(' << __x.real() << ',' << __x.imag() << ')';
+    return __os << __s.str();
 }
 
 #if _LIBCPP_STD_VER > 11
diff --git a/current/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h b/current/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h
index dd1c088..b49baea 100644
--- a/current/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h
+++ b/current/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h
@@ -25,21 +25,15 @@
 
 #if defined(__ANDROID__)
 
+#include <android/api-level.h>
 #if __ANDROID_API__ < 21
 #include <support/xlocale/__posix_l_fallback.h>
 #endif
 
-// HACK: Not in upstream NDK or libc++.
-// Upstream now supports using ToT libc++ with old NDKs, but as such it is now
-// *only* compatible with the NDK. That will need to be fixed both for the
-// platorm and for the NDK-in-platform use case since neither has
-// android/ndk-version.h.
-
 // If we do not have this header, we are in a platform build rather than an NDK
 // build, which will always be at least as new as the ToT NDK, in which case we
 // don't need any of the inlines below since libc provides them.
 #if __has_include(<android/ndk-version.h>)
-#include <android/api-level.h>
 #include <android/ndk-version.h>
 // In NDK versions later than 16, locale-aware functions are provided by
 // legacy_stdlib_inlines.h
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so b/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so
index 564577c..7c89b54 100755
--- a/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so
+++ b/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a b/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a
index 7984b03..87d83f6 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++abi.a b/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++abi.a
index c4b888f..1aabbec 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++abi.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++abi.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libunwind.a b/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libunwind.a
index ea80bd5..acbf9b2 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libunwind.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libunwind.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a
index 9b19f69..a1081b2 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so
index 4ea68ae..10603aa 100755
--- a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so
+++ b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a
index 75c26c5..73caf4d 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++abi.a b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++abi.a
index 1b65ee5..393da49 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++abi.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++abi.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a
index c5baa54..154f5b2 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86/libandroid_support.a b/current/sources/cxx-stl/llvm-libc++/libs/x86/libandroid_support.a
index 5e44e56..0da9289 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/x86/libandroid_support.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/x86/libandroid_support.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so b/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so
index 1dba175..831e778 100755
--- a/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so
+++ b/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a b/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a
index d23c1f8..6706352 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++_static.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++abi.a b/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++abi.a
index 11d3a14..726aac5 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++abi.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/x86/libc++abi.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86/libunwind.a b/current/sources/cxx-stl/llvm-libc++/libs/x86/libunwind.a
index e7cbc69..5cb304b 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/x86/libunwind.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/x86/libunwind.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so b/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so
index 02d8bfa..6d94e6a 100755
--- a/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so
+++ b/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a b/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a
index b002a5f..7a89528 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_static.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++abi.a b/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++abi.a
index f57c1d0..74941a3 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++abi.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++abi.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libunwind.a b/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libunwind.a
index fc8617b..9163bd4 100644
--- a/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libunwind.a
+++ b/current/sources/cxx-stl/llvm-libc++/libs/x86_64/libunwind.a
Binary files differ
diff --git a/current/sources/cxx-stl/llvm-libc++abi/Android.mk b/current/sources/cxx-stl/llvm-libc++abi/Android.mk
deleted file mode 100644
index d53ef31..0000000
--- a/current/sources/cxx-stl/llvm-libc++abi/Android.mk
+++ /dev/null
@@ -1,112 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-libcxxabi_src_files := \
-    src/abort_message.cpp \
-    src/cxa_aux_runtime.cpp \
-    src/cxa_default_handlers.cpp \
-    src/cxa_demangle.cpp \
-    src/cxa_exception.cpp \
-    src/cxa_exception_storage.cpp \
-    src/cxa_guard.cpp \
-    src/cxa_handlers.cpp \
-    src/cxa_personality.cpp \
-    src/cxa_thread_atexit.cpp \
-    src/cxa_unexpected.cpp \
-    src/cxa_vector.cpp \
-    src/cxa_virtual.cpp \
-    src/fallback_malloc.cpp \
-    src/private_typeinfo.cpp \
-    src/stdlib_exception.cpp \
-    src/stdlib_new_delete.cpp \
-    src/stdlib_stdexcept.cpp \
-    src/stdlib_typeinfo.cpp \
-
-libcxxabi_includes := \
-    $(LOCAL_PATH)/include \
-    $(LOCAL_PATH)/../libcxx/include \
-
-libcxxabi_cflags := -D__STDC_FORMAT_MACROS
-libcxxabi_cppflags := -std=c++11 -Wno-unknown-attributes -DHAS_THREAD_LOCAL
-libcxxabi_cppflags += -DLIBCXXABI_USE_LLVM_UNWINDER=1
-
-ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
-    libcxxabi_cppflags += -mbranch-protection=standard
-endif
-
-ifneq ($(LIBCXX_FORCE_REBUILD),true) # Using prebuilt
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libc++abi
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT SPDX-license-identifier-NCSA
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE.TXT $(LOCAL_PATH)/NOTICE
-LOCAL_SRC_FILES := ../llvm-libc++/libs/$(TARGET_ARCH_ABI)/$(LOCAL_MODULE)$(TARGET_LIB_EXTENSION)
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
-
-# Unlike the platform build, ndk-build will actually perform dependency checking
-# on static libraries and topologically sort them to determine link order.
-# Though there is no link step, without this we may link libunwind before
-# libc++abi, which won't succeed.
-LOCAL_STATIC_LIBRARIES += libunwind
-LOCAL_EXPORT_STATIC_LIBRARIES := libunwind
-include $(PREBUILT_STATIC_LIBRARY)
-
-else # Building
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := libc++abi
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT SPDX-license-identifier-NCSA
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE.TXT $(LOCAL_PATH)/NOTICE
-LOCAL_SRC_FILES := $(libcxxabi_src_files)
-LOCAL_C_INCLUDES := $(libcxxabi_includes)
-LOCAL_CPPFLAGS := $(libcxxabi_cppflags)
-LOCAL_CPP_FEATURES := rtti exceptions
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
-LOCAL_ARM_NEON := false
-
-ifeq ($(NDK_PLATFORM_NEEDS_ANDROID_SUPPORT),true)
-    # This doesn't affect the prebuilt itself since this is a prebuilt library,
-    # but the build system needs to know about the dependency so we can sort the
-    # exported includes properly.
-    LOCAL_STATIC_LIBRARIES += libandroid_support
-endif
-
-# Unlike the platform build, ndk-build will actually perform dependency checking
-# on static libraries and topologically sort them to determine link order.
-# Though there is no link step, without this we may link libunwind before
-# libc++abi, which won't succeed.
-LOCAL_STATIC_LIBRARIES += libunwind
-LOCAL_EXPORT_STATIC_LIBRARIES := libunwind
-include $(BUILD_STATIC_LIBRARY)
-
-endif # Prebuilt/building
-
-# Define a prebuilt module for libunwind.a so that ndk-build adds it to the
-# linker command-line before any shared libraries, ensuring that the unwinder
-# is linked statically even if a shared library dependency exports an unwinder.
-include $(CLEAR_VARS)
-LOCAL_MODULE := libunwind
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT SPDX-license-identifier-NCSA
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE.TXT $(LOCAL_PATH)/NOTICE
-LOCAL_SRC_FILES := $(NDK_TOOLCHAIN_LIB_DIR)/$(TARGET_TOOLCHAIN_ARCH_LIB_DIR)/libunwind.a
-include $(PREBUILT_STATIC_LIBRARY)
-
-$(call import-module, android/support)
diff --git a/current/sources/cxx-stl/llvm-libc++abi/src/cxa_exception.cpp b/current/sources/cxx-stl/llvm-libc++abi/src/cxa_exception.cpp
index ebb05ce..09813e8 100644
--- a/current/sources/cxx-stl/llvm-libc++abi/src/cxa_exception.cpp
+++ b/current/sources/cxx-stl/llvm-libc++abi/src/cxa_exception.cpp
@@ -341,8 +341,11 @@
 According to ARM EHABI 8.4.1, __cxa_end_cleanup() should not clobber any
 register, thus we have to write this function in assembly so that we can save
 {r1, r2, r3}.  We don't have to save r0 because it is the return value and the
-first argument to _Unwind_Resume().  In addition, we are saving r4 in order to
-align the stack to 16 bytes, even though it is a callee-save register.
+first argument to _Unwind_Resume().  The function also saves/restores r4 to
+keep the stack aligned and to provide a temp register.  _Unwind_Resume never
+returns and we need to keep the original lr so just branch to it.  When
+targeting bare metal, the function also clobbers ip/r12 to hold the address of
+_Unwind_Resume, which may be too far away for an ordinary branch.
 */
 __attribute__((used)) static _Unwind_Exception *
 __cxa_end_cleanup_impl()
@@ -372,19 +375,29 @@
     return &exception_header->unwindHeader;
 }
 
-asm (
-    "	.pushsection	.text.__cxa_end_cleanup,\"ax\",%progbits\n"
+asm("	.pushsection	.text.__cxa_end_cleanup,\"ax\",%progbits\n"
     "	.globl	__cxa_end_cleanup\n"
     "	.type	__cxa_end_cleanup,%function\n"
     "__cxa_end_cleanup:\n"
+#if defined(__ARM_FEATURE_BTI_DEFAULT)
+    "	bti\n"
+#endif
     "	push	{r1, r2, r3, r4}\n"
+    "	mov	r4, lr\n"
     "	bl	__cxa_end_cleanup_impl\n"
+    "	mov	lr, r4\n"
+#if defined(LIBCXXABI_BAREMETAL)
+    "	ldr	r4,	=_Unwind_Resume\n"
+    "	mov	ip,	r4\n"
+#endif
     "	pop	{r1, r2, r3, r4}\n"
-    "	bl	_Unwind_Resume\n"
-    "	bl	abort\n"
-    "	.popsection"
-);
-#endif  // defined(_LIBCXXABI_ARM_EHABI)
+#if defined(LIBCXXABI_BAREMETAL)
+    "	bx	ip\n"
+#else
+    "	b	_Unwind_Resume\n"
+#endif
+    "	.popsection");
+#endif // defined(_LIBCXXABI_ARM_EHABI)
 
 /*
 This routine can catch foreign or native exceptions.  If native, the exception