[libcxx-commits] [PATCH] D129271: [libcxx] Make LIBCXX_HERMETIC_STATIC_LIBRARY apply to libc++experimental too
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 7 03:33:41 PDT 2022
mstorsjo created this revision.
mstorsjo added reviewers: ldionne, phosek.
Herald added a subscriber: mgorny.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.
This avoids dllexports in that library.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D129271
Files:
libcxx/src/CMakeLists.txt
libcxx/test/libcxx/vendor/clang-cl/experimental-lib-exports.sh.cpp
libcxx/test/libcxx/vendor/mingw/experimental-lib-exports.sh.cpp
Index: libcxx/test/libcxx/vendor/mingw/experimental-lib-exports.sh.cpp
===================================================================
--- /dev/null
+++ 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
Index: libcxx/test/libcxx/vendor/clang-cl/experimental-lib-exports.sh.cpp
===================================================================
--- /dev/null
+++ 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
Index: libcxx/src/CMakeLists.txt
===================================================================
--- libcxx/src/CMakeLists.txt
+++ libcxx/src/CMakeLists.txt
@@ -332,6 +332,14 @@
OUTPUT_NAME "c++experimental"
)
cxx_add_common_build_flags(cxx_experimental)
+
+ if (LIBCXX_HERMETIC_STATIC_LIBRARY)
+ target_compile_options(cxx_experimental PRIVATE ${CXX_STATIC_LIBRARY_FLAGS})
+ # _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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129271.442847.patch
Type: text/x-patch
Size: 2480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220707/7e3b4d99/attachment.bin>
More information about the libcxx-commits
mailing list