aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/conf/kernel-link.S
blob: 1a0d42faf8dbbca13a4acc64f7e35a0a08430e2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* SPDX-License-Identifier: copyleft-next-0.3.1 */
/* Copyright 2021 - 2022, Kim Kuparinen < kimi.h.kuparinen@gmail.com > */

OUTPUT_ARCH(riscv)
ENTRY(main)

SECTIONS {
	/* This is apparently necessary. I *think* it is to tell the linker that
	 * the kernel should be able to run in the bottom half of the address
	 * space, but I don't know for sure and this feels like a fairly major
	 * hack.
	 * @todo look into this further.
	 */
	. = ABSOLUTE(VM_DMAP);
	__kernel_start = .;
	.text ALIGN(4K) : AT(0) {
		*(.kernel.start);
		*(.text*);
	}

	.rodata : {
		*(.rodata*)
	}

	.data : {
		*(.data*)
	}

	.bss : {
		*(.sbss*) *(.bss*) *(COMMON)
	}

	__kernel_end = .;
	__kernel_size = __kernel_end - __kernel_start;

	.garbage : {
		*(.note*)
		*(.riscv.attributes)
	}
}