Skip to content

Commit

Permalink
[BOLT] Divide RegularPageSize for X86 and AArch64 cases
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ElvinaYakubova authored and yota9 committed Mar 10, 2022
1 parent e3dfa30 commit db65429
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bolt/include/bolt/Core/BinaryContext.h
Expand Up @@ -489,7 +489,9 @@ class BinaryContext {
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;
Expand Down
1 change: 1 addition & 0 deletions bolt/lib/Core/BinaryContext.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit db65429

Please sign in to comment.