Skip to content

Commit db65429

Browse files
ElvinaYakubovayota9
authored andcommitted
[BOLT] Divide RegularPageSize for X86 and AArch64 cases
For AArch64 in some cases/some distributions ld uses 64K alignment of LOAD segments by default. Reviewed By: yota9, maksfb Differential Revision: https://reviews.llvm.org/D119267
1 parent e3dfa30 commit db65429

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ class BinaryContext {
489489
void adjustCodePadding();
490490

491491
/// Regular page size.
492-
static constexpr unsigned RegularPageSize = 0x1000;
492+
unsigned RegularPageSize{0x1000};
493+
static constexpr unsigned RegularPageSizeX86 = 0x1000;
494+
static constexpr unsigned RegularPageSizeAArch64 = 0x10000;
493495

494496
/// Huge page size to use.
495497
static constexpr unsigned HugePageSize = 0x200000;

bolt/lib/Core/BinaryContext.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ BinaryContext::BinaryContext(std::unique_ptr<MCContext> Ctx,
101101
InstPrinter(std::move(InstPrinter)), MIA(std::move(MIA)),
102102
MIB(std::move(MIB)), MRI(std::move(MRI)), DisAsm(std::move(DisAsm)) {
103103
Relocation::Arch = this->TheTriple->getArch();
104+
RegularPageSize = isAArch64() ? RegularPageSizeAArch64 : RegularPageSizeX86;
104105
PageAlign = opts::NoHugePages ? RegularPageSize : HugePageSize;
105106
}
106107

0 commit comments

Comments
 (0)