[BOLT] Divide RegularPageSize for X86 and AArch64 cases
authorElvina Yakubova <elvinayakubova@gmail.com>
Thu, 10 Mar 2022 20:04:03 +0000 (23:04 +0300)
committerVladislav Khmelevsky <och95@yandex.ru>
Thu, 10 Mar 2022 20:09:50 +0000 (23:09 +0300)
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

bolt/include/bolt/Core/BinaryContext.h
bolt/lib/Core/BinaryContext.cpp

index ce246d5..86b2e45 100644 (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;
index 36092e3..bcae159 100644 (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;
 }