blob: d0b2a715cd14de730223a7036834201a249d44df [file] [log] [blame]
Paul Mundt49e6c3e2007-11-11 17:58:11 +09001/*
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{
Yoshihiro Shimoda2f47f442009-03-10 15:49:54 +090018#ifdef CONFIG_PMB_FIXED
19 . = CONFIG_PAGE_OFFSET + (CONFIG_MEMORY_START & 0x1fffffff) +
20 CONFIG_ZERO_PAGE_OFFSET;
21#elif defined(CONFIG_32BIT)
Stuart Menefyd02b08f2007-11-30 17:52:53 +090022 . = CONFIG_PAGE_OFFSET + CONFIG_ZERO_PAGE_OFFSET;
23#else
Paul Mundt49e6c3e2007-11-11 17:58:11 +090024 . = CONFIG_PAGE_OFFSET + CONFIG_MEMORY_START + CONFIG_ZERO_PAGE_OFFSET;
Stuart Menefyd02b08f2007-11-30 17:52:53 +090025#endif
26
Paul Mundt49e6c3e2007-11-11 17:58:11 +090027 _text = .; /* Text and read-only data */
28
29 .empty_zero_page : {
30 *(.empty_zero_page)
31 } = 0
32
33 .text : {
34 *(.text.head)
35 TEXT_TEXT
36 SCHED_TEXT
37 LOCK_TEXT
38 KPROBES_TEXT
39 *(.fixup)
40 *(.gnu.warning)
41 } = 0x0009
42
43 . = ALIGN(16); /* Exception table */
44 __start___ex_table = .;
45 __ex_table : { *(__ex_table) }
46 __stop___ex_table = .;
47
48 _etext = .; /* End of text section */
49
Paul Mundt49e6c3e2007-11-11 17:58:11 +090050 NOTES
51 RO_DATA(PAGE_SIZE)
52
Stuart Menefycbaa1182007-11-30 17:06:36 +090053 /*
54 * Code which must be executed uncached and the associated data
55 */
56 . = ALIGN(PAGE_SIZE);
57 __uncached_start = .;
58 .uncached.text : { *(.uncached.text) }
59 .uncached.data : { *(.uncached.data) }
60 __uncached_end = .;
61
Paul Mundt49e6c3e2007-11-11 17:58:11 +090062 . = ALIGN(THREAD_SIZE);
63 .data : { /* Data */
64 *(.data.init_task)
65
66 . = ALIGN(L1_CACHE_BYTES);
67 *(.data.cacheline_aligned)
68
69 . = ALIGN(L1_CACHE_BYTES);
70 *(.data.read_mostly)
71
72 . = ALIGN(PAGE_SIZE);
73 *(.data.page_aligned)
74
75 __nosave_begin = .;
76 *(.data.nosave)
77 . = ALIGN(PAGE_SIZE);
78 __nosave_end = .;
79
80 DATA_DATA
81 CONSTRUCTORS
82 }
83
84 _edata = .; /* End of data section */
85
86 . = ALIGN(PAGE_SIZE); /* Init code and data */
87 __init_begin = .;
88 _sinittext = .;
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +010089 .init.text : { INIT_TEXT }
Paul Mundt49e6c3e2007-11-11 17:58:11 +090090 _einittext = .;
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +010091 .init.data : { INIT_DATA }
Paul Mundt49e6c3e2007-11-11 17:58:11 +090092
93 . = ALIGN(16);
94 __setup_start = .;
95 .init.setup : { *(.init.setup) }
96 __setup_end = .;
97
98 __initcall_start = .;
99 .initcall.init : {
100 INITCALLS
101 }
102 __initcall_end = .;
103 __con_initcall_start = .;
104 .con_initcall.init : { *(.con_initcall.init) }
105 __con_initcall_end = .;
106
107 SECURITY_INIT
108
109#ifdef CONFIG_BLK_DEV_INITRD
110 . = ALIGN(PAGE_SIZE);
111 __initramfs_start = .;
112 .init.ramfs : { *(.init.ramfs) }
113 __initramfs_end = .;
114#endif
115
116 . = ALIGN(4);
117 __machvec_start = .;
118 .machvec.init : { *(.machvec.init) }
119 __machvec_end = .;
120
121 PERCPU(PAGE_SIZE)
122
123 /*
124 * .exit.text is discarded at runtime, not link time, to deal with
125 * references from __bug_table
126 */
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100127 .exit.text : { EXIT_TEXT }
128 .exit.data : { EXIT_DATA }
Paul Mundt49e6c3e2007-11-11 17:58:11 +0900129
130 . = ALIGN(PAGE_SIZE);
131 .bss : {
132 __init_end = .;
133 __bss_start = .; /* BSS */
134 *(.bss.page_aligned)
135 *(.bss)
136 *(COMMON)
137 . = ALIGN(4);
138 _ebss = .; /* uClinux MTD sucks */
139 _end = . ;
140 }
141
142 /*
143 * When something in the kernel is NOT compiled as a module, the
144 * module cleanup code and data are put into these segments. Both
145 * can then be thrown away, as cleanup code is never called unless
146 * it's a module.
147 */
148 /DISCARD/ : {
149 *(.exitcall.exit)
150 }
151
152 STABS_DEBUG
153 DWARF_DEBUG
154}