For compatibility with an upcoming EDK2 feature that maps UEFI apps
using strict permissions, emit the code as split .text/.data with R-X/RW- permissions, respectively. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
This commit is contained in:
parent
f164fd6785
commit
8581a58e5b
@ -44,16 +44,16 @@ optional_header:
|
|||||||
.short 0x20b // PE32+ format
|
.short 0x20b // PE32+ format
|
||||||
.byte 0x02 // MajorLinkerVersion
|
.byte 0x02 // MajorLinkerVersion
|
||||||
.byte 0x14 // MinorLinkerVersion
|
.byte 0x14 // MinorLinkerVersion
|
||||||
.long _edata - _start // SizeOfCode
|
.long _data - _start // SizeOfCode
|
||||||
.long 0 // SizeOfInitializedData
|
.long _data_size // SizeOfInitializedData
|
||||||
.long 0 // SizeOfUninitializedData
|
.long 0 // SizeOfUninitializedData
|
||||||
.long _start - ImageBase // AddressOfEntryPoint
|
.long _start - ImageBase // AddressOfEntryPoint
|
||||||
.long _start - ImageBase // BaseOfCode
|
.long _start - ImageBase // BaseOfCode
|
||||||
|
|
||||||
extra_header_fields:
|
extra_header_fields:
|
||||||
.quad 0 // ImageBase
|
.quad 0 // ImageBase
|
||||||
.long 0x20 // SectionAlignment
|
.long 0x1000 // SectionAlignment
|
||||||
.long 0x8 // FileAlignment
|
.long 0x200 // FileAlignment
|
||||||
.short 0 // MajorOperatingSystemVersion
|
.short 0 // MajorOperatingSystemVersion
|
||||||
.short 0 // MinorOperatingSystemVersion
|
.short 0 // MinorOperatingSystemVersion
|
||||||
.short 0 // MajorImageVersion
|
.short 0 // MajorImageVersion
|
||||||
@ -85,41 +85,31 @@ extra_header_fields:
|
|||||||
|
|
||||||
// Section table
|
// Section table
|
||||||
section_table:
|
section_table:
|
||||||
|
.ascii ".text\0\0\0"
|
||||||
/*
|
.long _data - _start // VirtualSize
|
||||||
* The EFI application loader requires a relocation section
|
|
||||||
* because EFI applications must be relocatable. This is a
|
|
||||||
* dummy section as far as we are concerned.
|
|
||||||
*/
|
|
||||||
.ascii ".reloc"
|
|
||||||
.byte 0
|
|
||||||
.byte 0 // end of 0 padding of section name
|
|
||||||
.long 0
|
|
||||||
.long 0
|
|
||||||
.long 0 // SizeOfRawData
|
|
||||||
.long 0 // PointerToRawData
|
|
||||||
.long 0 // PointerToRelocations
|
|
||||||
.long 0 // PointerToLineNumbers
|
|
||||||
.short 0 // NumberOfRelocations
|
|
||||||
.short 0 // NumberOfLineNumbers
|
|
||||||
.long 0x42100040 // Characteristics (section flags)
|
|
||||||
|
|
||||||
|
|
||||||
.ascii ".text"
|
|
||||||
.byte 0
|
|
||||||
.byte 0
|
|
||||||
.byte 0 // end of 0 padding of section name
|
|
||||||
.long _edata - _start // VirtualSize
|
|
||||||
.long _start - ImageBase // VirtualAddress
|
.long _start - ImageBase // VirtualAddress
|
||||||
.long _edata - _start // SizeOfRawData
|
.long _data - _start // SizeOfRawData
|
||||||
.long _start - ImageBase // PointerToRawData
|
.long _start - ImageBase // PointerToRawData
|
||||||
|
|
||||||
.long 0 // PointerToRelocations (0 for executables)
|
.long 0 // PointerToRelocations (0 for executables)
|
||||||
.long 0 // PointerToLineNumbers (0 for executables)
|
.long 0 // PointerToLineNumbers (0 for executables)
|
||||||
.short 0 // NumberOfRelocations (0 for executables)
|
.short 0 // NumberOfRelocations (0 for executables)
|
||||||
.short 0 // NumberOfLineNumbers (0 for executables)
|
.short 0 // NumberOfLineNumbers (0 for executables)
|
||||||
.long 0xe0500020 // Characteristics (section flags)
|
.long 0x60000020 // Characteristics (section flags)
|
||||||
|
|
||||||
|
.ascii ".data\0\0\0"
|
||||||
|
.long _data_size // VirtualSize
|
||||||
|
.long _data - ImageBase // VirtualAddress
|
||||||
|
.long _data_size // SizeOfRawData
|
||||||
|
.long _data - ImageBase // PointerToRawData
|
||||||
|
|
||||||
|
.long 0 // PointerToRelocations (0 for executables)
|
||||||
|
.long 0 // PointerToLineNumbers (0 for executables)
|
||||||
|
.short 0 // NumberOfRelocations (0 for executables)
|
||||||
|
.short 0 // NumberOfLineNumbers (0 for executables)
|
||||||
|
.long 0xc0000040 // Characteristics (section flags)
|
||||||
|
|
||||||
|
.align 12
|
||||||
_start:
|
_start:
|
||||||
stp x29, x30, [sp, #-32]!
|
stp x29, x30, [sp, #-32]!
|
||||||
mov x29, sp
|
mov x29, sp
|
||||||
|
@ -16,7 +16,7 @@ SECTIONS
|
|||||||
_etext = .;
|
_etext = .;
|
||||||
_text_size = . - _text;
|
_text_size = . - _text;
|
||||||
.dynamic : { *(.dynamic) }
|
.dynamic : { *(.dynamic) }
|
||||||
.data :
|
.data : ALIGN(4096)
|
||||||
{
|
{
|
||||||
_data = .;
|
_data = .;
|
||||||
*(.sdata)
|
*(.sdata)
|
||||||
@ -43,8 +43,9 @@ SECTIONS
|
|||||||
.rela.plt : { *(.rela.plt) }
|
.rela.plt : { *(.rela.plt) }
|
||||||
.rela.got : { *(.rela.got) }
|
.rela.got : { *(.rela.got) }
|
||||||
.rela.data : { *(.rela.data) *(.rela.data*) }
|
.rela.data : { *(.rela.data) *(.rela.data*) }
|
||||||
|
. = ALIGN(512);
|
||||||
_edata = .;
|
_edata = .;
|
||||||
_data_size = . - _etext;
|
_data_size = . - _data;
|
||||||
|
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
.dynsym : { *(.dynsym) }
|
.dynsym : { *(.dynsym) }
|
||||||
|
Loading…
Reference in New Issue
Block a user