diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -3065,6 +3065,10 @@ emitBinaryContext(*Streamer, *BC, getOrgSecPrefix()); Streamer->Finish(); + if (Streamer->getContext().hadError()) { + errs() << "BOLT-ERROR: Emission failed.\n"; + exit(1); + } ////////////////////////////////////////////////////////////////////////////// // Assign addresses to new sections. @@ -3094,7 +3098,7 @@ RTDyld->finalizeWithMemoryManagerLocking(); if (RTDyld->hasError()) { - outs() << "BOLT-ERROR: RTDyld failed: " << RTDyld->getErrorString() << "\n"; + errs() << "BOLT-ERROR: RTDyld failed: " << RTDyld->getErrorString() << "\n"; exit(1); }