xref: /openbmc/linux/arch/riscv/kernel/vmlinux.lds.S (revision 0e17c50f)
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
13OUTPUT_ARCH(riscv)
14ENTRY(_start)
15
16jiffies = jiffies_64;
17
18SECTIONS
19{
20	/* Beginning of code and text segment */
21	. = LOAD_OFFSET;
22	_start = .;
23	__init_begin = .;
24	HEAD_TEXT_SECTION
25	INIT_TEXT_SECTION(PAGE_SIZE)
26	INIT_DATA_SECTION(16)
27	/* we have to discard exit text and such at runtime, not link time */
28	.exit.text :
29	{
30		EXIT_TEXT
31	}
32	.exit.data :
33	{
34		EXIT_DATA
35	}
36	PERCPU_SECTION(L1_CACHE_BYTES)
37	__init_end = .;
38
39	.text : {
40		_text = .;
41		_stext = .;
42		TEXT_TEXT
43		SCHED_TEXT
44		CPUIDLE_TEXT
45		LOCK_TEXT
46		KPROBES_TEXT
47		ENTRY_TEXT
48		IRQENTRY_TEXT
49		SOFTIRQENTRY_TEXT
50		*(.fixup)
51		_etext = .;
52	}
53
54	/* Start of data section */
55	_sdata = .;
56	RO_DATA(L1_CACHE_BYTES)
57	.srodata : {
58		*(.srodata*)
59	}
60
61	RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
62	.sdata : {
63		__global_pointer$ = . + 0x800;
64		*(.sdata*)
65		/* End of data section */
66		_edata = .;
67		*(.sbss*)
68	}
69
70	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
71
72	EXCEPTION_TABLE(0x10)
73
74	.rel.dyn : {
75		*(.rel.dyn*)
76	}
77
78	_end = .;
79
80	STABS_DEBUG
81	DWARF_DEBUG
82
83	DISCARDS
84}
85