Index: include/lld/Core/InputGraph.h =================================================================== --- include/lld/Core/InputGraph.h +++ include/lld/Core/InputGraph.h @@ -80,6 +80,12 @@ /// it with getReplacements() results. void normalize(); + /// Start parsing the file containing a given symbol, so that when the + /// file is requested from the core linker we can respond to it quickly. + /// It does not change the meaining of the code. In particualr this + /// function should not have any observable side effect. + void preload(StringRef sym); + range inputElements() { return make_range(_inputArgs.begin(), _inputArgs.end()); } Index: lib/Core/Resolver.cpp =================================================================== --- lib/Core/Resolver.cpp +++ lib/Core/Resolver.cpp @@ -117,6 +117,13 @@ // tell symbol table bool newUndefAdded = _symbolTable.add(atom); + // If the undefined symbol is in an archive file, we want to start parsing the + // file in background to use more than one core. It's semantically no-op from + // the core linker's point of view because the speculative loading has no side + // effect. + if (newUndefAdded) + _context.getInputGraph().preload(atom.name()); + // If the undefined symbol has an alternative name, try to resolve the // symbol with the name to give it a second chance. This feature is used // for COFF "weak external" symbol.