diff options
author | kwasimensah <kmensah@google.com> | 2017-10-27 12:35:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-27 12:35:55 -0400 |
commit | 1194782c420bf4c2b4970a460fb2bb5d199441b5 (patch) | |
tree | 9120821e59988a36e15de8e155f7f39730d1c029 /include/grpc/impl/codegen/port_platform.h | |
parent | 21c6405dea681e7880ac96f37208491bfd603d45 (diff) |
Add logic to work around buggy Android NDKs
Old version of the Android NDK have linker issues with thread local support https://github.com/android-ndk/ndk/issues/8 and isn't actually fixed until r12b https://developer.android.com/ndk/downloads/revision_history.html. ABSL's config.h is being updated to catch this case and having gRPC rely on that will make sure it also gets the fix (rather than repeating a somewhat lengthy macro).
Since gRPC already has a dependency on ABSL, I figured this wouldn't be an issue.
Diffstat (limited to 'include/grpc/impl/codegen/port_platform.h')
-rw-r--r-- | include/grpc/impl/codegen/port_platform.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index fb4bfc3162..324dbe0903 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -297,6 +297,22 @@ #endif #endif /* GPR_NO_AUTODETECT_PLATFORM */ +// Android specifc logic to detect brokeness around TLS support. +#if defined(__ANDROID__) && defined(__clang__) +#include "third_party/absl/base/config.h" + +#if !defined(ABSL_HAVE_TLS) && defined(GPR_GCC_TLS) +#undef GPR_GCC_TLS +#define GPR_PTHREAD_TLS 1 +#endif //!defined(ABSL_HAVE_TLS) && defined(GPR_GCC_TLS) + +// cpu_posix.cc depends on TLS and cpu_linux.cc doesn't. +#if !defined(GPR_GCC_TLS) && defined(GPR_CPU_POSIX) +#undef GPR_CPU_POSIX +#define GPR_CPU_LINUX 1 +#endif //! defined(GPR_GCC_TLS) && defined(GPR_CPU_POSIX) +#endif // defined(__ANDROID__) && defined(__clang__) + #if defined(__has_include) #if __has_include(<atomic>) #define GRPC_HAS_CXX11_ATOMIC |