blob: ada024c05c36aeb6ade836702c8b603d3fc41269 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: BSD-2-Clause */
Simon Glass672e82c2015-08-04 12:33:51 -06002/*
3 * U-Boot EFI linker script
4 *
Simon Glass672e82c2015-08-04 12:33:51 -06005 * Modified from usr/lib32/elf_x86_64_efi.lds in gnu-efi
6 */
7
Simon Glass672e82c2015-08-04 12:33:51 -06008OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
9OUTPUT_ARCH(i386:x86-64)
10ENTRY(_start)
11SECTIONS
12{
13 image_base = .;
14 .hash : { *(.hash) } /* this MUST come first, EFI expects it */
15 . = ALIGN(4096);
16 .eh_frame : {
17 *(.eh_frame)
18 }
19
20 . = ALIGN(4096);
21
22 .text : {
23 *(.text)
24 *(.text.*)
25 *(.gnu.linkonce.t.*)
26 }
27
28 . = ALIGN(4096);
29
30 .reloc : {
31 *(.reloc)
32 }
33
34 . = ALIGN(4096);
35
36 .data : {
37 *(.rodata*)
38 *(.got.plt)
39 *(.got)
40 *(.data*)
41 *(.sdata)
42 /* the EFI loader doesn't seem to like a .bss section, so we stick
43 * it all into .data: */
44 *(.sbss)
45 *(.scommon)
46 *(.dynbss)
Alexander Graf61c76782018-08-20 14:17:41 +020047 *(.bss*)
Simon Glass672e82c2015-08-04 12:33:51 -060048 *(COMMON)
49 *(.rel.local)
50
51 /* U-Boot lists and device tree */
52 . = ALIGN(8);
Andrew Scull5a9095c2022-05-30 10:00:04 +000053 *(SORT(__u_boot_list*));
Simon Glass672e82c2015-08-04 12:33:51 -060054 . = ALIGN(8);
55 *(.dtb*);
56 }
57
58 . = ALIGN(4096);
59 .dynamic : { *(.dynamic) }
60 . = ALIGN(4096);
61
62 .rela : {
63 *(.rela.data*)
64 *(.rela.got)
65 *(.rela.stab)
Andrew Scull5a9095c2022-05-30 10:00:04 +000066 *(.rela__u_boot_list*)
Simon Glass672e82c2015-08-04 12:33:51 -060067 }
68
69 . = ALIGN(4096);
70 .dynsym : { *(.dynsym) }
71 . = ALIGN(4096);
72 .dynstr : { *(.dynstr) }
73 . = ALIGN(4096);
Simon Glassf12a2632022-01-04 03:51:14 -070074
75 /DISCARD/ : { *(.eh_frame) }
76
Simon Glass672e82c2015-08-04 12:33:51 -060077 .ignored.reloc : {
78 *(.rela.reloc)
Simon Glass672e82c2015-08-04 12:33:51 -060079 *(.note.GNU-stack)
80 }
81
82 .comment 0 : { *(.comment) }
83}