blob: 1e046d6e2b177690f199f6597780c76b8c7d8436 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
r337282 | alc | 2018-08-04 04:30:51 +0200 (Sat, 04 Aug 2018) | 7 lines
Set the default image base on arm64 and i386 to a superpage-aligned
address.
Reviewed by: emaste, markj
Discussed with: dim
Differential Revision: https://reviews.freebsd.org/D16385
Index: tools/lld/ELF/Arch/AArch64.cpp
===================================================================
--- tools/lld/ELF/Arch/AArch64.cpp (revision 337281)
+++ tools/lld/ELF/Arch/AArch64.cpp (revision 337282)
@@ -66,6 +66,10 @@ AArch64::AArch64() {
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;
Index: tools/lld/ELF/Arch/X86.cpp
===================================================================
--- tools/lld/ELF/Arch/X86.cpp (revision 337281)
+++ tools/lld/ELF/Arch/X86.cpp (revision 337282)
@@ -61,6 +61,10 @@ X86::X86() {
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; }
|