[libcxx-commits] [libcxx] 0d7de7a - [libcxx] Make LIBCXX_HERMETIC_STATIC_LIBRARY apply to libc++experimental too

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 7 23:56:21 PDT 2022


Author: Martin Storsjö
Date: 2022-07-08T09:55:18+03:00
New Revision: 0d7de7a35533ea8fa226361fc9b755829a30fdf7

URL: https://github.com/llvm/llvm-project/commit/0d7de7a35533ea8fa226361fc9b755829a30fdf7
DIFF: https://github.com/llvm/llvm-project/commit/0d7de7a35533ea8fa226361fc9b755829a30fdf7.diff

LOG: [libcxx] Make LIBCXX_HERMETIC_STATIC_LIBRARY apply to libc++experimental too

This avoids dllexports in that library.

Differential Revision: https://reviews.llvm.org/D129271

Added: 
    libcxx/test/libcxx/vendor/clang-cl/experimental-lib-exports.sh.cpp
    libcxx/test/libcxx/vendor/mingw/experimental-lib-exports.sh.cpp

Modified: 
    libcxx/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index d3034999c392f..28436fbf38f4b 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -332,6 +332,12 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
       OUTPUT_NAME   "c++experimental"
   )
   cxx_add_common_build_flags(cxx_experimental)
+
+  if (LIBCXX_HERMETIC_STATIC_LIBRARY)
+    # _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS can be defined in __config_site
+    # too. Define it in the same way here, to avoid redefinition conflicts.
+    target_compile_definitions(cxx_experimental PRIVATE _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=)
+  endif()
 endif()
 
 

diff  --git a/libcxx/test/libcxx/vendor/clang-cl/experimental-lib-exports.sh.cpp b/libcxx/test/libcxx/vendor/clang-cl/experimental-lib-exports.sh.cpp
new file mode 100644
index 0000000000000..9ed32effe6969
--- /dev/null
+++ b/libcxx/test/libcxx/vendor/clang-cl/experimental-lib-exports.sh.cpp
@@ -0,0 +1,14 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: msvc && c++experimental
+
+// This file checks that the built experimental static library doesn't contain dllexport
+// directives in clang-cl builds.
+
+// RUN: llvm-readobj --coff-directives "%{lib}/libc++experimental.lib" | not grep -i "export:" > /dev/null

diff  --git a/libcxx/test/libcxx/vendor/mingw/experimental-lib-exports.sh.cpp b/libcxx/test/libcxx/vendor/mingw/experimental-lib-exports.sh.cpp
new file mode 100644
index 0000000000000..5aca961536ee6
--- /dev/null
+++ b/libcxx/test/libcxx/vendor/mingw/experimental-lib-exports.sh.cpp
@@ -0,0 +1,14 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: target={{.+}}-windows-gnu && c++experimental
+
+// This file checks that the built experimental static library doesn't contain dllexport
+// directives in MinGW builds.
+
+// RUN: llvm-readobj --coff-directives "%{lib}/libc++experimental.a" | not grep -i "export:" > /dev/null


        


More information about the libcxx-commits mailing list