diff options
author | Martin Storsjö <martin@martin.st> | 2022-04-09 23:40:07 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2022-05-18 20:31:51 +0300 |
commit | bedf657d0f4c54ffe9ef4303382657a74296b544 (patch) | |
tree | bbe271357458b94be3b96fa7a703e6e949afca6c /libunwind | |
parent | 86f7d7074a0129955aa2f5c82fe8c383eb17a35a (diff) | |
download | llvm-bedf657d0f4c54ffe9ef4303382657a74296b544.tar.gz |
[runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on Windows
(In the case of libunwind, the cmake option is called
LIBUNWIND_HIDE_SYMBOLS, but it has the same effect as
LIBCXX_HERMETIC_STATIC_LIBRARY and
LIBCXXABI_HERMETIC_STATIC_LIBRARY.)
Previously, the same issue was dealt with by setting a project wide
define (_LIBUNWIND_HIDE_SYMBOLS,
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS and
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) if only building a static
library. If building both static and shared at the same time, this
wasn't set, and the static library would contain dllexport directives.
The LIB*_HERMETIC_STATIC_LIBRARY and LIBUNWIND_HIDE_SYMBOLS cmake
options only apply the defines to the static library in the build,
even if building both static and shared at the same time.
(This could only be done use after the object libraries were
enabled, as a shared libcxx needs libcxxabi object files built
with dllexports included.)
This allows removing inelegant code for deciding how to build the
libcxxabi static library and a TODO comment that suggested that
users should need to start setting an option, which they shouldn't
need to. Finally, this gets rid of two XFAILs in tests.
Differential Revision: https://reviews.llvm.org/D125715
Diffstat (limited to 'libunwind')
-rw-r--r-- | libunwind/CMakeLists.txt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index 4d1f7be659fa..5a06805f05f1 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -93,8 +93,13 @@ if (LIBUNWIND_ENABLE_CET AND MSVC) message(FATAL_ERROR "libunwind CET support is not available for MSVC!") endif() +if (WIN32) + set(LIBUNWIND_DEFAULT_HIDE_SYMBOLS TRUE) +else() + set(LIBUNWIND_DEFAULT_HIDE_SYMBOLS FALSE) +endif() option(LIBUNWIND_HIDE_SYMBOLS - "Do not export any symbols from the static library." OFF) + "Do not export any symbols from the static library." ${LIBUNWIND_DEFAULT_HIDE_SYMBOLS}) #=============================================================================== # Configure System @@ -304,11 +309,6 @@ if (MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() -# Disable DLL annotations on Windows for static builds. -if (WIN32 AND LIBUNWIND_ENABLE_STATIC AND NOT LIBUNWIND_ENABLE_SHARED) - add_definitions(-D_LIBUNWIND_HIDE_SYMBOLS) -endif() - if (C_SUPPORTS_COMMENT_LIB_PRAGMA) if (LIBUNWIND_HAS_DL_LIB) add_definitions(-D_LIBUNWIND_LINK_DL_LIB) |