aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/impl/codegen/port_platform.h
diff options
context:
space:
mode:
authorGravatar kwasimensah <kmensah@google.com>2017-11-01 16:38:44 -0400
committerGravatar GitHub <noreply@github.com>2017-11-01 16:38:44 -0400
commit685b5d459f3aedce9a1fb15fae6481b8a585d961 (patch)
treeb7cc9fdebb9360666b9c2563f32a5796a1c20cd9 /include/grpc/impl/codegen/port_platform.h
parent1a671dea71b133848017e4ab001bfeae6b009ab0 (diff)
Fixing port_platform
Copy over Absl macro to deal with C++/C differences.
Diffstat (limited to 'include/grpc/impl/codegen/port_platform.h')
-rw-r--r--include/grpc/impl/codegen/port_platform.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h
index 7dde5c6119..c2ec85d78d 100644
--- a/include/grpc/impl/codegen/port_platform.h
+++ b/include/grpc/impl/codegen/port_platform.h
@@ -297,12 +297,26 @@
#endif
#endif /* GPR_NO_AUTODETECT_PLATFORM */
-#include "absl/base/config.h"
-
-#if !defined(ABSL_HAVE_TLS) && defined(GPR_GCC_TLS)
+/*
+ * There are platforms for which TLS should not be used even though the compiler
+ * makes it seem like it's supported (Android NDK < r12b for example).
+ * This is primarily because of linker problems and toolchain misconfiguration:
+ * TLS isn't supported until NDK r12b per
+ * https://developer.android.com/ndk/downloads/revision_history.html
+ * Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in
+ * <android/ndk-version.h>. For NDK < r16, users should define these macros,
+ * e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11. */
+#if defined(__ANDROID__) && defined(__clang__) && defined(GPR_GCC_TLS)
+#if __has_include(<android/ndk-version.h>)
+#include <android/ndk-version.h>
+#endif /* __has_include(<android/ndk-version.h>) */
+#if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \
+ defined(__NDK_MINOR__) && \
+ ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1)))
#undef GPR_GCC_TLS
#define GPR_PTHREAD_TLS 1
-#endif //!defined(ABSL_HAVE_TLS) && defined(GPR_GCC_TLS)
+#endif
+#endif /* defined(__ANDROID__) && defined(__clang__) && defined(GPR_GCC_TLS) */
#if defined(__has_include)
#if __has_include(<atomic>)