File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -2709,7 +2709,19 @@ void LinkerDriver::compileBitcodeFiles(bool skipLinkedOutput) {
27092709 if (!ctx.bitcodeFiles .empty ())
27102710 markBuffersAsDontNeed (ctx, skipLinkedOutput);
27112711
2712- ltoObjectFiles = lto->compile ();
2712+ llvm::Triple tt (ctx.bitcodeFiles .front ()->obj ->getTargetTriple ());
2713+ llvm::BumpPtrAllocator alloc;
2714+ llvm::StringSaver saver (alloc);
2715+ SmallVector<const char *> bitcodeLibFuncs;
2716+ for (const char *libFunc : lto::LTO::getLibFuncSymbols (tt, saver)) {
2717+ Symbol *sym = ctx.symtab ->find (libFunc);
2718+ if (!sym)
2719+ continue ;
2720+ if (isa<BitcodeFile>(sym->file ))
2721+ bitcodeLibFuncs.push_back (libFunc);
2722+ }
2723+
2724+ ltoObjectFiles = lto->compile (bitcodeLibFuncs);
27132725 for (auto &file : ltoObjectFiles) {
27142726 auto *obj = cast<ObjFile<ELFT>>(file.get ());
27152727 obj->parse (/* ignoreComdats=*/ true );
Original file line number Diff line number Diff line change @@ -235,6 +235,8 @@ void BitcodeCompiler::add(BitcodeFile &f) {
235235 const lto::InputFile::Symbol &objSym = objSyms[i];
236236 lto::SymbolResolution &r = resols[i];
237237
238+ dbgs () << sym->
239+
238240 // Ideally we shouldn't check for SF_Undefined but currently IRObjectFile
239241 // reports two symbols for module ASM defined. Without this check, lld
240242 // flags an undefined in IR with a definition in ASM as prevailing.
@@ -311,7 +313,8 @@ static void thinLTOCreateEmptyIndexFiles(Ctx &ctx) {
311313
312314// Merge all the bitcode files we have seen, codegen the result
313315// and return the resulting ObjectFile(s).
314- SmallVector<std::unique_ptr<InputFile>, 0 > BitcodeCompiler::compile () {
316+ SmallVector<std::unique_ptr<InputFile>, 0 >
317+ BitcodeCompiler::compile (const SmallVector<const char *> &bitcodeLibfuncs) {
315318 unsigned maxTasks = ltoObj->getMaxTasks ();
316319 buf.resize (maxTasks);
317320 files.resize (maxTasks);
Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ class BitcodeCompiler {
4242 ~BitcodeCompiler ();
4343
4444 void add (BitcodeFile &f);
45- SmallVector<std::unique_ptr<InputFile>, 0 > compile ();
45+ SmallVector<std::unique_ptr<InputFile>, 0 >
46+ compile (const SmallVector<const char *> &bitcodeLibfuncs);
4647
4748private:
4849 Ctx &ctx;
You can’t perform that action at this time.
0 commit comments