From df979f7219dc0188aefb413ee7e14f618979eb24 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Fri, 30 Jun 2017 22:22:17 +0200 Subject: [PATCH] NDK unified headers patch for string.h See https://github.com/android-ndk/ndk/issues/440 Fixes gdb build with unified headers. --- ndk_patches_unified/string.h.patch | 44 ++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/ndk_patches_unified/string.h.patch b/ndk_patches_unified/string.h.patch index 141bb8e1f..44b2b5c7b 100644 --- a/ndk_patches_unified/string.h.patch +++ b/ndk_patches_unified/string.h.patch @@ -1,9 +1,41 @@ -diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/string.h ./usr/include/string.h ---- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/string.h 2014-12-02 22:38:31.000000000 -0500 -+++ ./usr/include/string.h 2015-05-08 23:00:18.591924680 -0400 -@@ -289,6 +289,14 @@ +See https://github.com/android-ndk/ndk/issues/440 + +diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/string.h ./usr/include/string.h +--- /home/fornwall/lib/android-ndk/sysroot/usr/include/string.h 2017-06-20 17:41:56.000000000 +0200 ++++ ./usr/include/string.h 2017-06-30 22:15:01.161342640 +0200 +@@ -74,12 +74,12 @@ + #endif /* __ANDROID_API__ >= 18 */ - #endif /* defined(__BIONIC_FORTIFY) */ + #if defined(__USE_GNU) ++#if __ANDROID_API__ >= 24 + #if defined(__cplusplus) + extern "C++" char* strchrnul(char* _Nonnull, int) __RENAME(strchrnul) __attribute_pure__; + extern "C++" const char* strchrnul(const char* _Nonnull, int) __RENAME(strchrnul) __attribute_pure__; + #else + +-#if __ANDROID_API__ >= 24 + char* strchrnul(const char* _Nonnull, int) __attribute_pure__ __INTRODUCED_IN(24); + #endif /* __ANDROID_API__ >= 24 */ + +@@ -169,6 +169,7 @@ + #endif + + #if defined(__USE_GNU) && !defined(basename) ++#if __ANDROID_API__ >= 23 + /* + * glibc has a basename in that's different to the POSIX one in . + * It doesn't modify its argument, and in C++ it's const-correct. +@@ -178,7 +179,6 @@ + extern "C++" const char* basename(const char* _Nonnull) __RENAME(__gnu_basename); + #else + +-#if __ANDROID_API__ >= 23 + char* basename(const char* _Nonnull) __RENAME(__gnu_basename) __INTRODUCED_IN(23); + #endif /* __ANDROID_API__ >= 23 */ + +@@ -737,6 +737,14 @@ + #pragma clang diagnostic pop + #endif +/* Termux: Patched support for GNU extension function mempcpy(3): */ +#if defined(_GNU_SOURCE) && defined(TERMUX_EXPOSE_MEMPCPY) @@ -15,4 +47,4 @@ diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/incl + __END_DECLS - #endif /* _STRING_H_ */ + #endif /* _STRING_H */