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