xref: /openbmc/linux/arch/riscv/kernel/vmlinux.lds.S (revision 297e77e5)
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	_stext = .;
26	HEAD_TEXT_SECTION
27	. = ALIGN(PAGE_SIZE);
28
29	__init_begin = .;
30	INIT_TEXT_SECTION(PAGE_SIZE)
31	INIT_DATA_SECTION(16)
32	. = ALIGN(8);
33	__soc_early_init_table : {
34		__soc_early_init_table_start = .;
35		KEEP(*(__soc_early_init_table))
36		__soc_early_init_table_end = .;
37	}
38	__soc_builtin_dtb_table : {
39		__soc_builtin_dtb_table_start = .;
40		KEEP(*(__soc_builtin_dtb_table))
41		__soc_builtin_dtb_table_end = .;
42	}
43	/* we have to discard exit text and such at runtime, not link time */
44	.exit.text :
45	{
46		EXIT_TEXT
47	}
48	.exit.data :
49	{
50		EXIT_DATA
51	}
52	PERCPU_SECTION(L1_CACHE_BYTES)
53	__init_end = .;
54
55	. = ALIGN(SECTION_ALIGN);
56	.text : {
57		_text = .;
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