Index: lld/trunk/ELF/LTO.h =================================================================== --- lld/trunk/ELF/LTO.h +++ lld/trunk/ELF/LTO.h @@ -56,8 +56,6 @@ std::unique_ptr IndexFile; llvm::DenseSet ThinIndices; }; - -void thinLTOCreateEmptyIndexFiles(); } // namespace elf } // namespace lld Index: lld/trunk/ELF/LTO.cpp =================================================================== --- lld/trunk/ELF/LTO.cpp +++ lld/trunk/ELF/LTO.cpp @@ -214,7 +214,7 @@ // If LazyObjFile has not been added to link, emit empty index files. // This is needed because this is what GNU gold plugin does and we have a // distributed build system that depends on that behavior. -void elf::thinLTOCreateEmptyIndexFiles() { +static void thinLTOCreateEmptyIndexFiles() { for (LazyObjFile *F : LazyObjFiles) { if (F->AddedToLink || !isBitcode(F->MB)) continue; @@ -249,12 +249,13 @@ Files[Task] = std::move(MB); })); - checkError(LTOObj->run( - [&](size_t Task) { - return llvm::make_unique( - llvm::make_unique(Buf[Task])); - }, - Cache)); + if (!BitcodeFiles.empty()) + checkError(LTOObj->run( + [&](size_t Task) { + return llvm::make_unique( + llvm::make_unique(Buf[Task])); + }, + Cache)); // Emit empty index files for non-indexed files for (StringRef S : ThinIndices) { Index: lld/trunk/ELF/SymbolTable.cpp =================================================================== --- lld/trunk/ELF/SymbolTable.cpp +++ lld/trunk/ELF/SymbolTable.cpp @@ -115,12 +115,6 @@ // Because all bitcode files that the program consists of are passed // to the compiler at once, it can do whole-program optimization. template void SymbolTable::addCombinedLTOObject() { - if (BitcodeFiles.empty()) { - if (Config->ThinLTOIndexOnly) - thinLTOCreateEmptyIndexFiles(); - return; - } - // Compile bitcode files and replace bitcode symbols. LTO.reset(new BitcodeCompiler); for (BitcodeFile *F : BitcodeFiles)