xref: /DragonStub/gnuefi/elf_riscv64_efi.lds (revision 9835e11ebe95ed8372ac2a6671de07cc970cdee0)
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.text 0x0 :
8	{
9		_text = .;
10		*(.text.head)
11		*(.text)
12		*(.text.*)
13		*(.gnu.linkonce.t.*)
14		*(.srodata)
15		*(.rodata*)
16		. = ALIGN(16);
17	}
18	_etext = .;
19	_text_size = . - _text;
20. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
21.dynamic  :
22	{ *(.dynamic) }
23.data :
24	ALIGN(4096)
25	{
26		_data = .;
27		*(.sdata)
28		*(.data)
29		*(.data1)
30		*(.data.*)
31		*(.got.plt)
32		*(.got)
33
34		/* the EFI loader doesn't seem to like a .bss section, so we stick
35		   it all into .data: */
36		. = ALIGN(16);
37		_bss = .;
38		*(.sbss)
39		*(.scommon)
40		*(.dynbss)
41		*(.bss*)
42		*(COMMON)
43		. = ALIGN(16);
44		_bss_end = .;
45	}
46
47. = ALIGN(4096);
48.rela :
49  {
50    *(.rela.text*)
51    *(.rela.data*)
52    *(.rela.got)
53    *(.rela.dyn)
54    *(.rela.stab)
55    *(.rela.init_array)
56    *(.rela.fini_array)
57    *(.rela.ctors)
58    *(.rela.dtors)
59  }
60. = ALIGN(4096);
61.rela.plt : { *(.rela.plt) }
62	. = ALIGN(512);
63	_edata = .;
64	_data_size = . - _data;
65
66	. = ALIGN(4096);
67.dynsym   :
68	{ *(.dynsym) }
69	. = ALIGN(4096);
70.dynstr   :
71	{ *(.dynstr) }
72	. = ALIGN(4096);
73.note.gnu.build-id :
74	{ *(.note.gnu.build-id) }
75. = DATA_SEGMENT_END (.);
76/DISCARD/ :
77	{
78		*(.rel.reloc)
79		*(.eh_frame)
80		*(.note.GNU-stack)
81	}
82.comment 0 :
83	{ *(.comment) }
84}
85