const Comdat *C = Base->getComdat();
if (C)
sym.comdat_key = strdup(C->getName().str().c_str());
- else if (Base->hasWeakLinkage() || Base->hasLinkOnceLinkage())
- sym.comdat_key = strdup(sym.name);
}
sym.resolution = LDPR_UNKNOWN;
public:
LocalValueMaterializer(DenseSet<GlobalValue *> &Dropped) : Dropped(Dropped) {}
- Value *materializeValueFor(Value *V) override;
+ Value *materializeDeclFor(Value *V) override;
};
}
-Value *LocalValueMaterializer::materializeValueFor(Value *V) {
+Value *LocalValueMaterializer::materializeDeclFor(Value *V) {
auto *GO = dyn_cast<GlobalObject>(V);
if (!GO)
return nullptr;
MemoryBufferRef BufferRef(StringRef((const char *)View, Info.filesize),
Info.name);
+
+ // Don't bother trying to build an index if there is no summary information
+ // in this bitcode file.
+ if (!object::FunctionIndexObjectFile::hasFunctionSummaryInMemBuffer(
+ BufferRef, diagnosticHandler))
+ return std::unique_ptr<FunctionInfoIndex>(nullptr);
+
ErrorOr<std::unique_ptr<object::FunctionIndexObjectFile>> ObjOrErr =
object::FunctionIndexObjectFile::create(BufferRef, diagnosticHandler);
std::unique_ptr<FunctionInfoIndex> Index =
getFunctionIndexForFile(F, File);
+
+ // Skip files without a function summary.
+ if (!Index)
+ continue;
+
CombinedIndex.mergeFrom(std::move(Index), ++NextModuleId);
}
}
std::unique_ptr<Module> Combined(new Module("ld-temp.o", Context));
- Linker L(Combined.get());
+ Linker L(*Combined, diagnosticHandler);
std::string DefaultTriple = sys::getDefaultTargetTriple();
M->setTargetTriple(DefaultTriple);
}
- if (L.linkInModule(M.get()))
+ if (L.linkInModule(*M))
message(LDPL_FATAL, "Failed to link module");
if (release_input_file(F.handle) != LDPS_OK)
message(LDPL_FATAL, "Failed to release file information");
path = output_name;
else
path = output_name + ".bc";
- saveBCFile(path, *L.getModule());
+ saveBCFile(path, *Combined);
if (options::TheOutputType == options::OT_BC_ONLY)
return LDPS_OK;
}