[ORC] Add an early out for MachOPlatform's init-scraper plugin setup.

If there's no initializer symbol in the current MaterializationResponsibility
then bail out without installing JITLink passes: they're going to be no-ops
anyway.
This commit is contained in:
Lang Hames 2020-09-01 20:00:21 -07:00
parent 7ff335a25f
commit c40ce0da71
1 changed files with 3 additions and 0 deletions

View File

@ -299,6 +299,9 @@ void MachOPlatform::InitScraperPlugin::modifyPassConfig(
MaterializationResponsibility &MR, const Triple &TT,
jitlink::PassConfiguration &Config) {
if (!MR.getInitializerSymbol())
return;
Config.PrePrunePasses.push_back([this, &MR](jitlink::LinkGraph &G) -> Error {
JITLinkSymbolVector InitSectionSymbols;
preserveInitSectionIfPresent(InitSectionSymbols, G, "__mod_init_func");