xref: /DragonStub/gnuefi/elf_riscv64_efi.lds (revision 58dce6991b675f6ad063bbb5a362817ba5ba55a0)
1/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */
2
3OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
4OUTPUT_ARCH(riscv)
5ENTRY(_start)
6SECTIONS
7{
8  .text 0 : {
9    *(.text.head)
10    . = ALIGN(4096);
11    _text = .;
12    *(.text)
13    *(.text.*)
14    *(.gnu.linkonce.t.*)
15    *(.plt)
16    . = ALIGN(16);
17    _evtext = .;
18    . = ALIGN(4096);
19    _etext = .;
20  } =0
21  _text_vsize = _evtext - _text;
22  _text_size = _etext - _text;
23  . = ALIGN(4096);
24  _reloc = .;
25  .reloc : {
26    *(.reloc)
27    _evreloc = .;
28    . = ALIGN(4096);
29    _ereloc = .;
30  } =0
31  _reloc_vsize = _evreloc - _reloc;
32  _reloc_size = _ereloc - _reloc;
33  . = ALIGN(4096);
34  _data = .;
35  .dynamic  : { *(.dynamic) }
36  . = ALIGN(4096);
37  .data :
38  {
39   *(.sdata)
40   *(.data)
41   *(.data1)
42   *(.data.*)
43   *(.got.plt)
44   *(.got)
45
46   /*
47    * Note that these aren't the using the GNU "CONSTRUCTOR" output section
48    * command, so they don't start with a size.  Because of p2align and the
49    * end/END definitions, and the fact that they're mergeable, they can also
50    * have NULLs which aren't guaranteed to be at the end.
51    */
52   . = ALIGN(16);
53   __init_array_start = .;
54   *(SORT(.init_array.*))
55   *(.init_array)
56   __init_array_end = .;
57  . = ALIGN(16);
58   __CTOR_LIST__ = .;
59   *(SORT(.ctors.*))
60   *(.ctors)
61   __CTOR_END__ = .;
62  . = ALIGN(16);
63   __DTOR_LIST__ = .;
64   *(SORT(.dtors.*))
65   *(.dtors)
66   __DTOR_END__ = .;
67   . = ALIGN(16);
68   __fini_array_start = .;
69   *(SORT(.fini_array.*))
70   *(.fini_array)
71   __fini_array_end = .;
72
73   /* the EFI loader doesn't seem to like a .bss section, so we stick
74      it all into .data: */
75   . = ALIGN(16);
76   _bss = .;
77   *(.sbss)
78   *(.scommon)
79   *(.dynbss)
80   *(.bss)
81   *(.bss.*)
82   *(COMMON)
83   . = ALIGN(16);
84   _bss_end = .;
85   _evdata = .;
86   . = ALIGN(4096);
87   _edata = .;
88  } =0
89  _data_vsize = _evdata - _data;
90  _data_size = _edata - _data;
91
92  . = ALIGN(4096);
93  _rodata = .;
94  .rela :
95  {
96    *(.rela.text*)
97    *(.rela.data*)
98    *(.rela.got)
99    *(.rela.dyn)
100    *(.rela.stab)
101    *(.rela.init_array*)
102    *(.rela.fini_array*)
103    *(.rela.ctors*)
104    *(.rela.dtors*)
105
106  }
107  . = ALIGN(4096);
108  .rela.plt : { *(.rela.plt) }
109  . = ALIGN(4096);
110  .rodata : {
111    *(.rodata*)
112    _evrodata = .;
113    . = ALIGN(4096);
114    _erodata = .;
115  } =0
116  _rodata_vsize = _evrodata - _rodata;
117  _rodata_size = _erodata - _rodata;
118  _image_end = .;
119  _alldata_size = _image_end - _reloc;
120
121  . = ALIGN(4096);
122  .dynsym   : { *(.dynsym) }
123  . = ALIGN(4096);
124  .dynstr   : { *(.dynstr) }
125  . = ALIGN(4096);
126  .note.gnu.build-id : { *(.note.gnu.build-id) }
127  . = ALIGN(4096);
128  .hash : { *(.hash) }
129  . = ALIGN(4096);
130  .gnu.hash : { *(.gnu.hash) }
131  . = ALIGN(4096);
132  .eh_frame : { *(.eh_frame) }
133  . = ALIGN(4096);
134  .gcc_except_table : { *(.gcc_except_table*) }
135  /DISCARD/ :
136  {
137    *(.rela.reloc)
138    *(.note.GNU-stack)
139  }
140  .comment 0 : { *(.comment) }
141}
142
143