diff --git a/efi/crt0/crt0-efi-arm.S b/efi/crt0/crt0-efi-arm.S index 2c00906..af75d74 100644 --- a/efi/crt0/crt0-efi-arm.S +++ b/efi/crt0/crt0-efi-arm.S @@ -45,11 +45,11 @@ optional_header: .2byte 0x10b // PE32+ format .byte 0x02 // MajorLinkerVersion .byte 0x14 // MinorLinkerVersion - .4byte _etext - _start // SizeOfCode + .4byte _text_size - ImageBase // SizeOfCode .4byte _alldata_size - ImageBase // SizeOfInitializedData .4byte 0 // SizeOfUninitializedData .4byte _start - ImageBase // AddressOfEntryPoint - .4byte _start - ImageBase // BaseOfCode + .4byte _text - ImageBase // BaseOfCode .4byte _reloc - ImageBase // BaseOfData extra_header_fields: @@ -67,7 +67,7 @@ extra_header_fields: .4byte _image_end - ImageBase // SizeOfImage // Everything before the kernel image is considered part of the header - .4byte _start - ImageBase // SizeOfHeaders + .4byte _text - ImageBase // SizeOfHeaders .4byte 0 // CheckSum .2byte EFI_SUBSYSTEM // Subsystem .2byte 0 // DllCharacteristics @@ -100,10 +100,10 @@ extra_header_fields: section_table: .ascii ".text\0\0\0" - .4byte _evtext - _start // VirtualSize - .4byte _start - ImageBase // VirtualAddress - .4byte _etext - _start // SizeOfRawData - .4byte _start - ImageBase // PointerToRawData + .4byte _text_vsize - ImageBase // VirtualSize + .4byte _text - ImageBase // VirtualAddress + .4byte _text_size - ImageBase // SizeOfRawData + .4byte _text - ImageBase // PointerToRawData .4byte 0 // PointerToRelocations (0 for executables) .4byte 0 // PointerToLineNumbers (0 for executables) .2byte 0 // NumberOfRelocations (0 for executables) @@ -173,7 +173,7 @@ section_table: .4byte 0x40000040 // Characteristics (section flags) #endif -.balign 256 +.text .globl _start .type _start,%function _start: @@ -184,7 +184,8 @@ _start: adr r1, .L_DYNAMIC ldr r0, [r1] add r1, r0, r1 - adr r0, ImageBase + adr r0, _start + sub r0, r0, #0x1000 bl _relocate teq r0, #0 bne 0f diff --git a/efi/lds/elf_arm_efi.lds b/efi/lds/elf_arm_efi.lds index 0ec597a..4aade31 100644 --- a/efi/lds/elf_arm_efi.lds +++ b/efi/lds/elf_arm_efi.lds @@ -5,6 +5,7 @@ SECTIONS { .text 0 : { *(.text.head) + . = 0x1000; _text = .; *(.text) *(.text.*)