Index: source/Host/common/Socket.cpp =================================================================== --- source/Host/common/Socket.cpp +++ source/Host/common/Socket.cpp @@ -24,7 +24,11 @@ #include #include #include -#endif +#ifdef __arm__ +#include +#include +#endif // __arm__ +#endif // __ANDROID_NDK__ #ifndef LLDB_DISABLE_POSIX #include @@ -70,7 +74,14 @@ NativeSocket Accept(NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, bool child_processes_inherit) { -#ifdef SOCK_CLOEXEC +#if defined(__ANDROID_NDK__) && defined(__arm__) + // Temporary workaround for statically linking Android lldb-server with the + // latest API. + int fd = syscall(__NR_accept, sockfd, addr, addrlen); + if (fd >= 0 && !child_processes_inherit) + fcntl(fd, F_SETFD, FD_CLOEXEC); + return fd; +#elif defined(SOCK_CLOEXEC) int flags = 0; if (!child_processes_inherit) { flags |= SOCK_CLOEXEC;