Skip to content

Commit

Permalink
Merge bitcoin#31458: build: use -mbig-obj for Windows debug builds
Browse files Browse the repository at this point in the history
2b9ff4a build: use `-mbig-obj` for mingw-w64 Debug builds (fanquake)

Pull request description:

  Windows cross builds using `-O0` (`-DCMAKE_BUILD_TYPE=Debug`) currently fail to compile, as some objects have too many sections. As a convenience, add `-mbig-obj` to our compile flags when using the `Debug` build type, so that if someone tries to build this way, it will work.

  This would also be needed if we switched the depends flags to -O0. (maybe in bitcoin#29796).

  `-mbig-obj`

  > On PE/COFF target this option forces the use of big object
  > file format, which allows more than 32768 sections.

  Closes bitcoin#28109. Seems unlikely that we are going to break up the relevant object files, and the main issue is still the inclusion of Boost.

ACKs for top commit:
  theuni:
    utACK 2b9ff4a
  hebasto:
    ACK 2b9ff4a, tested in the following scenarios:

Tree-SHA512: 9ad36de172629a8b7e5371fe3cd75ac2f3c29856040569052cc59e42825eec9121e012dd2178e00b163173c98e78f79dd16b8cee2c93daa2ee0d7e99799325cd
  • Loading branch information
fanquake committed Dec 17, 2024
2 parents d2136d3 + 2b9ff4a commit 1251a23
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1251a23

Please sign in to comment.