From: Reid Kleckner Date: Thu, 22 Dec 2016 19:12:14 +0000 (+0000) Subject: Pass -Wa,-mbig-obj in 64-bit mingw builds X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1c9f504c6810be782714b8b39f11579e50fa5c7;p=llvm Pass -Wa,-mbig-obj in 64-bit mingw builds COFF has a 2**16 section limit, and on Win64, every COMDAT function creates at least 3 sections: .text, .pdata, and .xdata. For MSVC, we enable bigobj on a file-by-file basis, but GCC appears to hit the limit on different files. Fixes PR25953 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290358 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 964fa59c0ba..133e8ef3d8a 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -232,6 +232,13 @@ if(MSVC) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10000000") elseif(MINGW) # FIXME: Also cygwin? set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,16777216") + + # Pass -mbig-obj to mingw gas on Win64. COFF has a 2**16 section limit, and + # on Win64, every COMDAT function creates at least 3 sections: .text, .pdata, + # and .xdata. + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + append("-Wa,-mbig-obj" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + endif() endif() if( MSVC )