xref: /linux/arch/riscv/kernel/vmlinux.lds.S (revision ebf68996de0ab250c5d520eb2291ab65643e9a1e)
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		*(.fixup)
50		_etext = .;
51	}
52
53	/* Start of data section */
54	_sdata = .;
55	RO_DATA_SECTION(L1_CACHE_BYTES)
56	.srodata : {
57		*(.srodata*)
58	}
59
60	RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
61	.sdata : {
62		__global_pointer$ = . + 0x800;
63		*(.sdata*)
64		/* End of data section */
65		_edata = .;
66		*(.sbss*)
67	}
68
69	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
70
71	EXCEPTION_TABLE(0x10)
72	NOTES
73
74	.rel.dyn : {
75		*(.rel.dyn*)
76	}
77
78	_end = .;
79
80	STABS_DEBUG
81	DWARF_DEBUG
82
83	DISCARDS
84}
85