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		LOCK_TEXT
40		KPROBES_TEXT
41		IRQENTRY_TEXT
42		*(.fixup)
43		*(.gnu.warning)
44		_etext = .;		/* End of text section */
45	} = 0x0009
46
47	EXCEPTION_TABLE(16)
48	NOTES
49
50	_sdata = .;
51	RO_DATA(PAGE_SIZE)
52	RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
53	_edata = .;
54
55	DWARF_EH_FRAME
56
57	. = ALIGN(PAGE_SIZE);		/* Init code and data */
58	__init_begin = .;
59	INIT_TEXT_SECTION(PAGE_SIZE)
60	INIT_DATA_SECTION(16)
61
62	. = ALIGN(4);
63	.machvec.init : AT(ADDR(.machvec.init) - LOAD_OFFSET) {
64		__machvec_start = .;
65		*(.machvec.init)
66		__machvec_end = .;
67	}
68
69	PERCPU_SECTION(L1_CACHE_BYTES)
70
71	/*
72	 * .exit.text is discarded at runtime, not link time, to deal with
73	 * references from __bug_table
74	 */
75	.exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { EXIT_TEXT }
76	.exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { EXIT_DATA }
77
78	. = ALIGN(PAGE_SIZE);
79	__init_end = .;
80	BSS_SECTION(0, PAGE_SIZE, 4)
81	_end = . ;
82
83	STABS_DEBUG
84	DWARF_DEBUG
85
86	DISCARDS
87}
88