mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-03 05:32:24 +00:00
[BOLT] Check MCContext errors
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
This commit is contained in:
parent
82dcf30636
commit
9b02dc631d
@ -3108,6 +3108,10 @@ void RewriteInstance::emitAndLink() {
|
||||
emitBinaryContext(*Streamer, *BC, getOrgSecPrefix());
|
||||
|
||||
Streamer->Finish();
|
||||
if (Streamer->getContext().hadError()) {
|
||||
errs() << "BOLT-ERROR: Emission failed.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Assign addresses to new sections.
|
||||
@ -3137,7 +3141,7 @@ void RewriteInstance::emitAndLink() {
|
||||
|
||||
RTDyld->finalizeWithMemoryManagerLocking();
|
||||
if (RTDyld->hasError()) {
|
||||
outs() << "BOLT-ERROR: RTDyld failed: " << RTDyld->getErrorString() << "\n";
|
||||
errs() << "BOLT-ERROR: RTDyld failed: " << RTDyld->getErrorString() << "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user