xref: /openbmc/linux/arch/sh/kernel/vmlinux.lds.S (revision dc6a81c3)
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
52	_sdata = .;
53	RO_DATA(PAGE_SIZE)
54	RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
55	_edata = .;
56
57	DWARF_EH_FRAME
58
59	. = ALIGN(PAGE_SIZE);		/* Init code and data */
60	__init_begin = .;
61	INIT_TEXT_SECTION(PAGE_SIZE)
62	INIT_DATA_SECTION(16)
63
64	. = ALIGN(4);
65	.machvec.init : AT(ADDR(.machvec.init) - LOAD_OFFSET) {
66		__machvec_start = .;
67		*(.machvec.init)
68		__machvec_end = .;
69	}
70
71	PERCPU_SECTION(L1_CACHE_BYTES)
72
73	/*
74	 * .exit.text is discarded at runtime, not link time, to deal with
75	 * references from __bug_table
76	 */
77	.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { EXIT_TEXT }
78	.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { EXIT_DATA }
79
80	. = ALIGN(PAGE_SIZE);
81	__init_end = .;
82	BSS_SECTION(0, PAGE_SIZE, 4)
83	_end = . ;
84
85	STABS_DEBUG
86	DWARF_DEBUG
87
88	DISCARDS
89}
90