diff options
author | Maksim Panchenko <maks@fb.com> | 2022-10-04 02:53:34 +0300 |
---|---|---|
committer | Maksim Panchenko <maks@fb.com> | 2022-10-07 21:18:37 +0300 |
commit | 3e097fab5a557a573c8982d1bbb48ddde4f02ac4 (patch) | |
tree | e8e8c40e0f344c240589cee7998dc8365b8ebe6d /bolt | |
parent | 07793f95c45b8606a21e1bdc948cd6f3b0e6461f (diff) |
[BOLT][NFC] Remove text section assertion
We can emit a binary without a new text section. Hence, the text section
assertion is not needed.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D135120
Diffstat (limited to 'bolt')
-rw-r--r-- | bolt/lib/Rewrite/RewriteInstance.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 9d658214942a..0208c0ce5419 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -3594,11 +3594,6 @@ std::vector<BinarySection *> RewriteInstance::getCodeSections() { void RewriteInstance::mapCodeSections(RuntimeDyld &RTDyld) { if (BC->HasRelocations) { - ErrorOr<BinarySection &> TextSection = - BC->getUniqueSectionByName(BC->getMainCodeSectionName()); - assert(TextSection && ".text section not found in output"); - assert(TextSection->hasValidSectionID() && ".text section should be valid"); - // Map sections for functions with pre-assigned addresses. for (BinaryFunction *InjectedFunction : BC->getInjectedBinaryFunctions()) { const uint64_t OutputAddress = InjectedFunction->getOutputAddress(); @@ -3638,7 +3633,9 @@ void RewriteInstance::mapCodeSections(RuntimeDyld &RTDyld) { } // Make sure we allocate enough space for huge pages. - if (opts::HotText) { + ErrorOr<BinarySection &> TextSection = + BC->getUniqueSectionByName(BC->getMainCodeSectionName()); + if (opts::HotText && TextSection && TextSection->hasValidSectionID()) { uint64_t HotTextEnd = TextSection->getOutputAddress() + TextSection->getOutputSize(); HotTextEnd = alignTo(HotTextEnd, BC->PageAlign); |