This patch allows common symbols to be placed to arbitrary section, specified in linker script. Special rule *(COMMON) is used for this case.
Only one output section is supported.
The patch introduces artificial input section object (CommonInputSection<ELFT>), which is used to reserve certain amount of space in the output section.
You introduced this class, but you are using this only for the linker script. If linker scirpts are not used, common symbols directly belong to .bss, but if there are, they belong to some output sectino through this CommonInputSection.
Why don't you use this section both in LinkerScript.cpp and in Writer.cpp? You could create a CommonInputSection, which virtually contains all common symbols in Writer.cpp and add that input sectino to .bss, no?