[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
This commit is contained in:
Elvina Yakubova 2022-03-10 23:04:03 +03:00 committed by Vladislav Khmelevsky
parent e3dfa30501
commit db65429db5
2 changed files with 4 additions and 1 deletions

View file

@ -489,7 +489,9 @@ public:
void adjustCodePadding();
/// Regular page size.
static constexpr unsigned RegularPageSize = 0x1000;
unsigned RegularPageSize{0x1000};
static constexpr unsigned RegularPageSizeX86 = 0x1000;
static constexpr unsigned RegularPageSizeAArch64 = 0x10000;
/// Huge page size to use.
static constexpr unsigned HugePageSize = 0x200000;

View file

@ -101,6 +101,7 @@ BinaryContext::BinaryContext(std::unique_ptr<MCContext> Ctx,
InstPrinter(std::move(InstPrinter)), MIA(std::move(MIA)),
MIB(std::move(MIB)), MRI(std::move(MRI)), DisAsm(std::move(DisAsm)) {
Relocation::Arch = this->TheTriple->getArch();
RegularPageSize = isAArch64() ? RegularPageSizeAArch64 : RegularPageSizeX86;
PageAlign = opts::NoHugePages ? RegularPageSize : HugePageSize;
}