diff options
author | Elvina Yakubova <elvinayakubova@gmail.com> | 2022-03-10 23:04:03 +0300 |
---|---|---|
committer | Vladislav Khmelevsky <och95@yandex.ru> | 2022-03-10 23:09:50 +0300 |
commit | db65429db522da455dc00898cdc4b20973ca68ce (patch) | |
tree | 95b775048ef3e72bf02ce17684cfca8905b3983e | |
parent | e3dfa30501c55c4c4cb10e7554b404afa400cc08 (diff) |
[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
-rw-r--r-- | bolt/include/bolt/Core/BinaryContext.h | 4 | ||||
-rw-r--r-- | bolt/lib/Core/BinaryContext.cpp | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h index ce246d51281a..86b2e45661a0 100644 --- a/bolt/include/bolt/Core/BinaryContext.h +++ b/bolt/include/bolt/Core/BinaryContext.h @@ -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; diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp index 36092e3a945f..bcae159ddc39 100644 --- a/bolt/lib/Core/BinaryContext.cpp +++ b/bolt/lib/Core/BinaryContext.cpp @@ -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; } |