From ac19c5a542a0c850a058cbfae5aece4c4f480c8d Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Tue, 27 Jul 2021 01:08:18 +0000 Subject: [PATCH] Revert "Build libSupport with -Werror=global-constructors (NFC)" This reverts commit beff86e8ff429f11da6fe37efde86d22ea636ed5. The sanitizer-x86_64-linux bot is still broken. --- lib/Support/CMakeLists.txt | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt index 014b4a2caf1..2242b0ec60a 100644 --- a/lib/Support/CMakeLists.txt +++ b/lib/Support/CMakeLists.txt @@ -1,26 +1,5 @@ include(GetLibraryName) -# Ensure that libSupport does not carry any static global initializer. -# libSupport can be embedded in use cases where we don't want to load all -# cl::opt unless we want to parse the command line. -# ManagedStatic can be used to enable lazy-initialization of globals. -# We don't use `add_flag_if_supported` as instead of compiling an empty file we -# check if the current platform is able to compile global std::mutex with this -# flag (Linux can, Darwin can't for example). -check_cxx_compiler_flag("-Werror=global-constructors" HAS_WERROR_GLOBAL_CTORS) -if (HAS_WERROR_GLOBAL_CTORS) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=global-constructors") - CHECK_CXX_SOURCE_COMPILES(" - #include - static std::mutex TestGlobalCtorDtor; - static std::recursive_mutex TestGlobalCtorDtor2; - int main() { (void)TestGlobalCtorDtor; (void)TestGlobalCtorDtor2; return 0;} - " LLVM_HAS_NOGLOBAL_CTOR_MUTEX) - if (NOT LLVM_HAS_NOGLOBAL_CTOR_MUTEX) - string(REPLACE "-Werror=global-constructors" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - endif() -endif() - if(LLVM_ENABLE_ZLIB) set(imported_libs ZLIB::ZLIB) endif()