• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#include "image-vars.h"
14
15#include <linux/sizes.h>
16OUTPUT_ARCH(riscv)
17ENTRY(_start)
18
19jiffies = jiffies_64;
20
21PECOFF_SECTION_ALIGNMENT = 0x1000;
22PECOFF_FILE_ALIGNMENT = 0x200;
23
24SECTIONS
25{
26	/* Beginning of code and text segment */
27	. = LOAD_OFFSET;
28	_start = .;
29	HEAD_TEXT_SECTION
30	. = ALIGN(PAGE_SIZE);
31
32	__init_begin = .;
33	INIT_TEXT_SECTION(PAGE_SIZE)
34	. = ALIGN(8);
35	__soc_early_init_table : {
36		__soc_early_init_table_start = .;
37		KEEP(*(__soc_early_init_table))
38		__soc_early_init_table_end = .;
39	}
40	__soc_builtin_dtb_table : {
41		__soc_builtin_dtb_table_start = .;
42		KEEP(*(__soc_builtin_dtb_table))
43		__soc_builtin_dtb_table_end = .;
44	}
45	/* we have to discard exit text and such at runtime, not link time */
46	.exit.text :
47	{
48		EXIT_TEXT
49	}
50	.exit.data :
51	{
52		EXIT_DATA
53	}
54	PERCPU_SECTION(L1_CACHE_BYTES)
55	__init_end = .;
56
57	. = ALIGN(SECTION_ALIGN);
58	.text : {
59		_text = .;
60		_stext = .;
61		TEXT_TEXT
62		SCHED_TEXT
63		CPUIDLE_TEXT
64		LOCK_TEXT
65		KPROBES_TEXT
66		ENTRY_TEXT
67		IRQENTRY_TEXT
68		SOFTIRQENTRY_TEXT
69		*(.fixup)
70		_etext = .;
71	}
72
73#ifdef CONFIG_EFI
74	. = ALIGN(PECOFF_SECTION_ALIGNMENT);
75	__pecoff_text_end = .;
76#endif
77
78	INIT_DATA_SECTION(16)
79
80	/* Start of data section */
81	_sdata = .;
82	RO_DATA(SECTION_ALIGN)
83	.srodata : {
84		*(.srodata*)
85	}
86
87	EXCEPTION_TABLE(0x10)
88
89	. = ALIGN(SECTION_ALIGN);
90	_data = .;
91
92	RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
93	.sdata : {
94		__global_pointer$ = . + 0x800;
95		*(.sdata*)
96	}
97
98#ifdef CONFIG_EFI
99	.pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
100	__pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end);
101#endif
102
103	/* End of data section */
104	_edata = .;
105
106	BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
107
108	.rel.dyn : {
109		*(.rel.dyn*)
110	}
111
112#ifdef CONFIG_EFI
113	. = ALIGN(PECOFF_SECTION_ALIGNMENT);
114	__pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end);
115#endif
116	_end = .;
117
118	STABS_DEBUG
119	DWARF_DEBUG
120	ELF_DETAILS
121
122	DISCARDS
123}
124