Skip to content

Commit 6fe878a

Browse files
authored
[BOLT] Modify warning when --use-old-text fails. NFC (#162731)
When --use-old-text fails, we are emitting all code meant for the original `.text` section into the new section. This could be more bytes compared to those emitted under no `--use-old-text`, especially under `--lite`. As a result, `--use-old-text` results in a larger binary, not smaller which could be confusing to the user. Add more information to the warning, including recommendation to rebuild without `--use-old-text` for smaller binary size.
1 parent ddd7fc3 commit 6fe878a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4005,10 +4005,12 @@ void RewriteInstance::mapCodeSections(BOLTLinker::SectionMapper MapSection) {
40054005
BC->outs() << '\n';
40064006
AllocationDone = true;
40074007
} else {
4008-
BC->errs() << "BOLT-WARNING: original .text too small to fit the new code"
4009-
<< " using 0x" << Twine::utohexstr(opts::AlignText)
4010-
<< " alignment. " << CodeSize << " bytes needed, have "
4011-
<< BC->OldTextSectionSize << " bytes available.\n";
4008+
BC->errs() << "BOLT-WARNING: --use-old-text failed. The original .text "
4009+
"too small to fit the new code using 0x"
4010+
<< Twine::utohexstr(opts::AlignText) << " alignment. "
4011+
<< CodeSize << " bytes needed, have " << BC->OldTextSectionSize
4012+
<< " bytes available. Rebuilding without --use-old-text may "
4013+
"produce a smaller binary\n";
40124014
opts::UseOldText = false;
40134015
}
40144016
}

0 commit comments

Comments
 (0)