File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
compiler/rustc_llvm/llvm-wrapper Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ class ModuleLinker {
49
49
StringSet<> UserBuiltinsSymbols;
50
50
std::unique_ptr<Module> SrcM;
51
51
bool SrcIsCompilerBuiltins;
52
+ bool HasLinkedCompilerBuiltins = false ;
52
53
53
54
SetVector<GlobalValue *> ValuesToLink;
54
55
@@ -512,7 +513,12 @@ bool ModuleLinker::run() {
512
513
ReplacedDstComdats.insert (DstC);
513
514
}
514
515
515
- if (SrcIsCompilerBuiltins) {
516
+ if (!SrcIsCompilerBuiltins && HasLinkedCompilerBuiltins)
517
+ llvm::report_fatal_error (
518
+ " Expect only compiler-builtins to be linked at the end." );
519
+ // We promise that compiler-builtins is linked at the end, so we only need to
520
+ // compute it once.
521
+ if (SrcIsCompilerBuiltins && !HasLinkedCompilerBuiltins) {
516
522
ModuleSymbolTable SymbolTable;
517
523
SymbolTable.addModule (&DstM);
518
524
for (auto &Sym : SymbolTable.symbols ()) {
@@ -635,6 +641,8 @@ bool ModuleLinker::run() {
635
641
HasErrors = true ;
636
642
});
637
643
}
644
+ if (SrcIsCompilerBuiltins)
645
+ HasLinkedCompilerBuiltins = true ;
638
646
if (HasErrors)
639
647
return true ;
640
648
You can’t perform that action at this time.
0 commit comments