xref: /DragonStub/gnuefi/elf_riscv64_efi.lds (revision cc4ef911ee2ccd47411df410dc161a35b8b35d01)
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  }
56. = ALIGN(4096);
57.rela.plt : { *(.rela.plt) }
58	. = ALIGN(512);
59	_edata = .;
60	_data_size = . - _data;
61
62	. = ALIGN(4096);
63.dynsym   :
64	{ *(.dynsym) }
65	. = ALIGN(4096);
66.dynstr   :
67	{ *(.dynstr) }
68	. = ALIGN(4096);
69.note.gnu.build-id :
70	{ *(.note.gnu.build-id) }
71. = DATA_SEGMENT_END (.);
72/DISCARD/ :
73	{
74		*(.rel.reloc)
75		*(.eh_frame)
76		*(.note.GNU-stack)
77	}
78.comment 0 :
79	{ *(.comment) }
80}
81