[libunwind] [runtimes] Fix link order of system librarires on Apple platforms (PR #66940)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 21 02:09:19 PDT 2023


================
@@ -659,24 +659,22 @@ function(cxx_link_system_libraries target)
     target_add_link_flags_if_supported(${target} PRIVATE "--unwindlib=none")
   endif()
 
-  if (LIBCXX_HAS_SYSTEM_LIB)
-    target_link_libraries(${target} PRIVATE System)
-  endif()
-
-  if (LIBCXX_HAS_PTHREAD_LIB)
-    target_link_libraries(${target} PRIVATE pthread)
-  endif()
+  if (NOT APPLE) # On Apple platforms, we always use -nostdlib++ so we don't need to re-add other libraries
+    if (LIBCXX_HAS_PTHREAD_LIB)
----------------
ldionne wrote:

On macos, linking explicitly against pthread isn't necessary. If you link against `libSystem`, you get the definitions of everything related to pthread!

https://github.com/llvm/llvm-project/pull/66940


More information about the cfe-commits mailing list