From dac8b872572f0ac9c9e0be93f5058d7b8b9cea91 Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Tue, 10 Aug 2021 13:04:21 -0700 Subject: [PATCH] Disable external initialization of `thread_local` variables (#7004) This commit adds `-fno-extern-tls-init` to the list of compiler flags to tell the compiler that it can assume that there is no dynamic initialization of thread-local variables in non-defining translation units. This option should result in better performance and works around crashing issues with our Windows build. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb8e305b2..e9484986b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,6 +208,11 @@ add_check_cxx_flag("-Wnon-virtual-dtor") add_check_c_cxx_flag("-Wimplicit-fallthrough") add_check_c_cxx_flag("-Wshadow") +# Assume no dynamic initialization of thread-local variables in non-defining +# translation units. This option should result in better performance and works +# around crashing issues with our Windows build. +add_check_cxx_flag("-fno-extern-tls-init") + # Temporarily disable -Wclass-memaccess to suppress 'no trivial copy-assignment' # cdlist.h warnings. Remove when fixed. add_check_cxx_flag("-Wno-class-memaccess") -- 2.30.2