Skip to content

Commit

Permalink
[libcxx] Make LIBCXX_HERMETIC_STATIC_LIBRARY apply to libc++experimen…
Browse files Browse the repository at this point in the history
…tal too

This avoids dllexports in that library.

Differential Revision: https://reviews.llvm.org/D129271
  • Loading branch information
mstorsjo committed Jul 8, 2022
1 parent 8db8754 commit 0d7de7a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libcxx/src/CMakeLists.txt
Expand Up @@ -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()


Expand Down
14 changes: 14 additions & 0 deletions 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
14 changes: 14 additions & 0 deletions 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

0 comments on commit 0d7de7a

Please sign in to comment.