xref: /openbmc/linux/arch/riscv/kernel/vmlinux.lds.S (revision 4a075bd4)
1/*
2 * Copyright (C) 2012 Regents of the University of California
3 * Copyright (C) 2017 SiFive
4 *
5 *   This program is free software; you can redistribute it and/or
6 *   modify it under the terms of the GNU General Public License
7 *   as published by the Free Software Foundation, version 2.
8 *
9 *   This program is distributed in the hope that it will be useful,
10 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 *   GNU General Public License for more details.
13 */
14
15#define LOAD_OFFSET PAGE_OFFSET
16#include <asm/vmlinux.lds.h>
17#include <asm/page.h>
18#include <asm/cache.h>
19#include <asm/thread_info.h>
20
21OUTPUT_ARCH(riscv)
22ENTRY(_start)
23
24jiffies = jiffies_64;
25
26SECTIONS
27{
28	/* Beginning of code and text segment */
29	. = LOAD_OFFSET;
30	_start = .;
31	__init_begin = .;
32	HEAD_TEXT_SECTION
33	INIT_TEXT_SECTION(PAGE_SIZE)
34	INIT_DATA_SECTION(16)
35	/* we have to discard exit text and such at runtime, not link time */
36	.exit.text :
37	{
38		EXIT_TEXT
39	}
40	.exit.data :
41	{
42		EXIT_DATA
43	}
44	PERCPU_SECTION(L1_CACHE_BYTES)
45	__init_end = .;
46
47	.text : {
48		_text = .;
49		_stext = .;
50		TEXT_TEXT
51		SCHED_TEXT
52		CPUIDLE_TEXT
53		LOCK_TEXT
54		KPROBES_TEXT
55		ENTRY_TEXT
56		IRQENTRY_TEXT
57		*(.fixup)
58		_etext = .;
59	}
60
61	/* Start of data section */
62	_sdata = .;
63	RO_DATA_SECTION(L1_CACHE_BYTES)
64	.srodata : {
65		*(.srodata*)
66	}
67
68	RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
69	.sdata : {
70		__global_pointer$ = . + 0x800;
71		*(.sdata*)
72		/* End of data section */
73		_edata = .;
74		*(.sbss*)
75	}
76
77	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
78
79	EXCEPTION_TABLE(0x10)
80	NOTES
81
82	.rel.dyn : {
83		*(.rel.dyn*)
84	}
85
86	_end = .;
87
88	STABS_DEBUG
89	DWARF_DEBUG
90
91	DISCARDS
92}
93