[PATCH] D53797: If libc++abi library path is given, use it to reexport

Isuru Fernando via Phabricator reviews at reviews.llvm.org
Sat Oct 27 23:37:46 PDT 2018


isuruf created this revision.
isuruf added a reviewer: mclow.lists.
Herald added subscribers: libcxx-commits, ldionne, mgorny.
Herald added a reviewer: EricWF.

When building libc++ on OSX against a newer libc++abi library that is not a system library (Not in /usr/lib and not in CMAKE_OSX_SYSROOT), libc++ links against both the newer libc++abi and /usr/lib/libc++abi.dylib one. With this change, libc++ is not linked against a system library.


Repository:
  rCXX libc++

https://reviews.llvm.org/D53797

Files:
  lib/CMakeLists.txt


Index: lib/CMakeLists.txt
===================================================================
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -153,15 +153,20 @@
                         "target. If you need support for this, please contact "
                         "the libc++ maintainers.")
   else()
-	  if (DEFINED CMAKE_OSX_SYSROOT AND NOT CMAKE_OSX_SYSROOT STREQUAL "")
+    if (DEFINED LIBCXX_CXX_ABI_LIBRARY_PATH AND NOT LIBCXX_CXX_ABI_LIBRARY_PATH STREQUAL "")
+        set (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY_PATH "${LIBCXX_CXX_ABI_LIBRARY_PATH}")
+    elseif (DEFINED CMAKE_OSX_SYSROOT AND NOT CMAKE_OSX_SYSROOT STREQUAL "")
+        set (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY_PATH "${CMAKE_OSX_SYSROOT}/usr/lib")
+    endif()
+    if (DEFINED LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY_PATH AND NOT LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY_PATH STREQUAL "")
       list(FIND CMAKE_OSX_ARCHITECTURES "armv7" OSX_HAS_ARMV7)
       if (NOT OSX_HAS_ARMV7 EQUAL -1)
         set(OSX_RE_EXPORT_LINE
-          "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"
+          "${LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY_PATH}/libc++abi.dylib"
           "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")
       else()
         set(OSX_RE_EXPORT_LINE
-          "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib")
+          "-Wl,-reexport_library,${LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY_PATH}/libc++abi.dylib")
       endif()
     else()
       set(OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53797.171416.patch
Type: text/x-patch
Size: 1639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181028/06ee0d49/attachment.bin>


More information about the libcxx-commits mailing list