[llvm] r192904 - CMake: set stack size to 2MB for MSVC builds

Hans Wennborg hans at hanshq.net
Thu Oct 17 10:49:57 PDT 2013


Author: hans
Date: Thu Oct 17 12:49:57 2013
New Revision: 192904

URL: http://llvm.org/viewvc/llvm-project?rev=192904&view=rev
Log:
CMake: set stack size to 2MB for MSVC builds

Compiling under Visual C++ 2012 with the default stack size of 1MB, the stack
overflows at a depth of 216 template instantiations, well before the 256
default limit. This patch modifies the default MSVC stack size to 2MB.

Patch by Yaron Keren!

Modified:
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=192904&r1=192903&r2=192904&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Thu Oct 17 12:49:57 2013
@@ -153,6 +153,10 @@ endif()
 if( MSVC )
   include(ChooseMSVCCRT)
 
+  # Visual C++ default stack size is 1MB. This is not enough for clang to
+  # instantiate templates up to the default maximum depth allowed, 256.
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -STACK:2097152")
+
   if( MSVC10 )
     # MSVC 10 will complain about headers in the STL not being exported, but
     # will not complain in MSVC 11.





More information about the llvm-commits mailing list