[PATCH] D121728: [BOLT] LongJmp: Fix hot text section alignment
Vladislav Khmelevsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 05:58:09 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG62a289d85c9f: [BOLT] LongJmp: Fix hot text section alignment (authored by yota9).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121728/new/
https://reviews.llvm.org/D121728
Files:
bolt/lib/Passes/LongJmp.cpp
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -1743,6 +1743,9 @@
if (!opts::AlignText.getNumOccurrences())
opts::AlignText = BC->PageAlign;
+ if (opts::AlignText < opts::AlignFunctions)
+ opts::AlignText = (unsigned)opts::AlignFunctions;
+
if (BC->isX86() && opts::Lite.getNumOccurrences() == 0 && !opts::StrictMode &&
!opts::UseOldText)
opts::Lite = true;
Index: bolt/lib/Passes/LongJmp.cpp
===================================================================
--- bolt/lib/Passes/LongJmp.cpp
+++ bolt/lib/Passes/LongJmp.cpp
@@ -18,6 +18,7 @@
namespace opts {
extern cl::OptionCategory BoltOptCategory;
+extern llvm::cl::opt<unsigned> AlignText;
extern cl::opt<unsigned> AlignFunctions;
extern cl::opt<bool> UseOldText;
extern cl::opt<bool> HotFunctionsAtEnd;
@@ -342,7 +343,7 @@
tentativeLayoutRelocColdPart(BC, SortedFunctions, DotAddress);
ColdLayoutDone = true;
if (opts::HotFunctionsAtEnd)
- DotAddress = alignTo(DotAddress, BC.PageAlign);
+ DotAddress = alignTo(DotAddress, opts::AlignText);
}
DotAddress = alignTo(DotAddress, BinaryFunction::MinAlign);
@@ -390,11 +391,11 @@
// Initial padding
if (opts::UseOldText && EstimatedTextSize <= BC.OldTextSectionSize) {
DotAddress = BC.OldTextSectionAddress;
- uint64_t Pad = offsetToAlignment(DotAddress, llvm::Align(BC.PageAlign));
+ uint64_t Pad = offsetToAlignment(DotAddress, llvm::Align(opts::AlignText));
if (Pad + EstimatedTextSize <= BC.OldTextSectionSize)
DotAddress += Pad;
} else {
- DotAddress = alignTo(BC.LayoutStartAddress, BC.PageAlign);
+ DotAddress = alignTo(BC.LayoutStartAddress, opts::AlignText);
}
tentativeLayoutRelocMode(BC, SortedFunctions, DotAddress);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121728.415795.patch
Type: text/x-patch
Size: 1914 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220316/52da67cc/attachment.bin>
More information about the llvm-commits
mailing list