[libcxx-commits] [PATCH] D120982: [libcxxabi] Fix cmake order dependency wrt dllexporting

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 7 12:34:53 PST 2022


ldionne updated this revision to Diff 413591.
ldionne added a comment.

Comment out warning


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120982

Files:
  libcxx/docs/ReleaseNotes.rst
  libcxxabi/CMakeLists.txt


Index: libcxxabi/CMakeLists.txt
===================================================================
--- libcxxabi/CMakeLists.txt
+++ libcxxabi/CMakeLists.txt
@@ -302,13 +302,20 @@
 
 # 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)
+  # If LIBCXX_ENABLE_SHARED isn't set (by the user on the cmake command
+  # line or via a cache file), use its expected default value (enabled).
+  if ((LIBCXX_ENABLE_SHARED OR NOT DEFINED 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)
+    if (NOT LIBCXXABI_HERMETIC_STATIC_LIBRARY)
+      # TODO: Enable this warning message as soon as we're sure this is the solution.
+      # message(WARNING "Implicitly disabling dllexport on Win32 is not supported anymore. Please build with "
+      #                 "LIBCXXABI_HERMETIC_STATIC_LIBRARY=ON instead. This will become an error in LLVM 16.")
+    endif()
   endif()
 endif()
 
Index: libcxx/docs/ReleaseNotes.rst
===================================================================
--- libcxx/docs/ReleaseNotes.rst
+++ libcxx/docs/ReleaseNotes.rst
@@ -93,3 +93,8 @@
   ``{LIBCXX,LIBCXXABI,LIBUNWIND}_GCC_TOOLCHAIN`` CMake variables have been removed. Instead, please
   use the ``CMAKE_CXX_COMPILER_TARGET``, ``CMAKE_SYSROOT`` and ``CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN``
   variables provided by CMake.
+
+- When building for Windows, vendors who want to avoid dll-exporting symbols from the static libc++abi
+  library should set ``LIBCXXABI_HERMETIC_STATIC_LIBRARY=ON`` when configuring CMake. The current
+  behavior, which tries to guess the correct dll-export semantics based on whether we're building
+  the libc++ shared library, will be removed in LLVM 16.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120982.413591.patch
Type: text/x-patch
Size: 2149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220307/1ea17e68/attachment.bin>


More information about the libcxx-commits mailing list