Commit 1b2d73f
committed
Aarch64: use bigger section alignment
In UEFI Mantis 2549, ARM proposes to recommend 64kB section alignment in
UEFI binaries. The reason for this is that some machines may be
configured to have no pages smaller than 64kB for performance reasons,
and in such a scenario things like W^X will be impossible to correctly
implement on binaries where one section ends and another begins on the
same 64kB page.
This change makes aarch64 binaries use a 64kB rather than 4kB section
alignment. Note that this only actually changes virtual addresses, not
file addresses, so the size is unchanged:
Before:
SectionAlignment 00001000
FileAlignment 00001000
Sections:
Idx Name Size VMA LMA File off Algn
0 .eh_frame 00018c64 0000000000005000 0000000000005000 00001000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 0006bd9c 000000000001e000 000000000001e000 0001a000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .reloc 0000000a 000000000008a000 000000000008a000 00086000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .data.ident 00000088 000000000008c000 000000000008c000 00087000 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .sbatlevel 0000006c 000000000008d000 000000000008d000 00088000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .data 0002f268 000000000008e000 000000000008e000 00089000 2**2
CONTENTS, ALLOC, LOAD, DATA
6 .vendor_cert 00000010 00000000000be000 00000000000be000 000b9000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .dynamic 000000f0 00000000000bf000 00000000000bf000 000ba000 2**2
CONTENTS, ALLOC, LOAD, DATA
8 .rela 0001d760 00000000000c0000 00000000000c0000 000bb000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
9 .sbat 00000083 00000000000de000 00000000000de000 000d9000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
$ /bin/ls -l shimaa64.efi
-rwxr-xr-x. 1 pjones pjones 1036357 Oct 28 13:34 shimaa64.efi
After:
SectionAlignment 00010000
FileAlignment 00001000
Sections:
Idx Name Size VMA LMA File off Algn
0 .eh_frame 00018c64 0000000000010000 0000000000010000 00001000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 0006bd9c 0000000000030000 0000000000030000 0001a000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .reloc 0000000a 00000000000a0000 00000000000a0000 00086000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .data.ident 00000088 00000000000c0000 00000000000c0000 00087000 2**2
CONTENTS, ALLOC, LOAD, DATA
4 .sbatlevel 0000006c 00000000000d0000 00000000000d0000 00088000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .data 0002f268 00000000000e0000 00000000000e0000 00089000 2**2
CONTENTS, ALLOC, LOAD, DATA
6 .vendor_cert 00000010 0000000000110000 0000000000110000 000b9000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .dynamic 000000f0 0000000000120000 0000000000120000 000ba000 2**2
CONTENTS, ALLOC, LOAD, DATA
8 .rela 0001d760 0000000000130000 0000000000130000 000bb000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
9 .sbat 00000083 0000000000150000 0000000000150000 000d9000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
$ /bin/ls -l shimaa64.efi
-rwxr-xr-x. 1 pjones pjones 1036357 Oct 28 13:18 shimaa64.efi
On my test machine, that changes the text and data load addresses (both
physical and virtual, we're still on a 1:1 map) as follows:
Before: _text:0x0000000092FF7000 _data:0x0000000093067000
After: _text:0x0000000092F80000 _data:0x0000000093030000
Signed-off-by: Peter Jones <pjones@redhat.com>1 parent a84655c commit 1b2d73f
2 files changed
+15
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
0 commit comments