
On Thu, 16 Jan 2025 at 13:39, Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
Use the same include as arm64 for the linker script.
Adjust the 32-bit ARM PE-COFF header accordingly and harmonize it with the 64-bit ARM header.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
v2: Do not rename field image_base to ImageBase. Move SizeOfCode change to separate patch.
arch/arm/lib/crt0_arm_efi.S | 9 +++-- arch/arm/lib/elf_arm_efi.lds | 71 +----------------------------------- 2 files changed, 6 insertions(+), 74 deletions(-)
diff --git a/arch/arm/lib/crt0_arm_efi.S b/arch/arm/lib/crt0_arm_efi.S index 3664cce8412..91b0fe12c51 100644 --- a/arch/arm/lib/crt0_arm_efi.S +++ b/arch/arm/lib/crt0_arm_efi.S @@ -46,8 +46,8 @@ optional_header: .long 0 /* BaseOfData */
extra_header_fields:
.long 0 /* image_base */
.long 0x200 /* SectionAlignment */
.long 0 /* ImageBase */
.long 0x1000 /* SectionAlignment */ .long 0x200 /* FileAlignment */ .short 0 /* MajorOperatingSystemVersion */ .short 0 /* MinorOperatingSystemVersion */
@@ -84,6 +84,7 @@ extra_header_fields: .quad 0 /* CertificationTable */ .quad 0 /* BaseRelocationTable */
/* Section table */
section_table:
/*
@@ -111,9 +112,9 @@ section_table: .byte 0 .byte 0 .byte 0 /* end of 0 padding of section name */
.long _text_size /* VirtualSize */
.long _etext - _start /* VirtualSize */ .long _start - image_base /* VirtualAddress */
.long _text_size /* SizeOfRawData */
.long _etext - _start /* SizeOfRawData */ .long _start - image_base /* PointerToRawData */ .long 0 /* PointerToRelocations */ .long 0 /* PointerToLineNumbers */
diff --git a/arch/arm/lib/elf_arm_efi.lds b/arch/arm/lib/elf_arm_efi.lds index 41440594aa6..eb16fae74cf 100644 --- a/arch/arm/lib/elf_arm_efi.lds +++ b/arch/arm/lib/elf_arm_efi.lds @@ -8,73 +8,4 @@ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") OUTPUT_ARCH(arm)
-PHDRS -{
data PT_LOAD FLAGS(3); /* PF_W | PF_X */
-}
-ENTRY(_start) -SECTIONS -{
.text 0x0 : {
_text = .;
*(.text.head)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
. = ALIGN(16);
*(.dynamic);
. = ALIGN(512);
}
_etext = .;
_text_size = . - _text;
. = ALIGN(4096);
.data : {
_data = .;
*(.sdata)
*(.data)
*(.data1)
*(.data.*)
*(.got.plt)
*(.got)
/*
* The EFI loader doesn't seem to like a .bss section, so we
* stick it all into .data:
*/
. = ALIGN(16);
_bss = .;
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
*(.bss.*)
*(COMMON)
. = ALIGN(512);
_bss_end = .;
_edata = .;
} :data
_data_size = . - _data;
/DISCARD/ : {
/*
* We don't support relocations. These would have to be
* translated from ELF to PE format and added to the .reloc
* section.
*/
*(.rel.dyn)
*(.rel.plt)
*(.rel.got)
*(.rel.data)
*(.rel.data*)
*(.rel.reloc)
*(.eh_frame)
*(.note.GNU-stack)
*(.dynsym)
*(.dynstr)
*(.note.gnu.build-id)
*(.comment)
}
-}
+INCLUDE lib/efi_loader/elf_efi.ldsi
2.47.1
Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org