[llvm-dev] [llvm-toolchain v3.8.1] LTO: Linking clang hangs with ld.gold and LLVMgold.so plugin

Sedat Dilek via llvm-dev llvm-dev at lists.llvm.org
Sat Jul 23 02:42:17 PDT 2016

On Thu, Jul 21, 2016 at 12:01 PM, Sedat Dilek <sedat.dilek at gmail.com> wrote:
> Hi,
> unfortunately, my build somehow hangs when linking clang binary and my
> system is in an unusable state.
> My toolchain is clang-3.8, gold-1.11 and LLVMgold.so from binutils
> v2.26.1 (both selfmade) and LTO-flag is enabled.
> My buildsystem uses cmake-3.6.0 and ninja-1.7.1 (both prebuilt).
> I have 52 last steps left in my 3rd build.
> My Linux-kernel is v3.13.0-92 from official Ubuntu repositories.
> On my Ubuntu/precise AMD64 I have ***4GiB RAM and 256MiB SWAP***.
> Is this not enough RAM/SWAP for building/linking?
> Need some additional informations?
> Any help appreciated.
> Regards,
> - Sedat -
> [1] http://llvm.org/docs/GoldPlugin.html
> P.S.: More informations...
> [ First toolchain build ]
> I built a 1st llvm-toolchain v3.8.1 with GCC v4.9.2 and binutils v2.22.
> No speedup settings, no extra-patches applied etc.
> [ Selfmade binutils ]
> As binutils v2.22 was somehow not able to generate a LLVMgold.so on
> Ubuntu/precise AMD64, I have built binutils v2.26.1 manually and use
> all its binaries for building/linking (GOLD for linking).
> [ 2nd llvm-toolchain LLVMgold.so ]
> In a 2nd llvm-toolchain v3.8.1 build a LLVMgold.so was generated.
> I placed LLVMgold.so into my selfmade
> /opt/binutils-2.26.1/lib/bfd-plugins/ directory.
> ( I had to create a bfd-plugins subdir manually. )
> [ 3rd llvm-toolchain LTO ]
> Now, I am able with backported LTO-flag from upstream to build with '-flto'.
> - EOT -


in the meantime I tried with Linux v4.4.y LTS and 2GiB swap-space.
So I have 4 GiB RAM and 2GiB SWAP in total 6GiB.

Paul Rouschal recommended to reduce parallel-compile-jobs from 2 to 1...


...but that did not help.

My Ubuntu/precise hangs and looking at top shows MEM/SWAP to be eaten.

Anyone has experiences how much RAM or SWAP I need when building a
LTO-optimized llvm-toolchain with Clang, GNU/gold and LLVMgold-Plugin?

My build-script is attached.


- Sedat -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build_llvm-toolchain.sh
Type: application/x-sh
Size: 6190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160723/c24baa3a/attachment-0001.sh>

More information about the llvm-dev mailing list