Index: llvm/trunk/cmake/config-ix.cmake =================================================================== --- llvm/trunk/cmake/config-ix.cmake +++ llvm/trunk/cmake/config-ix.cmake @@ -252,12 +252,15 @@ # This check requires _GNU_SOURCE check_symbol_exists(sched_getaffinity sched.h HAVE_SCHED_GETAFFINITY) check_symbol_exists(CPU_COUNT sched.h HAVE_CPU_COUNT) -if(HAVE_LIBPTHREAD) - check_library_exists(pthread pthread_getname_np "" HAVE_PTHREAD_GETNAME_NP) - check_library_exists(pthread pthread_setname_np "" HAVE_PTHREAD_SETNAME_NP) -elseif(PTHREAD_IN_LIBC) - check_library_exists(c pthread_getname_np "" HAVE_PTHREAD_GETNAME_NP) - check_library_exists(c pthread_setname_np "" HAVE_PTHREAD_SETNAME_NP) +if (NOT PURE_WINDOWS) + if (LLVM_PTHREAD_LIB) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB}) + endif() + check_symbol_exists(pthread_getname_np pthread.h HAVE_PTHREAD_GETNAME_NP) + check_symbol_exists(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP) + if (LLVM_PTHREAD_LIB) + list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB}) + endif() endif() # available programs checks Index: llvm/trunk/lib/Support/Unix/Threading.inc =================================================================== --- llvm/trunk/lib/Support/Unix/Threading.inc +++ llvm/trunk/lib/Support/Unix/Threading.inc @@ -204,7 +204,6 @@ Name.append(buf, buf + strlen(buf)); #elif defined(__linux__) -#if (defined(__GLIBC__) && defined(_GNU_SOURCE)) || defined(__ANDROID__) #if HAVE_PTHREAD_GETNAME_NP constexpr uint32_t len = get_max_thread_name_length_impl(); char Buffer[len] = {'\0'}; // FIXME: working around MSan false positive. @@ -212,5 +211,4 @@ Name.append(Buffer, Buffer + strlen(Buffer)); #endif #endif -#endif }