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 /libcxxabi/CMakeLists.txt | |
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 'libcxxabi/CMakeLists.txt')
-rw-r--r-- | libcxxabi/CMakeLists.txt | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index aa5ab9a0086b..791ff6c75df7 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -136,8 +136,12 @@ endif() set(LIBCXXABI_LIBCXX_INCLUDES "" CACHE PATH "Specify path to libc++ includes.") +set(LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT OFF) +if (WIN32) + set(LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT ON) +endif() option(LIBCXXABI_HERMETIC_STATIC_LIBRARY - "Do not export any symbols from the static library." OFF) + "Do not export any symbols from the static library." ${LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT}) set(LIBCXXABI_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in" CACHE STRING "The path to the Lit testing configuration to use when running the tests. @@ -247,25 +251,6 @@ add_definitions(-D_LIBCXXABI_BUILDING_LIBRARY) # it is being built as part of libcxx. add_definitions(-D_LIBCPP_BUILDING_LIBRARY) -# Disable DLL annotations on Windows for static builds. -if (WIN32 AND LIBCXXABI_ENABLE_STATIC AND NOT LIBCXXABI_ENABLE_SHARED) - # 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() - add_compile_flags_if_supported(-Werror=return-type) # Get warning flags |