[cfe-dev] "File too big/too many sections" when building Registry.cpp in MSYS2 Environment

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 21 13:07:24 PST 2016


On Wed, Dec 21, 2016 at 12:26 PM, William D. Jones <thor0505 at comcast.net>
wrote:
>
> We need to fix the build to pass -mbig-obj to the gnu assembler. You can
>> probably use -DCMAKE_CXX_FLAGS=-Wa,-mbigobj to work around the problem.
>>
> So officially, Clang builds now require COFF big objects?


Basically, yes. MSVC has the same limitation, and here are all the places
we add /bigobj now:

$ git grep '\/bigobj'
lib/ASTMatchers/Dynamic/CMakeLists.txt:
 set_source_files_properties(Registry.cpp PROPERTIES COMPILE_FLAGS /bigobj)
lib/Sema/CMakeLists.txt:  set_source_files_properties(SemaExpr.cpp
PROPERTIES COMPILE_FLAGS /bigobj)
test/Driver/cl-options.c:// RUN:    /bigobj \
unittests/ASTMatchers/CMakeLists.txt:
 set_source_files_properties(InternalASTMatchersTest.cpp PROPERTIES
COMPILE_FLAGS /bigobj)
unittests/ASTMatchers/CMakeLists.txt:
 set_source_files_properties(NodeMatchersTest.cpp PROPERTIES COMPILE_FLAGS
/bigobj)
unittests/ASTMatchers/CMakeLists.txt:
 set_source_files_properties(NarrowingMatchersTest.cpp PROPERTIES
COMPILE_FLAGS /bigobj)
unittests/ASTMatchers/CMakeLists.txt:
 set_source_files_properties(ASTTraversalMatchersTest.cpp PROPERTIES
COMPILE_FLAGS /bigobj)
unittests/Tooling/CMakeLists.txt:
 set_source_files_properties(RecursiveASTVisitorTest.cpp PROPERTIES
COMPILE_FLAGS /bigobj)
unittests/Tooling/CMakeLists.txt:
 set_source_files_properties(RecursiveASTVisitorTestExprVisitor.cpp
PROPERTIES COMPILE_FLAGS /bigobj)

The problem is particularly bad on Win64 because every C++ function gets
separate .pdata and .xdata sections, although I don't think GCC does
separate .debug_* sections for every inline function like MSVC. So, if you
get close to 2**16/3 or 21845 functions in one file, it's easy to pass this
limit. RecursiveASTVisitor uses CRTP, which makes it pretty easy to hit
this limit.



> I'd add this flag to the llvm build myself, but my mingw64 build of clang
>> is currently broken for other reasons.
>>
> Not that I'm qualified to fix it, but... what's wrong with the build?


We should pass -mbig-obj so that users don't have to.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161221/ab9a3d5d/attachment.html>


More information about the cfe-dev mailing list