[libcxx{,abi}] Don't link libpthread and libdl on Fuchsia

These are a part of the libc so linking these explicitly isn't necessary
and embedding these as deplibs causes link time error.

This issues was introduced in a9b5fff which changed how we emit deplibs.

Differential Revision: https://reviews.llvm.org/D71135

GitOrigin-RevId: 1aa17023819216dae77c7798510f178dae07a57f
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 496ed34..8892964 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -71,8 +71,16 @@
 check_cxx_compiler_flag(-nostdinc++ LIBCXXABI_HAS_NOSTDINCXX_FLAG)
 
 # Check libraries
-check_library_exists(dl dladdr "" LIBCXXABI_HAS_DL_LIB)
-check_library_exists(pthread pthread_once "" LIBCXXABI_HAS_PTHREAD_LIB)
-check_library_exists(c __cxa_thread_atexit_impl ""
-  LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
-check_library_exists(System write "" LIBCXXABI_HAS_SYSTEM_LIB)
+if(FUCHSIA)
+  set(LIBCXXABI_HAS_DL_LIB NO)
+  set(LIBCXXABI_HAS_PTHREAD_LIB NO)
+  check_library_exists(c __cxa_thread_atexit_impl ""
+    LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
+  set(LIBCXXABI_HAS_SYSTEM_LIB NO)
+else()
+  check_library_exists(dl dladdr "" LIBCXXABI_HAS_DL_LIB)
+  check_library_exists(pthread pthread_once "" LIBCXXABI_HAS_PTHREAD_LIB)
+  check_library_exists(c __cxa_thread_atexit_impl ""
+    LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
+  check_library_exists(System write "" LIBCXXABI_HAS_SYSTEM_LIB)
+endif()