[libcxx-commits] [PATCH] D120719: [runtimes] Always configure libc++abi before libc++

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 3 14:53:15 PST 2022


ldionne updated this revision to Diff 412843.
ldionne edited the summary of this revision.
ldionne added a subscriber: mstorsjo.
ldionne added a comment.
Herald added a project: All.

Play around with the MinGW configuration based on discussion with @mstorsjo.

I suspect this is going to pass in the CI, but it will also cause anyone building for WIN32
to suddenly export symbols from their static libc++abi unless they use -DLIBCXXABI_HERMETIC_STATIC_LIBRARY=ON.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120719

Files:
  libcxx/cmake/caches/MinGW.cmake
  libcxx/utils/ci/buildkite-pipeline-premerge.sh
  libcxxabi/CMakeLists.txt
  runtimes/CMakeLists.txt


Index: runtimes/CMakeLists.txt
===================================================================
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -9,6 +9,17 @@
   set(LLVM_ENABLE_RUNTIMES ${LLVM_ALL_RUNTIMES})
 endif()
 
+# If both libc++ and libc++abi are being built, always configure libc++abi before libc++.
+# This allows libc++ to depend on targets set up by libc++abi when it needs to.
+if (libcxx IN_LIST LLVM_ENABLE_RUNTIMES AND libcxxabi IN_LIST LLVM_ENABLE_RUNTIMES)
+  list(FIND LLVM_ENABLE_RUNTIMES libcxx _libcxx_index)
+  list(FIND LLVM_ENABLE_RUNTIMES libcxxabi _libcxxabi_index)
+  if (_libcxx_index LESS _libcxxabi_index)
+    list(TRANSFORM LLVM_ENABLE_RUNTIMES REPLACE "^libcxx$" "libcxxabi" AT ${_libcxx_index})
+    list(TRANSFORM LLVM_ENABLE_RUNTIMES REPLACE "^libcxxabi$" "libcxx" AT ${_libcxxabi_index})
+  endif()
+endif()
+
 foreach(proj ${LLVM_ENABLE_RUNTIMES})
   set(proj_dir "${CMAKE_CURRENT_SOURCE_DIR}/../${proj}")
   if(IS_DIRECTORY ${proj_dir} AND EXISTS ${proj_dir}/CMakeLists.txt)
Index: libcxxabi/CMakeLists.txt
===================================================================
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -300,18 +300,6 @@
 # it is being built as part of libcxx.
 add_definitions(-D_LIBCPP_BUILDING_LIBRARY)
 
-# Disable DLL annotations on Windows for static builds.
-if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED)
-  if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_STATIC_ABI_LIBRARY)
-    # Building libcxxabi statically, but intending for it to be statically
-    # linked into a shared libcxx; keep dllexport enabled within libcxxabi,
-    # as the symbols will need to be exported from libcxx.
-  else()
-    # Regular static build; disable dllexports.
-    add_definitions(-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
-  endif()
-endif()
-
 add_compile_flags_if_supported(-Werror=return-type)
 
 # Get warning flags
Index: libcxx/utils/ci/buildkite-pipeline-premerge.sh
===================================================================
--- libcxx/utils/ci/buildkite-pipeline-premerge.sh
+++ libcxx/utils/ci/buildkite-pipeline-premerge.sh
@@ -17,8 +17,8 @@
 
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 
-if ! git diff --name-only HEAD~1 | grep -q -E "libcxx/|libcxxabi/|libunwind/"; then
-  # libcxx/, libcxxabi/ or libunwind/ are not affected
+if ! git diff --name-only HEAD~1 | grep -q -E "libcxx/|libcxxabi/|libunwind/|runtimes/"; then
+  # libcxx/, libcxxabi/, libunwind/ or runtimes/ are not affected
   exit 0
 fi
 
Index: libcxx/cmake/caches/MinGW.cmake
===================================================================
--- libcxx/cmake/caches/MinGW.cmake
+++ libcxx/cmake/caches/MinGW.cmake
@@ -6,6 +6,7 @@
 
 set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
 set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+set(LIBCXXABI_HERMETIC_STATIC_LIBRARY OFF CACHE BOOL "")
 
 set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
 set(LIBCXXABI_USE_COMPILER_RT ON CACHE BOOL "")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120719.412843.patch
Type: text/x-patch
Size: 3021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220303/ece0b07b/attachment.bin>


More information about the libcxx-commits mailing list