[all-commits] [llvm/llvm-project] 402461: Build libSupport with -Werror=global-constructors ...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Mon Jul 26 21:27:48 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 402461beb051b6a5c158f1e36d8e2c2b676e8804
      https://github.com/llvm/llvm-project/commit/402461beb051b6a5c158f1e36d8e2c2b676e8804
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2021-07-27 (Tue, 27 Jul 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
    M llvm/lib/Support/CMakeLists.txt

  Log Message:
  -----------
  Build libSupport with -Werror=global-constructors (NFC)

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.

The -Werror=global-constructors is only added on platform that have
support for the flag and for which std::mutex does not have a global
destructor. This is ensured by having CMake trying to compile a file
with a global mutex before adding the flag to libSupport.




More information about the All-commits mailing list