Instead of exiting after creating the combined index in the gold plugin,
unless requested by new option, we will now launch the ThinLTO backends
(LTO and codegen pipelines with importing) in parallel threads. The
number of threads is controlled by the existing -jobs gold plugin option,
or the hardware concurrency if not specified.
As discussed on IRC with Rafael, pull split codegen into gold-plugin and
use the ThreadPool support. Refactor both the split codegen and ThinLTO
handling to utilize a new CodeGen class that encapsulates the
optimization and code generation handling for each module (split or
not). This allows better code reuse between the ThinLTO and split
codegen cases. For now I have included this along with the ThinLTO thread patch, to
show how it all fits together. I can commit the split code gen changes
first though, followed by the ThinLTO backend support. Let me know if
you would like to review these separately.
Along with follow-on fixes D16173 and D16120, all of the SPEC cpu2006 C/C++ benchmarks now build and run correctly with -flto=thin.