[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
This commit is contained in:
Maksim Panchenko 2022-10-03 16:53:34 -07:00
parent 07793f95c4
commit 3e097fab5a
1 changed files with 3 additions and 6 deletions

View File

@ -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);