[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
Sun Feb 3 01:46:27 PST 2019


tabloid.adroit created this revision.
tabloid.adroit added a reviewer: phosek.
Herald added subscribers: libcxx-commits, ldionne, christof, mgorny.
Herald added a reviewer: EricWF.

For the same reason as D57496 <https://reviews.llvm.org/D57496>. This and D57496 <https://reviews.llvm.org/D57496> combined make local unwind lib
picked up by dyld in a libcxx/libcxxabi/libunwind build on OSX.

before
➜  libcxx otool -L lib/libc++.dylib
lib/libc++.dylib:

  @rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
  @rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
  @rpath/libunwind.1.dylib (compatibility version 1.0.0, current version 1.0.0)

to
➜  libcxx otool -L lib/libc++.dylib
lib/libc++.dylib:

  @rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
  @rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
  @rpath/libunwind.1.dylib (compatibility version 1.0.0, current version 1.0.0)
  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)


Repository:
  rCXX libc++

https://reviews.llvm.org/D57646

Files:
  lib/CMakeLists.txt


Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -33,7 +33,6 @@
 add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH
                   "${CMAKE_LIBRARY_PATH_FLAG}${LIBCXX_CXX_ABI_LIBRARY_PATH}")
 
-
 if (LIBCXX_GENERATE_COVERAGE AND NOT LIBCXX_COVERAGE_LIBRARY)
   find_compiler_rt_library(profile LIBCXX_COVERAGE_LIBRARY)
 endif()
@@ -79,6 +78,17 @@
   endif()
 endif()
 
+# Add the unwinder library.
+if (LIBCXXABI_USE_LLVM_UNWINDER)
+  if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
+    add_interface_library(unwind_shared)
+  elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
+    add_interface_library(unwind_static)
+  else()
+    add_interface_library(unwind)
+  endif()
+endif()
+
 # Generate private library list.
 add_library_flags_if(LIBCXX_HAS_PTHREAD_LIB pthread)
 add_library_flags_if(LIBCXX_HAS_C_LIB c)
@@ -93,17 +103,6 @@
 add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)
 add_library_flags_if(MINGW "${MINGW_LIBRARIES}")
 
-# Add the unwinder library.
-if (LIBCXXABI_USE_LLVM_UNWINDER)
-  if (NOT LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
-    add_interface_library(unwind_shared)
-  elseif (LIBCXXABI_ENABLE_STATIC_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
-    add_interface_library(unwind_static)
-  else()
-    add_interface_library(unwind)
-  endif()
-endif()
-
 # Setup flags.
 if (NOT WIN32)
   add_flags_if_supported(-fPIC)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57646.184937.patch
Type: text/x-patch
Size: 1580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190203/01515b8a/attachment.bin>


More information about the libcxx-commits mailing list