xref: /linux/arch/sh/kernel/vmlinux.lds.S (revision e58e871becec2d3b04ed91c0c16fe8deac9c9dfa)
1/*
2 * ld script to make SuperH Linux kernel
3 * Written by Niibe Yutaka and Paul Mundt
4 */
5#ifdef CONFIG_SUPERH64
6#define LOAD_OFFSET	PAGE_OFFSET
7OUTPUT_ARCH(sh:sh5)
8#else
9#define LOAD_OFFSET	0
10OUTPUT_ARCH(sh)
11#endif
12
13#include <asm/thread_info.h>
14#include <asm/cache.h>
15#include <asm/vmlinux.lds.h>
16
17#ifdef CONFIG_PMB
18 #define MEMORY_OFFSET	0
19#else
20 #define MEMORY_OFFSET	__MEMORY_START
21#endif
22
23ENTRY(_start)
24SECTIONS
25{
26	. = PAGE_OFFSET + MEMORY_OFFSET + PHYSICAL_OFFSET + CONFIG_ZERO_PAGE_OFFSET;
27
28	_text = .;		/* Text and read-only data */
29
30	.empty_zero_page : AT(ADDR(.empty_zero_page) - LOAD_OFFSET) {
31		*(.empty_zero_page)
32	} = 0
33
34	.text : AT(ADDR(.text) - LOAD_OFFSET) {
35		HEAD_TEXT
36		TEXT_TEXT
37		EXTRA_TEXT
38		SCHED_TEXT
39		CPUIDLE_TEXT
40		LOCK_TEXT
41		KPROBES_TEXT
42		IRQENTRY_TEXT
43		SOFTIRQENTRY_TEXT
44		*(.fixup)
45		*(.gnu.warning)
46		_etext = .;		/* End of text section */
47	} = 0x0009
48
49	EXCEPTION_TABLE(16)
50	NOTES
51
52	_sdata = .;
53	RO_DATA(PAGE_SIZE)
54	RW_DATA_SECTION(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