summaryrefslogtreecommitdiff
path: root/gnuefi
diff options
context:
space:
mode:
Diffstat (limited to 'gnuefi')
-rw-r--r--gnuefi/crt0-efi-aarch64.S52
-rw-r--r--gnuefi/elf_aarch64_efi.lds5
2 files changed, 24 insertions, 33 deletions
diff --git a/gnuefi/crt0-efi-aarch64.S b/gnuefi/crt0-efi-aarch64.S
index 7a9e5c2..c300d89 100644
--- a/gnuefi/crt0-efi-aarch64.S
+++ b/gnuefi/crt0-efi-aarch64.S
@@ -44,16 +44,16 @@ optional_header:
.short 0x20b // PE32+ format
.byte 0x02 // MajorLinkerVersion
.byte 0x14 // MinorLinkerVersion
- .long _edata - _start // SizeOfCode
- .long 0 // SizeOfInitializedData
+ .long _data - _start // SizeOfCode
+ .long _data_size // SizeOfInitializedData
.long 0 // SizeOfUninitializedData
.long _start - ImageBase // AddressOfEntryPoint
.long _start - ImageBase // BaseOfCode
extra_header_fields:
.quad 0 // ImageBase
- .long 0x20 // SectionAlignment
- .long 0x8 // FileAlignment
+ .long 0x1000 // SectionAlignment
+ .long 0x200 // FileAlignment
.short 0 // MajorOperatingSystemVersion
.short 0 // MinorOperatingSystemVersion
.short 0 // MajorImageVersion
@@ -85,41 +85,31 @@ extra_header_fields:
// Section table
section_table:
-
- /*
- * 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
+ .ascii ".text\0\0\0"
+ .long _data - _start // VirtualSize
.long _start - ImageBase // VirtualAddress
- .long _edata - _start // SizeOfRawData
+ .long _data - _start // SizeOfRawData
.long _start - 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 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:
stp x29, x30, [sp, #-32]!
mov x29, sp
diff --git a/gnuefi/elf_aarch64_efi.lds b/gnuefi/elf_aarch64_efi.lds
index 85f1582..836d982 100644
--- a/gnuefi/elf_aarch64_efi.lds
+++ b/gnuefi/elf_aarch64_efi.lds
@@ -16,7 +16,7 @@ SECTIONS
_etext = .;
_text_size = . - _text;
.dynamic : { *(.dynamic) }
- .data :
+ .data : ALIGN(4096)
{
_data = .;
*(.sdata)
@@ -43,8 +43,9 @@ SECTIONS
.rela.plt : { *(.rela.plt) }
.rela.got : { *(.rela.got) }
.rela.data : { *(.rela.data) *(.rela.data*) }
+ . = ALIGN(512);
_edata = .;
- _data_size = . - _etext;
+ _data_size = . - _data;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }