Closed llvmbot closed 2 years ago
mentioned in issue llvm/llvm-bugzilla-archive#30263
Bug llvm/llvm-bugzilla-archive#30263 has been marked as a duplicate of this bug.
Should be fixed with r290358
Up
This issue still happens with 3.8
Compile command lines (as with VERBOSE=1) is: cd /C/projects/llvm-test-build/tools/cfe-3.7.0.src/lib/Sema && /c/prog64/mingw64-4.8.1/bin/g++.exe -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=gnu++11 -fno-common -Woverloaded-virtual -fno-strict-aliasing @CMakeFiles/clangSema.dir/includes_CXX.rsp -fno-exceptions -fno-rtti -o CMakeFiles/clangSema.dir/SemaExpr.cpp.obj -c /C/projects/llvm-3.7.0.src/tools/cfe-3.7.0.src/lib/Sema/SemaExpr.cpp
Note that compiling in Release mode, adding -O2, also seems to make the problem go away.
Can you show which commands are run during compilation, with VERBOSE=1? I think it will be using -ffunction-sections -fdata-sections. It that is the case, you might remove those options as a workaround. It will make the final executables a bit bigger, though.
Extended Description
Compilation of LLVM/CLANG fails, using mingw gcc 4.8.1 64 bit. Compiling with Cmake, using MSYS Makefiles, and no further options.
Error message is like: [ 82%] Building CXX object tools/cfe-3.7.0.src/lib/Sema/CMakeFiles/clangSema.dir/SemaExpr.cpp.obj c:/prog64/mingw64-4.8.1/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/as.exe: CMakeFiles/clangSema.dir/SemaExpr.cpp.obj: too many sections (33299) C:\Users\schuttek\AppData\Local\Temp\ccX5KUip.s: Assembler messages: C:\Users\schuttek\AppData\Local\Temp\ccX5KUip.s: Fatal error: can't write CMakeFiles/clangSema.dir/SemaExpr.cpp.obj: File too big c:/prog64/mingw64-4.8.1/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/as.exe: CMakeFiles/clangSema.dir/SemaExpr.cpp.obj: too many sections (33299) C:\Users\schuttek\AppData\Local\Temp\ccX5KUip.s: Fatal error: can't close CMakeFiles/clangSema.dir/SemaExpr.cpp.obj: File too big make[2]: [tools/cfe-3.7.0.src/lib/Sema/CMakeFiles/clangSema.dir/SemaExpr.cpp.obj] Error 1 make[1]: [tools/cfe-3.7.0.src/lib/Sema/CMakeFiles/clangSema.dir/all] Error 2 make: *** [all] Error 2
and also occurred on [ 82%] Building CXX object tools/cfe-3.7.0.src/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.obj
Solution seems to be to add -Wa,-mbig-obj to the compiler arguments as hinted in http://stackoverflow.com/questions/16596876/object-file-has-too-many-sections. Note this needs an updated binutils install.