xref: /linux/arch/riscv/kernel/vmlinux.lds.S (revision 97884ca8c2925d14c32188e865069f21378b4b4f)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2012 Regents of the University of California
4 * Copyright (C) 2017 SiFive
5 */
6
7#define LOAD_OFFSET PAGE_OFFSET
8#include <asm/vmlinux.lds.h>
9#include <asm/page.h>
10#include <asm/cache.h>
11#include <asm/thread_info.h>
12#include <asm/set_memory.h>
13
14#include <linux/sizes.h>
15OUTPUT_ARCH(riscv)
16ENTRY(_start)
17
18jiffies = jiffies_64;
19
20SECTIONS
21{
22	/* Beginning of code and text segment */
23	. = LOAD_OFFSET;
24	_start = .;
25	HEAD_TEXT_SECTION
26	. = ALIGN(PAGE_SIZE);
27
28	__init_begin = .;
29	INIT_TEXT_SECTION(PAGE_SIZE)
30	INIT_DATA_SECTION(16)
31	. = ALIGN(8);
32	__soc_early_init_table : {
33		__soc_early_init_table_start = .;
34		KEEP(*(__soc_early_init_table))
35		__soc_early_init_table_end = .;
36	}
37	__soc_builtin_dtb_table : {
38		__soc_builtin_dtb_table_start = .;
39		KEEP(*(__soc_builtin_dtb_table))
40		__soc_builtin_dtb_table_end = .;
41	}
42	/* we have to discard exit text and such at runtime, not link time */
43	.exit.text :
44	{
45		EXIT_TEXT
46	}
47	.exit.data :
48	{
49		EXIT_DATA
50	}
51	PERCPU_SECTION(L1_CACHE_BYTES)
52	__init_end = .;
53
54	. = ALIGN(SECTION_ALIGN);
55	.text : {
56		_text = .;
57		_stext = .;
58		TEXT_TEXT
59		SCHED_TEXT
60		CPUIDLE_TEXT
61		LOCK_TEXT
62		KPROBES_TEXT
63		ENTRY_TEXT
64		IRQENTRY_TEXT
65		SOFTIRQENTRY_TEXT
66		*(.fixup)
67		_etext = .;
68	}
69
70	/* Start of data section */
71	_sdata = .;
72	RO_DATA(SECTION_ALIGN)
73	.srodata : {
74		*(.srodata*)
75	}
76
77	EXCEPTION_TABLE(0x10)
78
79	. = ALIGN(SECTION_ALIGN);
80	_data = .;
81
82	RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
83	.sdata : {
84		__global_pointer$ = . + 0x800;
85		*(.sdata*)
86		/* End of data section */
87		_edata = .;
88	}
89
90	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
91
92	.rel.dyn : {
93		*(.rel.dyn*)
94	}
95
96	_end = .;
97
98	STABS_DEBUG
99	DWARF_DEBUG
100
101	DISCARDS
102}
103