Files
u-boot/arch/arm/lib/elf_aarch64_efi.lds
Simon Glass 70b5f8dc80 efi: arm: Allow --gc-sections in the EFI app
This option is used on most other boards. Leaving it disabled creates
situations where the linker fails to build, due to symbols which are
referenced only it code that would have been garbage-collected.

To keep this disabled we would need to introduce #ifdefs not needed by
other platforms, which would be annoying.

The only current reason why this cannot be enabled is that the
linker lists are lost. Add a KEEP() around these, and enable the option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-08-08 16:53:16 -06:00

101 lines
1.7 KiB
Plaintext

/* SPDX-License-Identifier: BSD-2-Clause */
/*
* U-Boot aarch64 EFI linker script
*
* Modified from elf_aarch64_efi.lds in gnu-efi
*/
OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
OUTPUT_ARCH(aarch64)
ENTRY(_start)
SECTIONS
{
. = 0;
image_base = .;
/* .hash and/or .gnu.hash MUST come first! */
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
. = ALIGN(4096);
.eh_frame : { *(.eh_frame) }
. = ALIGN(4096);
.text : {
_text = .;
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
. = ALIGN(16);
*(.dynamic);
. = ALIGN(512);
}
_etext = .;
_text_size = . - _text;
. = ALIGN(65536);
.reloc : {
KEEP (*(.reloc))
}
. = ALIGN(4096);
.data : {
_data = .;
*(.sdata)
*(.data)
*(.data1)
*(.data.*)
*(.got.plt)
*(.got)
/* U-Boot lists and device tree */
. = ALIGN(8);
KEEP(*(SORT(__u_boot_list*)));
. = ALIGN(8);
/*
* 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 = .;
_end = .;
}
_data_size = _edata - _data;
. = ALIGN(4096);
.rela : {
*(.rela.text*)
*(.rela.data*)
*(.rela.got)
*(.rela.dyn)
*(.rela.stab)
*(.rela.init_array*)
*(.rela.fini_array*)
*(.rela.ctors*)
*(.rela.dtors*)
*(.rela__u_boot_list*)
}
. = ALIGN(4096);
.dynsym : { *(.dynsym) }
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
.note.gnu.build-id : { *(.note.gnu.build-id) }
/DISCARD/ : {
*(.rel.reloc)
*(.eh_frame)
*(.note.GNU-stack)
}
.embedded_dtb : {
*(.embedded_dtb)
}
.comment 0 : { *(.comment) }
}