Skip to content

Commit 28d7c3d

Browse files
committed
Fix assertion failure on LLVM 3.8+
1 parent 9ad1357 commit 28d7c3d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/jitlayers.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -544,24 +544,25 @@ static T *addComdat(T *G)
544544
// Add comdat information to make MSVC link.exe happy
545545
// it's valid to emit this for ld.exe too,
546546
// but makes it very slow to link for no benefit
547-
#if defined(_COMPILER_MICROSOFT_)
548547
if (G->getParent() == shadow_output) {
548+
#if defined(_COMPILER_MICROSOFT_)
549549
Comdat *jl_Comdat = G->getParent()->getOrInsertComdat(G->getName());
550550
// ELF only supports Comdat::Any
551551
jl_Comdat->setSelectionKind(Comdat::NoDuplicates);
552552
G->setComdat(jl_Comdat);
553-
}
554553
#endif
554+
#if defined(_CPU_X86_64_)
555+
// Add unwind exception personalities to functions to handle async exceptions
556+
assert(!juliapersonality_func || juliapersonality_func->getParent() == shadow_output);
557+
if (Function *F = dyn_cast<Function>(G))
558+
F->setPersonalityFn(juliapersonality_func);
559+
#endif
560+
}
555561
// add __declspec(dllexport) to everything marked for export
556562
if (G->getLinkage() == GlobalValue::ExternalLinkage)
557563
G->setDLLStorageClass(GlobalValue::DLLExportStorageClass);
558564
else
559565
G->setDLLStorageClass(GlobalValue::DefaultStorageClass);
560-
#if defined(_CPU_X86_64_)
561-
// Add unwind exception personalities to functions to handle async exceptions
562-
if (Function *F = dyn_cast<Function>(G))
563-
F->setPersonalityFn(juliapersonality_func);
564-
#endif
565566
}
566567
#endif
567568
return G;

0 commit comments

Comments
 (0)