This is https://bugs.llvm.org/show_bug.cgi?id=38037
When we add files:
https://github.com/llvm-mirror/lld/blob/master/ELF/Driver.cpp#L1267
We might add "COMMON" input sections, which are later
changes their name to ".bss" (in getOutputSectionName):
https://github.com/llvm-mirror/lld/blob/master/ELF/SymbolTable.cpp#L461
and placed to ".bss" output section.
Since we are adding the files first,
it results in such ".bss" created out of order and placed
at the start. Itself it is not a huge issue, perhaps, but the problem
appears when such "COMMON" sections (common symbols) are huge.
In PR, usr/lib/gcc/x86_64-linux-gnu/5.4.0/crtbegin.o is the first
in the command line and it has a R_X86_64_PC32 relocation against its own ".bss".
But because of LLD, which places huge input ".bss" created for user's SHN_COMMON symbol
at the beginning of the output section, relocation overflows.
The patch fixes the issue by moving all early created synthetics to the end of the input sections list.