xref: /openbmc/linux/arch/sh/kernel/vmlinux.lds.S (revision 9be08a27)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * ld script to make SuperH Linux kernel
4 * Written by Niibe Yutaka and Paul Mundt
5 */
6#ifdef CONFIG_SUPERH64
7#define LOAD_OFFSET	PAGE_OFFSET
8OUTPUT_ARCH(sh:sh5)
9#else
10#define LOAD_OFFSET	0
11OUTPUT_ARCH(sh)
12#endif
13
14#include <asm/thread_info.h>
15#include <asm/cache.h>
16#include <asm/vmlinux.lds.h>
17
18#ifdef CONFIG_PMB
19 #define MEMORY_OFFSET	0
20#else
21 #define MEMORY_OFFSET	__MEMORY_START
22#endif
23
24ENTRY(_start)
25SECTIONS
26{
27	. = PAGE_OFFSET + MEMORY_OFFSET + PHYSICAL_OFFSET + CONFIG_ZERO_PAGE_OFFSET;
28
29	_text = .;		/* Text and read-only data */
30
31	.empty_zero_page : AT(ADDR(.empty_zero_page) - LOAD_OFFSET) {
32		*(.empty_zero_page)
33	} = 0
34
35	.text : AT(ADDR(.text) - LOAD_OFFSET) {
36		HEAD_TEXT
37		TEXT_TEXT
38		EXTRA_TEXT
39		SCHED_TEXT
40		CPUIDLE_TEXT
41		LOCK_TEXT
42		KPROBES_TEXT
43		IRQENTRY_TEXT
44		SOFTIRQENTRY_TEXT
45		*(.fixup)
46		*(.gnu.warning)
47		_etext = .;		/* End of text section */
48	} = 0x0009
49
50	EXCEPTION_TABLE(16)
51	NOTES
52
53	_sdata = .;
54	RO_DATA(PAGE_SIZE)
55	RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
56	_edata = .;
57
58	DWARF_EH_FRAME
59
60	. = ALIGN(PAGE_SIZE);		/* Init code and data */
61	__init_begin = .;
62	INIT_TEXT_SECTION(PAGE_SIZE)
63	INIT_DATA_SECTION(16)
64
65	. = ALIGN(4);
66	.machvec.init : AT(ADDR(.machvec.init) - LOAD_OFFSET) {
67		__machvec_start = .;
68		*(.machvec.init)
69		__machvec_end = .;
70	}
71
72	PERCPU_SECTION(L1_CACHE_BYTES)
73
74	/*
75	 * .exit.text is discarded at runtime, not link time, to deal with
76	 * references from __bug_table
77	 */
78	.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { EXIT_TEXT }
79	.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { EXIT_DATA }
80
81	. = ALIGN(PAGE_SIZE);
82	__init_end = .;
83	BSS_SECTION(0, PAGE_SIZE, 4)
84	_end = . ;
85
86	STABS_DEBUG
87	DWARF_DEBUG
88
89	DISCARDS
90}
91