[libcxx-commits] [PATCH] D57646: [libcxx] Specify unwind lib before other system libraries.

Yuanfang Chen via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 3 14:21:09 PDT 2019


tabloid.adroit updated this revision to Diff 198090.
tabloid.adroit added a comment.

- add comment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57646/new/

https://reviews.llvm.org/D57646

Files:
  libcxx/src/CMakeLists.txt


Index: libcxx/src/CMakeLists.txt
===================================================================
--- libcxx/src/CMakeLists.txt
+++ libcxx/src/CMakeLists.txt
@@ -231,18 +231,6 @@
   if(COMMAND llvm_setup_rpath)
     llvm_setup_rpath(cxx_shared)
   endif()
-  cxx_link_system_libraries(cxx_shared)
-  target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES})
-  set_target_properties(cxx_shared
-    PROPERTIES
-      COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
-      LINK_FLAGS    "${LIBCXX_LINK_FLAGS}"
-      OUTPUT_NAME   "c++"
-      VERSION       "${LIBCXX_ABI_VERSION}.0"
-      SOVERSION     "${LIBCXX_ABI_VERSION}"
-      DEFINE_SYMBOL ""
-  )
-  cxx_set_common_defines(cxx_shared)
 
   # Link against LLVM libunwind
   if (LIBCXXABI_USE_LLVM_UNWINDER)
@@ -269,6 +257,22 @@
     list(APPEND LIBCXX_INTERFACE_LIBRARIES "${LIBCXX_CXX_SHARED_ABI_LIBRARY}") # For the linker script
   endif()
 
+  # Link system libraries after libunwind & libc++abi so that
+  # local libunwind & libc++abi have higher precedence than their counterparts
+  # in system lib.
+  cxx_link_system_libraries(cxx_shared)
+  target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES})
+  set_target_properties(cxx_shared
+    PROPERTIES
+      COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
+      LINK_FLAGS    "${LIBCXX_LINK_FLAGS}"
+      OUTPUT_NAME   "c++"
+      VERSION       "${LIBCXX_ABI_VERSION}.0"
+      SOVERSION     "${LIBCXX_ABI_VERSION}"
+      DEFINE_SYMBOL ""
+  )
+  cxx_set_common_defines(cxx_shared)
+
   # Maybe re-export symbols from libc++abi
   if (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR
                  LIBCXX_CXX_ABI_LIBNAME STREQUAL "default")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57646.198090.patch
Type: text/x-patch
Size: 1673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190503/b9469fb2/attachment.bin>


More information about the libcxx-commits mailing list