xref: /linux/arch/sh/kernel/vmlinux.lds.S (revision 6b2d2cec1081a979e0efd6a1e9559e5a01a3c10e)
1/*
2 * ld script to make SuperH Linux kernel
3 * Written by Niibe Yutaka
4 */
5#include <asm/thread_info.h>
6#include <asm/cache.h>
7#include <asm-generic/vmlinux.lds.h>
8
9#ifdef CONFIG_CPU_LITTLE_ENDIAN
10OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
11#else
12OUTPUT_FORMAT("elf32-shbig-linux", "elf32-shbig-linux", "elf32-shbig-linux")
13#endif
14OUTPUT_ARCH(sh)
15ENTRY(_start)
16SECTIONS
17{
18	. = CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START + CONFIG_ZERO_PAGE_OFFSET;
19	_text = .;			/* Text and read-only data */
20
21	.empty_zero_page : {
22		*(.empty_zero_page)
23	} = 0
24
25	.text : {
26		*(.text.head)
27		TEXT_TEXT
28		SCHED_TEXT
29		LOCK_TEXT
30		KPROBES_TEXT
31		*(.fixup)
32		*(.gnu.warning)
33	} = 0x0009
34
35	. = ALIGN(16);		/* Exception table */
36	__start___ex_table = .;
37	__ex_table : { *(__ex_table) }
38	__stop___ex_table = .;
39
40	_etext = .;			/* End of text section */
41
42	BUG_TABLE
43	NOTES
44	RO_DATA(PAGE_SIZE)
45
46	. = ALIGN(THREAD_SIZE);
47	.data : {			/* Data */
48		*(.data.init_task)
49
50		. = ALIGN(L1_CACHE_BYTES);
51		*(.data.cacheline_aligned)
52
53		. = ALIGN(L1_CACHE_BYTES);
54		*(.data.read_mostly)
55
56		. = ALIGN(PAGE_SIZE);
57		*(.data.page_aligned)
58
59		__nosave_begin = .;
60		*(.data.nosave)
61		. = ALIGN(PAGE_SIZE);
62		__nosave_end = .;
63
64		DATA_DATA
65		CONSTRUCTORS
66	}
67
68	_edata = .;			/* End of data section */
69
70	. = ALIGN(PAGE_SIZE);		/* Init code and data */
71	__init_begin = .;
72	_sinittext = .;
73	.init.text : { *(.init.text) }
74	_einittext = .;
75	.init.data : { *(.init.data) }
76
77	. = ALIGN(16);
78	__setup_start = .;
79	.init.setup : { *(.init.setup) }
80	__setup_end = .;
81
82	__initcall_start = .;
83	.initcall.init : {
84		INITCALLS
85	}
86	__initcall_end = .;
87	__con_initcall_start = .;
88	.con_initcall.init : { *(.con_initcall.init) }
89	__con_initcall_end = .;
90
91	SECURITY_INIT
92
93#ifdef CONFIG_BLK_DEV_INITRD
94	. = ALIGN(PAGE_SIZE);
95	__initramfs_start = .;
96	.init.ramfs : { *(.init.ramfs) }
97	__initramfs_end = .;
98#endif
99
100	. = ALIGN(4);
101	__machvec_start = .;
102	.machvec.init : { *(.machvec.init) }
103	__machvec_end = .;
104
105	PERCPU(PAGE_SIZE)
106
107	/*
108	 * .exit.text is discarded at runtime, not link time, to deal with
109	 * references from __bug_table
110	 */
111	.exit.text : { *(.exit.text) }
112	.exit.data : { *(.exit.data) }
113
114	. = ALIGN(PAGE_SIZE);
115	.bss : {
116		__init_end = .;
117		__bss_start = .;		/* BSS */
118		*(.bss.page_aligned)
119		*(.bss)
120		*(COMMON)
121		. = ALIGN(4);
122		_ebss = .;			/* uClinux MTD sucks */
123		_end = . ;
124	}
125
126	/*
127	 * When something in the kernel is NOT compiled as a module, the
128	 * module cleanup code and data are put into these segments. Both
129	 * can then be thrown away, as cleanup code is never called unless
130	 * it's a module.
131	 */
132	/DISCARD/ : {
133		*(.exitcall.exit)
134	}
135
136	STABS_DEBUG
137	DWARF_DEBUG
138}
139