The linker might create several fds per file here and they are not being
closed with ld.bfd. This breaks the build when using clang+ld.bfd to
e.g. link libLLVM.so with LTO.
Gold does not seem to have this problem, but it does not break with this
patch either.
I've also tested this always enabled (not only when thinlto is disabled), and it seemed to work as well.
But the code talks about parallel thinlto backends, so I'm not sure if I've tested all relevant cases.
clang-tidy: error: 'plugin-api.h' file not found [clang-diagnostic-error]
not useful