Merge pull request #1854 from mdlemay/fix-efi-align

x86: Fix section alignment for EFI binaries
This commit is contained in:
Nicolas Tsiftes 2016-12-08 20:18:50 +01:00 committed by GitHub
commit 3030422830
1 changed files with 16 additions and 4 deletions

View File

@ -52,14 +52,26 @@ SECTIONS {
*/
. = 1M + 0x220;
.text ALIGN (32) :
.text : ALIGN (32)
{
KEEP(*(.multiboot))
*(.boot_text)
*(.text*)
}
.rodata ALIGN (32) :
/*
The alignment directive must be placed after the colon so that the desired
alignment is indicated in the ELF section metadata. This metadata is used
by the UEFI GenFw program. It is necessary to avoid specifying a smaller
alignment value in the ELF metadata for some section "B" that follows some
section "A" with an ending address that is not aligned on a 32-byte boundary.
In that case, GenFw may place section "B" at a lower starting address in the
EFI binary than section "B" had in the input ELF file. This may result in
incorrect program behavior. Note that this situation is not directly visible
in the EFI binary metadata, since GenFw combines the ELF .rodata, .data, and
.bss sections into a single .data section in the EFI binary.
*/
.rodata : ALIGN (32)
{
*(.rodata*)
@ -72,12 +84,12 @@ SECTIONS {
_edata_shared_isr = .;
}
.data ALIGN (32) :
.data : ALIGN (32)
{
*(.data*)
}
.bss ALIGN (32) :
.bss : ALIGN (32)
{
*(COMMON)
*(.main_stack)