x86: Add support for U-Boot as an EFI application
[oweals/u-boot.git] / arch / x86 / cpu / efi / elf_ia32_efi.lds
1 /*
2  * U-Boot EFI linker script
3  *
4  * SPDX-License-Identifier:     BSD-2-Clause
5  *
6  * Modified from usr/lib32/elf_ia32_efi.lds in gnu-efi
7  */
8
9 #include <config.h>
10
11 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
12 OUTPUT_ARCH(i386)
13 ENTRY(_start)
14 SECTIONS
15 {
16         image_base = .;
17         .hash : { *(.hash) }    /* this MUST come first, EFI expects it */
18         . = ALIGN(4096);
19         .text :
20         {
21                 *(.text)
22                 *(.text.*)
23                 *(.gnu.linkonce.t.*)
24         }
25         . = ALIGN(4096);
26         .sdata :
27         {
28                 *(.got.plt)
29                 *(.got)
30                 *(.srodata)
31                 *(.sdata)
32                 *(.sbss)
33                 *(.scommon)
34         }
35         . = ALIGN(4096);
36         .data :
37         {
38                 *(.rodata*)
39                 *(.data)
40                 *(.data1)
41                 *(.data.*)
42                 *(.sdata)
43                 *(.got.plt)
44                 *(.got)
45                 /*
46                  * the EFI loader doesn't seem to like a .bss section, so we
47                  * stick it all into .data:
48                  */
49                 *(.sbss)
50                 *(.scommon)
51                 *(.dynbss)
52                 *(.bss)
53                 *(COMMON)
54
55                 /* U-Boot lists and device tree */
56                 . = ALIGN(8);
57                 *(SORT(.u_boot_list*));
58                 . = ALIGN(8);
59                 *(.dtb*);
60         }
61
62         . = ALIGN(4096);
63         .dynamic  : { *(.dynamic) }
64         . = ALIGN(4096);
65         .rel :
66         {
67                 *(.rel.data)
68                 *(.rel.data.*)
69                 *(.rel.got)
70                 *(.rel.stab)
71                 *(.data.rel.ro.local)
72                 *(.data.rel.local)
73                 *(.data.rel.ro)
74                 *(.data.rel*)
75                 *(.rel.u_boot_list*)
76         }
77         . = ALIGN(4096);
78                 .reloc :        /* This is the PECOFF .reloc section! */
79         {
80         *(.reloc)
81         }
82         . = ALIGN(4096);
83         .dynsym   : { *(.dynsym) }
84         . = ALIGN(4096);
85         .dynstr   : { *(.dynstr) }
86         . = ALIGN(4096);
87         /DISCARD/ :
88         {
89                 *(.rel.reloc)
90                 *(.eh_frame)
91                 *(.note.GNU-stack)
92         }
93         .comment 0 : { *(.comment) }
94 }