xref: /DragonStub/gnuefi/elf_riscv64_efi.lds (revision 0f9c15fe4fd4b37691fdb505794b0d73df21d4d5)
1*0f9c15feSbmeng@tinylab.org/* SPDX-License-Identifier: GPL-2.0+ OR BSD-2-Clause */
2b95f138fSHeinrich Schuchardt
3b95f138fSHeinrich SchuchardtOUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
4b95f138fSHeinrich SchuchardtOUTPUT_ARCH(riscv)
5b95f138fSHeinrich SchuchardtENTRY(_start)
6b95f138fSHeinrich SchuchardtSECTIONS {
7b95f138fSHeinrich Schuchardt.text 0x0 :
8b95f138fSHeinrich Schuchardt	{
9b95f138fSHeinrich Schuchardt		_text = .;
10b95f138fSHeinrich Schuchardt		*(.text.head)
11b95f138fSHeinrich Schuchardt		*(.text)
12b95f138fSHeinrich Schuchardt		*(.text.*)
13b95f138fSHeinrich Schuchardt		*(.gnu.linkonce.t.*)
14b95f138fSHeinrich Schuchardt		*(.srodata)
15b95f138fSHeinrich Schuchardt		*(.rodata*)
16b95f138fSHeinrich Schuchardt		. = ALIGN(16);
17b95f138fSHeinrich Schuchardt	}
18b95f138fSHeinrich Schuchardt	_etext = .;
19b95f138fSHeinrich Schuchardt	_text_size = . - _text;
2098f12507SLetu Ren. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
21b95f138fSHeinrich Schuchardt.dynamic  :
22b95f138fSHeinrich Schuchardt	{ *(.dynamic) }
23b95f138fSHeinrich Schuchardt.data :
24b95f138fSHeinrich Schuchardt	ALIGN(4096)
25b95f138fSHeinrich Schuchardt	{
26b95f138fSHeinrich Schuchardt		_data = .;
27b95f138fSHeinrich Schuchardt		*(.sdata)
28b95f138fSHeinrich Schuchardt		*(.data)
29b95f138fSHeinrich Schuchardt		*(.data1)
30b95f138fSHeinrich Schuchardt		*(.data.*)
31b95f138fSHeinrich Schuchardt		*(.got.plt)
32b95f138fSHeinrich Schuchardt		*(.got)
33b95f138fSHeinrich Schuchardt
34b95f138fSHeinrich Schuchardt		/* the EFI loader doesn't seem to like a .bss section, so we stick
35b95f138fSHeinrich Schuchardt		   it all into .data: */
36b95f138fSHeinrich Schuchardt		. = ALIGN(16);
37b95f138fSHeinrich Schuchardt		_bss = .;
38b95f138fSHeinrich Schuchardt		*(.sbss)
39b95f138fSHeinrich Schuchardt		*(.scommon)
40b95f138fSHeinrich Schuchardt		*(.dynbss)
4115f10734SCallum Farmer		*(.bss*)
42b95f138fSHeinrich Schuchardt		*(COMMON)
43b95f138fSHeinrich Schuchardt		. = ALIGN(16);
44b95f138fSHeinrich Schuchardt		_bss_end = .;
45b95f138fSHeinrich Schuchardt	}
46b95f138fSHeinrich Schuchardt
47eea6d31aSCallum Farmer.rela :
48eea6d31aSCallum Farmer  {
49eea6d31aSCallum Farmer    *(.rela.text*)
50eea6d31aSCallum Farmer    *(.rela.data*)
51eea6d31aSCallum Farmer    *(.rela.got)
5202f96e8aSCallum Farmer    *(.rela.dyn)
53eea6d31aSCallum Farmer    *(.rela.stab)
54eea6d31aSCallum Farmer  }
551a10c661SCallum Farmer. = ALIGN(4096);
561a10c661SCallum Farmer.rela.plt : { *(.rela.plt) }
57b95f138fSHeinrich Schuchardt	. = ALIGN(512);
58b95f138fSHeinrich Schuchardt	_edata = .;
59b95f138fSHeinrich Schuchardt	_data_size = . - _data;
60b95f138fSHeinrich Schuchardt
61b95f138fSHeinrich Schuchardt	. = ALIGN(4096);
62b95f138fSHeinrich Schuchardt.dynsym   :
63b95f138fSHeinrich Schuchardt	{ *(.dynsym) }
64b95f138fSHeinrich Schuchardt	. = ALIGN(4096);
65b95f138fSHeinrich Schuchardt.dynstr   :
66b95f138fSHeinrich Schuchardt	{ *(.dynstr) }
67b95f138fSHeinrich Schuchardt	. = ALIGN(4096);
68b95f138fSHeinrich Schuchardt.note.gnu.build-id :
69b95f138fSHeinrich Schuchardt	{ *(.note.gnu.build-id) }
70231c7632SCallum Farmer. = DATA_SEGMENT_END (.);
71b95f138fSHeinrich Schuchardt/DISCARD/ :
72b95f138fSHeinrich Schuchardt	{
73b95f138fSHeinrich Schuchardt		*(.rel.reloc)
74b95f138fSHeinrich Schuchardt		*(.eh_frame)
75b95f138fSHeinrich Schuchardt		*(.note.GNU-stack)
76b95f138fSHeinrich Schuchardt	}
77b95f138fSHeinrich Schuchardt.comment 0 :
78b95f138fSHeinrich Schuchardt	{ *(.comment) }
79b95f138fSHeinrich Schuchardt}
80