cmake: Enable process_vm_readv detection on android

Only android and linux can have this function as far as I am aware, but
it seems cleaner to enable this code for all platforms.

llvm-svn: 304405
This commit is contained in:
Pavel Labath 2017-06-01 11:20:17 +00:00
parent 251ea8a4f8
commit 02f290f652
1 changed files with 18 additions and 20 deletions

View File

@ -334,28 +334,26 @@ if (HAVE_LIBDL)
list(APPEND system_libs ${CMAKE_DL_LIBS})
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
# Check for syscall used by lldb-server on linux.
# If these are not found, it will fall back to ptrace (slow) for memory reads.
check_cxx_source_compiles("
#include <sys/uio.h>
int main() { process_vm_readv(0, nullptr, 0, nullptr, 0, 0); return 0; }"
HAVE_PROCESS_VM_READV)
# Check for syscall used by lldb-server on linux.
# If these are not found, it will fall back to ptrace (slow) for memory reads.
check_cxx_source_compiles("
#include <sys/uio.h>
int main() { process_vm_readv(0, nullptr, 0, nullptr, 0, 0); return 0; }"
HAVE_PROCESS_VM_READV)
if (HAVE_PROCESS_VM_READV)
add_definitions(-DHAVE_PROCESS_VM_READV)
else()
# If we don't have the syscall wrapper function, but we know the syscall number, we can
# still issue the syscall manually
check_cxx_source_compiles("
#include <sys/syscall.h>
int main() { return __NR_process_vm_readv; }"
HAVE_NR_PROCESS_VM_READV)
if (HAVE_PROCESS_VM_READV)
add_definitions(-DHAVE_PROCESS_VM_READV)
else()
# If we don't have the syscall wrapper function, but we know the syscall number, we can
# still issue the syscall manually
check_cxx_source_compiles("
#include <sys/syscall.h>
int main() { return __NR_process_vm_readv; }"
HAVE_NR_PROCESS_VM_READV)
if (HAVE_NR_PROCESS_VM_READV)
add_definitions(-DHAVE_NR_PROCESS_VM_READV)
endif()
endif()
if (HAVE_NR_PROCESS_VM_READV)
add_definitions(-DHAVE_NR_PROCESS_VM_READV)
endif()
endif()
# Figure out if lldb could use lldb-server. If so, then we'll