[PATCH] D121068: [BOLT][NFC] Check section contents before registering it
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 8 09:13:14 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGced5472e09b4: [BOLT][NFC] Check section contents before registering it (authored by Amir).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121068/new/
https://reviews.llvm.org/D121068
Files:
bolt/include/bolt/Rewrite/RewriteInstance.h
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -765,7 +765,8 @@
if (Error E = discoverStorage())
return E;
- readSpecialSections();
+ if (Error E = readSpecialSections())
+ return E;
adjustCommandLineOptions();
discoverFileObjects();
@@ -1540,7 +1541,7 @@
uint64_t RewriteInstance::getLSDAAddress() { return LSDASection->getAddress(); }
-void RewriteInstance::readSpecialSections() {
+Error RewriteInstance::readSpecialSections() {
NamedRegionTimer T("readSpecialSections", "read special sections",
TimerGroupName, TimerGroupDesc, opts::TimeRewrite);
@@ -1555,6 +1556,8 @@
// Only register sections with names.
if (!SectionName.empty()) {
+ if (Error E = Section.getContents().takeError())
+ return E;
BC->registerSection(Section);
LLVM_DEBUG(
dbgs() << "BOLT-DEBUG: registering section " << SectionName << " @ 0x"
@@ -1633,6 +1636,7 @@
// Read .dynamic/PT_DYNAMIC.
readELFDynamic();
+ return Error::success();
}
void RewriteInstance::adjustCommandLineOptions() {
Index: bolt/include/bolt/Rewrite/RewriteInstance.h
===================================================================
--- bolt/include/bolt/Rewrite/RewriteInstance.h
+++ bolt/include/bolt/Rewrite/RewriteInstance.h
@@ -96,7 +96,7 @@
/// Read info from special sections. E.g. eh_frame and .gcc_except_table
/// for exception and stack unwinding information.
- void readSpecialSections();
+ Error readSpecialSections();
/// Adjust supplied command-line options based on input data.
void adjustCommandLineOptions();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121068.413830.patch
Type: text/x-patch
Size: 1762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220308/49e42166/attachment.bin>
More information about the llvm-commits
mailing list