[PATCH] D50297: On FreeBSD, align AArch64 and i386 image base to superpage

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 4 06:04:02 PDT 2018


dim created this revision.
dim added reviewers: emaste, grimar.
Herald added a reviewer: javed.absar.
Herald added subscribers: kristof.beyls, krytarowski, arichardson.
Herald added a reviewer: espindola.

As for FreeBSD on x86_64, the default image base for AArch64 and i386
should be aligned to a superpage appropriate for the architecture.

On AArch64, this is 2 MiB, on i386 is 4 MiB.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D50297

Files:
  ELF/Arch/AArch64.cpp
  ELF/Arch/X86.cpp


Index: ELF/Arch/X86.cpp
===================================================================
--- ELF/Arch/X86.cpp
+++ ELF/Arch/X86.cpp
@@ -60,6 +60,10 @@
   PltHeaderSize = 16;
   TlsGdRelaxSkip = 2;
   TrapInstr = 0xcccccccc; // 0xcc = INT3
+
+  // Align to the non-PAE large page size (known as a superpage or huge page).
+  // FreeBSD automatically promotes large, superpage-aligned allocations.
+  DefaultImageBase = 0x400000;
 }
 
 static bool hasBaseReg(uint8_t ModRM) { return (ModRM & 0xc7) != 0x5; }
Index: ELF/Arch/AArch64.cpp
===================================================================
--- ELF/Arch/AArch64.cpp
+++ ELF/Arch/AArch64.cpp
@@ -66,6 +66,10 @@
   PltHeaderSize = 32;
   DefaultMaxPageSize = 65536;
 
+  // Align to the 2 MiB page size (known as a superpage or huge page).
+  // FreeBSD automatically promotes 2 MiB-aligned allocations.
+  DefaultImageBase = 0x200000;
+
   // It doesn't seem to be documented anywhere, but tls on aarch64 uses variant
   // 1 of the tls structures and the tcb size is 16.
   TcbSize = 16;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50297.159182.patch
Type: text/x-patch
Size: 1051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180804/090ba692/attachment.bin>


More information about the llvm-commits mailing list