[compiler-rt] r274785 - [compiler-rt] Fix minimal stack reserved for unittest on MSVC build

Etienne Bergeron via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 11:41:09 PDT 2016


Author: etienneb
Date: Thu Jul  7 13:41:08 2016
New Revision: 274785

URL: http://llvm.org/viewvc/llvm-project?rev=274785&view=rev
Log:
[compiler-rt] Fix minimal stack reserved for unittest on MSVC build

Summary:
Some unittest were not able to run in 64-bit because they need more than
2MB of stack and the default allocated stack with MSVC linker is 1MB.

Reviewers: rnk

Subscribers: wang0109, chrisha, llvm-commits, kubabrecka

Differential Revision: http://reviews.llvm.org/D22101

Modified:
    compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
    compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_main.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=274785&r1=274784&r2=274785&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Thu Jul  7 13:41:08 2016
@@ -78,6 +78,13 @@ if(ANDROID)
   list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -pie)
 endif()
 
+# MSVC linker is allocating 1M for the stack by default, which is not
+# enough for the unittests. Some unittests require more than 2M.
+# The default stack size for clang is 8M.
+if(MSVC)
+  list(APPEND SANITIZER_TEST_LINK_FLAGS_COMMON -Wl,/STACK:0x8000000)
+endif()
+
 set(SANITIZER_TEST_LINK_LIBS)
 append_list_if(COMPILER_RT_HAS_LIBLOG log SANITIZER_TEST_LINK_LIBS)
 # NDK r10 requires -latomic almost always.

Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_main.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_main.cc?rev=274785&r1=274784&r2=274785&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_main.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_main.cc Thu Jul  7 13:41:08 2016
@@ -13,10 +13,6 @@
 #include "gtest/gtest.h"
 #include "sanitizer_common/sanitizer_flags.h"
 
-#ifdef _MSC_VER
-#pragma comment(linker, "/STACK:33554432")
-#endif
-
 const char *argv0;
 
 int main(int argc, char **argv) {




More information about the llvm-commits mailing list