[PATCH] D123263: [BOLT] Check MCContext errors
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 15:44:32 PDT 2022
Amir created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123263
Files:
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ 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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123263.421029.patch
Type: text/x-patch
Size: 820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220406/be1dbf75/attachment.bin>
More information about the llvm-commits
mailing list