Abort on emission errors to prevent a malformed binary being written.
Example:
```
<unknown>:0: error: Undefined temporary symbol .Ltmp26310
<unknown>:0: error: Undefined temporary symbol .Ltmp26311
<unknown>:0: error: Undefined temporary symbol .Ltmp26312
<unknown>:0: error: Undefined temporary symbol .Ltmp26313
<unknown>:0: error: Undefined temporary symbol .Ltmp26314
<unknown>:0: error: Undefined temporary symbol .Ltmp26315
BOLT-ERROR: Emission failed.
```
Reviewed By: yota9
Differential Revision: https://reviews.llvm.org/D123263
emitBinaryContext(*Streamer, *BC, getOrgSecPrefix());
Streamer->Finish();
+ if (Streamer->getContext().hadError()) {
+ errs() << "BOLT-ERROR: Emission failed.\n";
+ exit(1);
+ }
//////////////////////////////////////////////////////////////////////////////
// Assign addresses to new sections.
RTDyld->finalizeWithMemoryManagerLocking();
if (RTDyld->hasError()) {
- outs() << "BOLT-ERROR: RTDyld failed: " << RTDyld->getErrorString() << "\n";
+ errs() << "BOLT-ERROR: RTDyld failed: " << RTDyld->getErrorString() << "\n";
exit(1);
}