Skip to content

Commit fa80481

Browse files
committed
[IRGen] When creating a module object, mark __Swift_AST as used.
Without doing this, `__Swift_AST` gets stripped from the output. We also need to call `IGM.finalize()` before `::performLLVM()` in the `createSwiftModuleObjectFile()` function, so that we update the section to mark it as retained. rdar://123504095
1 parent f91dbb0 commit fa80481

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/IRGen/IRGen.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,8 +1655,10 @@ void swift::createSwiftModuleObjectFile(SILModule &SILMod, StringRef Buffer,
16551655
break;
16561656
}
16571657
}
1658+
IGM.addUsedGlobal(ASTSym);
16581659
ASTSym->setSection(Section);
16591660
ASTSym->setAlignment(llvm::MaybeAlign(serialization::SWIFTMODULE_ALIGNMENT));
1661+
IGM.finalize();
16601662
::performLLVM(Opts, Ctx.Diags, nullptr, nullptr, IGM.getModule(),
16611663
IGM.TargetMachine.get(),
16621664
OutputPath, Ctx.getOutputBackend(), Ctx.Stats);

0 commit comments

Comments
 (0)