diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b21646ca1..2dba6f255d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,6 +298,15 @@ if(WIN32) try_append_linker_flag("-Wl,--major-subsystem-version,6" TARGET core_interface) try_append_linker_flag("-Wl,--minor-subsystem-version,2" TARGET core_interface) endif() + + # Workaround producing large object files, which cannot be handled by the assembler. + # More likely to happen with no, or lower levels of optimisation. + # See discussion in https://github.com/bitcoin/bitcoin/issues/28109. + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + try_append_cxx_flags("/bigobj" TARGET core_interface_debug SKIP_LINK) + else() + try_append_cxx_flags("-Wa,-mbig-obj" TARGET core_interface_debug SKIP_LINK) + endif() endif() # Use 64-bit off_t on 32-bit Linux.