[llvm-dev] lld out of memory

412 views
Skip to first unread message

Itaru Kitayama via llvm-dev

unread,
Feb 2, 2020, 6:01:29 PM2/2/20
to LLVM Dev
Hi,
I am seeing an LLVM build failure with recent LLD on x86 like:

[...]
   lib/libLLVMCodeGen.a  lib/libLLVMBitWriter.a  lib/libLLVMScalarOpts.a  lib/libLLVMAgg
ressiveInstCombine.a  lib/libLLVMInstCombine.a  lib/libLLVMTransformUtils.a  lib/libLLVMDebugInfoDWARF.a  lib/lib
LLVMMCDisassembler.a  lib/libLLVMExecutionEngine.a  lib/libLLVMTarget.a  lib/libLLVMAnalysis.a  lib/libLLVMProfil
eData.a  lib/libLLVMRuntimeDyld.a  lib/libLLVMObject.a  lib/libLLVMMCParser.a  lib/libLLVMMC.a  lib/libLLVMDebugI
nfoCodeView.a  lib/libLLVMDebugInfoMSF.a  lib/libLLVMBitReader.a  lib/libLLVMCore.a  lib/libLLVMRemarks.a  lib/li
bLLVMBitstreamReader.a  lib/libLLVMTextAPI.a  lib/libLLVMBinaryFormat.a  lib/libLLVMSupport.a  /usr/lib64/libz.so
  -lrt  -ldl  -ltinfo  -lpthread  -lm  lib/libLLVMDemangle.a && :
LLVM ERROR: out of memory
Stack dump:
0.      Program arguments: /home/usr4/c74014i/opt/clang/stable/bin/ld.lld @/tmp/response-5051e9.txt
LLVM ERROR: out of memory
clang-11: error: unable to execute command: Aborted
clang-11: error: linker command failed due to signal (use -v to see invocation)
[32/492] Building CXX object tools/llvm-cov/CMakeFiles/llvm-cov.dir/gcov.cpp.o

As reported on Discord, switching back to ld works around this issue.
On my system a process gets a 6 GB of memory max can be used, and I use
ninja -j16.

Itaru Kitayama via llvm-dev

unread,
Feb 2, 2020, 6:07:11 PM2/2/20
to LLVM Dev
I take it back it is -j8.

Alex Brachet-Mialot via llvm-dev

unread,
Feb 2, 2020, 6:16:21 PM2/2/20
to Itaru Kitayama, LLVM Dev
See here you can specify the number of concurrent link jobs
https://llvm.org/docs/CMake.html#llvm-specific-variables with
LLVM_PARALLEL_LINK_JOBS. Increasing swap space is also an option, and
I have had to do this on a system with only 8gb of memory. As to why
it work with ld.gold/bfd and not lld I couldn't say, this seems
contrary to what most people report which is that lld uses less memory
and is faster. Usually this list recommends lld, so I'm surprised.
Also BUILD_SHARED_LIBS should be helpful.

> _______________________________________________
> LLVM Developers mailing list
> llvm...@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Itaru Kitayama via llvm-dev

unread,
Feb 2, 2020, 7:02:30 PM2/2/20
to Alex Brachet-Mialot, LLVM Dev
Alex et al.,

For me, setting explicitly LLVM_PARALLEL_LINK_JOBS to 2 did not help, but

BUILD_SHARED_LIBS=ON

did the trick! Thanks!
Reply all
Reply to author
Forward
0 new messages