diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-11 05:10:48 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-11 05:10:48 +0000 |
commit | c8085e1999dd88f53e1e85e8a6d7647b33f061b0 (patch) | |
tree | e367f62fc1cb8af65bb8f2bbcbf5e6c3fa294408 | |
parent | b93499b297ace5c5e48006aaf9537b4efbecf802 (diff) | |
parent | 051d5d468622de1741fc3f5013ad45597a16b50e (diff) | |
download | ndk-c8085e1999dd88f53e1e85e8a6d7647b33f061b0.tar.gz |
Snap for 8570526 from 051d5d468622de1741fc3f5013ad45597a16b50e to mainline-mediaprovider-release
Change-Id: Ic0e1a6449d54961c2fda7dbf385a45f1b29ac9a9
37 files changed, 325 insertions, 827 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..a81c8ee12 --- /dev/null +++ b/.gitignore @@ -0,0 +1,138 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ diff --git a/Android.bp b/Android.bp index dba243ef7..75a461c5e 100644 --- a/Android.bp +++ b/Android.bp @@ -38,10 +38,9 @@ libcxx_includes = [ ndk_prebuilt_static_stl { name: "ndk_libandroid_support", - // libandroid_support headers are exported by libc++ rather than by - // libandroid_support itself because it's the only way we can enforce the - // correct ordering of the includes (libc++ first, libandroid_support - // second). + export_include_dirs: [ + "current/sources/android/support/include", + ], arch: { arm64: { enabled: false, @@ -65,26 +64,12 @@ ndk_prebuilt_static_stl { ndk_prebuilt_static_stl { name: "ndk_libc++_static", export_include_dirs: libcxx_includes, - multilib: { - lib32: { - export_include_dirs: [ - "current/sources/android/support/include", - ], - }, - }, min_sdk_version: "16", } ndk_prebuilt_shared_stl { name: "ndk_libc++_shared", export_include_dirs: libcxx_includes, - multilib: { - lib32: { - export_include_dirs: [ - "current/sources/android/support/include", - ], - }, - } } cc_library_static { diff --git a/current/source.properties b/current/source.properties index 1fbecca6d..d7470d43f 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 7b53d2318..000000000 --- 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 6dae30c21..7569d3e5d 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 @@ cpulist_read_from(CpuList* list, const char* filename) 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 @@ android_cpuInitFamily(void) 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 @@ android_cpuInit(void) } /* 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 @@ android_cpuInit(void) } /* 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 @@ android_cpuInit(void) #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 @@ android_cpuInit(void) #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 a41b80f38..000000000 --- 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 7cefed18e..000000000 --- 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 834ab9170..518243418 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 8c29c6b47..000000000 --- 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 e52e8ce58..43c47f303 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 cf7abbbf5..000000000 --- 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 bf090b0d2..000000000 --- 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 9c19a9ac9..000000000 --- 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 92295be97..36c66db50 100644 --- a/current/sources/cxx-stl/llvm-libc++/include/complex +++ b/current/sources/cxx-stl/llvm-libc++/include/complex @@ -244,6 +244,7 @@ template<class T, class charT, class traits> #include <stdexcept> #include <cmath> #include <iosfwd> +#include <sstream> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -1441,7 +1442,12 @@ template<class _Tp, class _CharT, class _Traits> 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 dd1c088f4..b49baea05 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 @@ extern "C" { #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 Binary files differindex 564577c3c..7c89b544b 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 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 Binary files differindex 7984b03f2..87d83f629 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 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 Binary files differindex c4b888fca..1aabbec7b 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 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 Binary files differindex ea80bd52f..acbf9b227 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 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 Binary files differindex 9b19f69c1..a1081b223 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 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 Binary files differindex 4ea68ae71..10603aa77 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 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 Binary files differindex 75c26c52f..73caf4d72 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 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 Binary files differindex 1b65ee568..393da49fb 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 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 Binary files differindex c5baa54bf..154f5b271 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 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 Binary files differindex 5e44e56e8..0da92895f 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 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 Binary files differindex 1dba17529..831e77881 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 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 Binary files differindex d23c1f823..670635276 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 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 Binary files differindex 11d3a14b1..726aac546 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 diff --git a/current/sources/cxx-stl/llvm-libc++/libs/x86/libunwind.a b/current/sources/cxx-stl/llvm-libc++/libs/x86/libunwind.a Binary files differindex e7cbc692e..5cb304b52 100644 --- a/current/sources/cxx-stl/llvm-libc++/libs/x86/libunwind.a +++ b/current/sources/cxx-stl/llvm-libc++/libs/x86/libunwind.a 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 Binary files differindex 02d8bfae5..6d94e6a7d 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 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 Binary files differindex b002a5f78..7a895284d 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 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 Binary files differindex f57c1d0fd..74941a373 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 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 Binary files differindex fc8617b81..9163bd48c 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 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 d53ef3185..000000000 --- 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 ebb05ce54..09813e851 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 @@ unwinding with _Unwind_Resume. 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 @@ __cxa_end_cleanup_impl() 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 @@ -1,11 +1,22 @@ +[MASTER] +jobs = 0 + [MESSAGES CONTROL] -disable=missing-docstring,fixme,locally-disabled +disable=missing-docstring +ignore=ndk-gdb.py [BASIC] -# Good variable names which should always be accepted, separated by a comma good-names=i,j,k,ex,Run,_ +[VARIABLES] +dummy-variables-rgx=_ + +[SIMILARITIES] +ignore-imports=yes [FORMAT] -max-line-length=79 +max-line-length=88 +ignore-long-lines=(?x)( + ^\s*(\#\ )?<?https?://\S+>?$| + ^\s*\#\ \S+$) @@ -15,16 +15,16 @@ # limitations under the License. # import argparse -import glob import logging import os +from pathlib import Path import shutil import subprocess from tempfile import TemporaryDirectory import textwrap -THIS_DIR = os.path.realpath(os.path.dirname(__file__)) +THIS_DIR = Path(__file__).resolve().parent def logger(): @@ -32,153 +32,212 @@ def logger(): def check_call(cmd): - logger().debug('Running `%s`', ' '.join(cmd)) + logger().debug("Running `%s`", " ".join(cmd)) subprocess.check_call(cmd) def remove(path): - logger().debug('remove `%s`', path) + logger().debug("remove `%s`", path) os.remove(path) -def fetch_artifact(branch, build, pattern): - fetch_artifact_path = '/google/data/ro/projects/android/fetch_artifact' - cmd = [fetch_artifact_path, '--branch', branch, '--target=linux', - '--bid', build, pattern] +def fetch_artifact(branch: str, build: str, pattern: str) -> None: + """Fetches an artifact from the build server. + + Use OAuth2 authentication and the gLinux android-fetch-artifact package, + which work with both on-corp and off-corp workstations.""" + fetch_artifact_path = shutil.which("fetch_artifact") + if fetch_artifact_path is None: + raise RuntimeError( + "error: cannot find fetch_artifact in PATH. Install it using:\n" + " sudo glinux-add-repo android\n" + " sudo apt update\n" + " sudo apt install android-fetch-artifact\n" + ) + cmd = [ + fetch_artifact_path, + "--use_oauth2", + "--branch", + branch, + "--target=linux", + "--bid", + build, + pattern, + ] check_call(cmd) def api_str(api_level): - return 'android-{}'.format(api_level) + return f"android-{api_level}" def start_branch(build): - branch_name = 'update-' + (build or 'latest') - logger().info('Creating branch %s', branch_name) - check_call(['repo', 'start', branch_name, '.']) + branch_name = "update-" + (build or "latest") + logger().info("Creating branch %s", branch_name) + check_call(["repo", "start", branch_name, "."]) -def remove_old_release(install_dir): - if os.path.exists(os.path.join(install_dir, '.git')): +def remove_old_release(install_dir: Path) -> None: + if (install_dir / ".git").exists(): logger().info('Removing old install directory "%s"', install_dir) - check_call(['git', 'rm', '-rf', install_dir]) + check_call(["git", "rm", "-rf", install_dir]) # Need to check again because git won't remove directories if they have # non-git files in them. - if os.path.exists(install_dir): + if install_dir.exists(): shutil.rmtree(install_dir) -LIBUNWIND_GLOB = ( - 'toolchains/llvm/prebuilt/*/lib64/clang/*/lib/linux/*/libunwind.a' +LIBUNWIND_GLOB = "toolchains/llvm/prebuilt/*/lib64/clang/*/lib/linux/*/libunwind.a" +LIBCXX_SHARED_GLOB = ( + "toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/*/libc++_shared.so" ) +LIBCXX_STATIC_GLOB = ( + "toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/*/libc++_static.a" +) +LIBCXXABI_GLOB = "toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/*/libc++abi.a" -def unzip_single_directory(artifact, destination): +def unzip_single_directory(artifact: Path, destination: Path) -> None: # Use cwd so that we can use rename without having to worry about crossing # file systems. with TemporaryDirectory(dir=os.getcwd()) as temp_dir: cmd = [ - 'unzip', - artifact, - '-d', + "unzip", + str(artifact), + "-d", temp_dir, - '*/sources/android/cpufeatures/*', - '*/sources/android/native_app_glue/*', - '*/sources/android/support/*', - '*/sources/cxx-stl/*', - '*/source.properties', - os.path.join('*', LIBUNWIND_GLOB), + "*/sources/android/cpufeatures/*", + "*/sources/android/native_app_glue/*", + "*/sources/android/support/*", + "*/sources/cxx-stl/*", + "*/source.properties", + os.path.join("*", LIBUNWIND_GLOB), + os.path.join("*", LIBCXX_SHARED_GLOB), + os.path.join("*", LIBCXX_STATIC_GLOB), + os.path.join("*", LIBCXXABI_GLOB), ] check_call(cmd) dirs = os.listdir(temp_dir) assert len(dirs) == 1 - ndk_dir = os.path.join(temp_dir, dirs[0]) - for child in os.listdir(ndk_dir): - os.rename(os.path.join(ndk_dir, child), - os.path.join(destination, child)) - - -def relocate_libunwind(install_dir): - unwinds = glob.glob(os.path.join(install_dir, LIBUNWIND_GLOB)) - dest_base = os.path.join(install_dir, 'sources/cxx-stl/llvm-libc++/libs') - for libunwind in unwinds: - arch = os.path.basename(os.path.dirname(libunwind)) + ndk_dir = Path(temp_dir) / dirs[0] + for child in ndk_dir.iterdir(): + child.rename(destination / child.name) + + +def relocate_libcxx(install_dir: Path) -> None: + """Copies the libc++ libraries from the toolchain to sources. + + New versions of the NDK have removed the libraries in the sources directory because + they are duplicates and they aren't needed in typical builds. Soong still expects to + find them in that directory though. We could fix Soong, but since this whole + directory should be dead soon we'll just fix-up the install for now. + """ + dest_base = install_dir / "sources/cxx-stl/llvm-libc++/libs" + for glob in {LIBCXX_SHARED_GLOB, LIBCXX_STATIC_GLOB, LIBCXXABI_GLOB}: + file_name = Path(glob).name + for file_path in install_dir.glob(glob): + triple = file_path.parent.name + abi = { + "arm-linux-androideabi": "armeabi-v7a", + "aarch64-linux-android": "arm64-v8a", + "i686-linux-android": "x86", + "x86_64-linux-android": "x86_64", + }[triple] + dest_dir = dest_base / abi + dest_dir.mkdir(parents=True, exist_ok=True) + dest = dest_dir / file_name + logger().info("Relocating %s to %s", file_path, dest) + file_path.rename(dest) + + +def relocate_libunwind(install_dir: Path) -> None: + dest_base = install_dir / "sources/cxx-stl/llvm-libc++/libs" + for libunwind in install_dir.glob(LIBUNWIND_GLOB): + arch = libunwind.parent.name abi = { - 'arm': 'armeabi-v7a', - 'aarch64': 'arm64-v8a', - 'i386': 'x86', - 'x86_64': 'x86_64', + "arm": "armeabi-v7a", + "aarch64": "arm64-v8a", + "i386": "x86", + "x86_64": "x86_64", }[arch] - dest_dir = os.path.join(dest_base, abi) - dest = os.path.join(dest_dir, 'libunwind.a') - logger().info('Relocating %s to %s', libunwind, dest) - os.rename(libunwind, dest) + dest_dir = dest_base / abi + dest = dest_dir / "libunwind.a" + logger().info("Relocating %s to %s", libunwind, dest) + libunwind.rename(dest) -def install_new_release(branch, build, install_dir): - os.makedirs(install_dir) +def delete_android_mks(install_dir: Path) -> None: + for android_mk in install_dir.glob("**/Android.mk"): + android_mk.unlink() - artifact_pattern = 'android-ndk-*.zip' - logger().info('Fetching %s from %s (artifacts matching %s)', build, branch, - artifact_pattern) + +def install_new_release(branch: str, build: str, install_dir: Path) -> None: + install_dir.mkdir() + + artifact_pattern = "android-ndk-*.zip" + logger().info( + "Fetching %s from %s (artifacts matching %s)", build, branch, artifact_pattern + ) fetch_artifact(branch, build, artifact_pattern) - artifacts = glob.glob('android-ndk-*.zip') + artifacts = list(Path().glob("android-ndk-*.zip")) try: assert len(artifacts) == 1 artifact = artifacts[0] - logger().info('Extracting release') + logger().info("Extracting release") unzip_single_directory(artifact, install_dir) + relocate_libcxx(install_dir) relocate_libunwind(install_dir) + delete_android_mks(install_dir) finally: for artifact in artifacts: - os.unlink(artifact) + artifact.unlink() -def commit(branch, build, install_dir): - logger().info('Making commit') - check_call(['git', 'add', install_dir]) - message = textwrap.dedent("""\ +def commit(branch: str, build: str, install_dir: Path) -> None: + logger().info("Making commit") + check_call(["git", "add", str(install_dir)]) + message = textwrap.dedent( + f"""\ Update NDK prebuilts to build {build}. Taken from branch {branch}. Bug: None Test: treehugger - """).format(branch=branch, build=build) - check_call(['git', 'commit', '-m', message]) + """ + ) + check_call(["git", "commit", "-m", message]) def get_args(): parser = argparse.ArgumentParser() parser.add_argument( - '-b', '--branch', default='master-ndk', - help='Branch to pull build from.') - parser.add_argument( - 'major_release', help='Major release being installed, e.g. "r11".') - parser.add_argument('--build', required=True, help='Build number to pull.') + "-b", "--branch", default="master-ndk", help="Branch to pull build from." + ) + parser.add_argument("--build", required=True, help="Build number to pull.") parser.add_argument( - '--use-current-branch', action='store_true', - help='Perform the update in the current branch. Do not repo start.') + "--use-current-branch", + action="store_true", + help="Perform the update in the current branch. Do not repo start.", + ) parser.add_argument( - '-v', '--verbose', action='count', default=0, - help='Increase output verbosity.') + "-v", "--verbose", action="count", default=0, help="Increase output verbosity." + ) return parser.parse_args() -def main(): +def main() -> None: os.chdir(THIS_DIR) args = get_args() verbose_map = (logging.WARNING, logging.INFO, logging.DEBUG) - verbosity = args.verbose - if verbosity > 2: - verbosity = 2 + verbosity = min(args.verbose, 2) logging.basicConfig(level=verbose_map[verbosity]) - install_dir = os.path.realpath(args.major_release) + install_dir = THIS_DIR / "current" if not args.use_current_branch: start_branch(args.build) @@ -187,5 +246,5 @@ def main(): commit(args.branch, args.build, install_dir) -if __name__ == '__main__': +if __name__ == "__main__": main() |