mirror of
https://github.com/ipxe/ipxe
synced 2025-12-20 12:00:19 +03:00
[efi] Align EFI image sections by page size
For optimal memory permission management, PE sections need to be aligned by the platform's minimum page size. Currently, the PE section alignment is fixed to 32 bytes, which is below the typical 4kB page size. Align all sections to 4kB and adjust ELF to PE image conversion accordingly. Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
This commit is contained in:
committed by
Michael Brown
parent
1cc8756511
commit
f1e9e2b062
@@ -8,22 +8,22 @@
|
||||
SECTIONS {
|
||||
|
||||
/* The file starts at a virtual address of zero, and sections are
|
||||
* contiguous. Each section is aligned to at least _max_align,
|
||||
* which defaults to 32. Load addresses are equal to virtual
|
||||
* contiguous. Each section is aligned to at least _page_align,
|
||||
* which defaults to 4096. Load addresses are equal to virtual
|
||||
* addresses.
|
||||
*/
|
||||
|
||||
_max_align = 32;
|
||||
_page_align = 4096;
|
||||
|
||||
/* Allow plenty of space for file headers */
|
||||
. = 0x1000;
|
||||
/* Allow one page of space for file headers, common PE/COFF layout */
|
||||
. = _page_align;
|
||||
|
||||
/*
|
||||
* The text section
|
||||
*
|
||||
*/
|
||||
|
||||
. = ALIGN ( _max_align );
|
||||
. = ALIGN ( _page_align );
|
||||
.text : {
|
||||
_text = .;
|
||||
*(.text)
|
||||
@@ -36,7 +36,7 @@ SECTIONS {
|
||||
*
|
||||
*/
|
||||
|
||||
. = ALIGN ( _max_align );
|
||||
. = ALIGN ( _page_align );
|
||||
.rodata : {
|
||||
_rodata = .;
|
||||
*(.rodata)
|
||||
@@ -49,7 +49,7 @@ SECTIONS {
|
||||
*
|
||||
*/
|
||||
|
||||
. = ALIGN ( _max_align );
|
||||
. = ALIGN ( _page_align );
|
||||
.data : {
|
||||
_data = .;
|
||||
*(.data)
|
||||
@@ -65,7 +65,7 @@ SECTIONS {
|
||||
*
|
||||
*/
|
||||
|
||||
. = ALIGN ( _max_align );
|
||||
. = ALIGN ( _page_align );
|
||||
.bss : {
|
||||
_bss = .;
|
||||
*(.bss)
|
||||
|
||||
Reference in New Issue
Block a user