xref: /linux/arch/riscv/kernel/vmlinux.lds.S (revision c01044cc819160323f3ca4acd44fca487c4432e6)
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	. = ALIGN(8);
31	__soc_early_init_table : {
32		__soc_early_init_table_start = .;
33		KEEP(*(__soc_early_init_table))
34		__soc_early_init_table_end = .;
35	}
36	__soc_builtin_dtb_table : {
37		__soc_builtin_dtb_table_start = .;
38		KEEP(*(__soc_builtin_dtb_table))
39		__soc_builtin_dtb_table_end = .;
40	}
41	/* we have to discard exit text and such at runtime, not link time */
42	.exit.text :
43	{
44		EXIT_TEXT
45	}
46	.exit.data :
47	{
48		EXIT_DATA
49	}
50	PERCPU_SECTION(L1_CACHE_BYTES)
51	__init_end = .;
52
53	. = ALIGN(SECTION_ALIGN);
54	.text : {
55		_text = .;
56		_stext = .;
57		TEXT_TEXT
58		SCHED_TEXT
59		CPUIDLE_TEXT
60		LOCK_TEXT
61		KPROBES_TEXT
62		ENTRY_TEXT
63		IRQENTRY_TEXT
64		SOFTIRQENTRY_TEXT
65		*(.fixup)
66		_etext = .;
67	}
68
69	INIT_DATA_SECTION(16)
70
71	/* Start of data section */
72	_sdata = .;
73	RO_DATA(SECTION_ALIGN)
74	.srodata : {
75		*(.srodata*)
76	}
77
78	EXCEPTION_TABLE(0x10)
79
80	. = ALIGN(SECTION_ALIGN);
81	_data = .;
82
83	RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
84	.sdata : {
85		__global_pointer$ = . + 0x800;
86		*(.sdata*)
87		/* End of data section */
88		_edata = .;
89	}
90
91	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
92
93	.rel.dyn : {
94		*(.rel.dyn*)
95	}
96
97	_end = .;
98
99	STABS_DEBUG
100	DWARF_DEBUG
101	ELF_DETAILS
102
103	DISCARDS
104}
105