Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 1 | #include <linux/config.h> |
Paul Mackerras | c51e3a4 | 2005-11-05 10:36:59 +1100 | [diff] [blame] | 2 | #ifdef CONFIG_PPC64 |
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 3 | #include <asm/page.h> |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 4 | #define PROVIDE32(x) PROVIDE(__unused__##x) |
Paul Mackerras | c51e3a4 | 2005-11-05 10:36:59 +1100 | [diff] [blame] | 5 | #else |
6 | #define PAGE_SIZE 4096 | ||||
7 | #define KERNELBASE CONFIG_KERNEL_START | ||||
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 8 | #define PROVIDE32(x) PROVIDE(x) |
Paul Mackerras | c51e3a4 | 2005-11-05 10:36:59 +1100 | [diff] [blame] | 9 | #endif |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 10 | #include <asm-generic/vmlinux.lds.h> |
11 | |||||
Michael Ellerman | e19e4ab | 2005-11-03 16:03:06 +1100 | [diff] [blame] | 12 | ENTRY(_stext) |
13 | |||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 14 | #ifdef CONFIG_PPC64 |
15 | OUTPUT_ARCH(powerpc:common64) | ||||
16 | jiffies = jiffies_64; | ||||
17 | #else | ||||
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 18 | OUTPUT_ARCH(powerpc:common) |
19 | jiffies = jiffies_64 + 4; | ||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 20 | #endif |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 21 | SECTIONS |
22 | { | ||||
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 23 | /* Sections to be discarded. */ |
24 | /DISCARD/ : { | ||||
25 | *(.exitcall.exit) | ||||
26 | *(.exit.data) | ||||
27 | } | ||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 28 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 29 | . = KERNELBASE; |
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 30 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 31 | /* |
32 | * Text, read only data and other permanent read-only sections | ||||
33 | */ | ||||
34 | |||||
35 | /* Text and gots */ | ||||
36 | .text : { | ||||
37 | *(.text .text.*) | ||||
38 | SCHED_TEXT | ||||
39 | LOCK_TEXT | ||||
40 | KPROBES_TEXT | ||||
41 | *(.fixup) | ||||
42 | |||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 43 | #ifdef CONFIG_PPC32 |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 44 | *(.got1) |
45 | __got2_start = .; | ||||
46 | *(.got2) | ||||
47 | __got2_end = .; | ||||
48 | #endif /* CONFIG_PPC32 */ | ||||
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 49 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 50 | . = ALIGN(PAGE_SIZE); |
51 | _etext = .; | ||||
52 | PROVIDE32 (etext = .); | ||||
53 | } | ||||
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 54 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 55 | /* Read-only data */ |
56 | RODATA | ||||
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 57 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 58 | /* Exception & bug tables */ |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 59 | __ex_table : { |
60 | __start___ex_table = .; | ||||
61 | *(__ex_table) | ||||
62 | __stop___ex_table = .; | ||||
63 | } | ||||
64 | |||||
65 | __bug_table : { | ||||
66 | __start___bug_table = .; | ||||
67 | *(__bug_table) | ||||
68 | __stop___bug_table = .; | ||||
69 | } | ||||
70 | |||||
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 71 | /* |
72 | * Init sections discarded at runtime | ||||
73 | */ | ||||
74 | . = ALIGN(PAGE_SIZE); | ||||
75 | __init_begin = .; | ||||
76 | |||||
77 | .init.text : { | ||||
78 | _sinittext = .; | ||||
79 | *(.init.text) | ||||
80 | _einittext = .; | ||||
81 | } | ||||
82 | |||||
83 | /* .exit.text is discarded at runtime, not link time, | ||||
84 | * to deal with references from __bug_table | ||||
85 | */ | ||||
86 | .exit.text : { *(.exit.text) } | ||||
87 | |||||
88 | .init.data : { | ||||
89 | *(.init.data); | ||||
90 | __vtop_table_begin = .; | ||||
91 | *(.vtop_fixup); | ||||
92 | __vtop_table_end = .; | ||||
93 | __ptov_table_begin = .; | ||||
94 | *(.ptov_fixup); | ||||
95 | __ptov_table_end = .; | ||||
96 | } | ||||
97 | |||||
98 | . = ALIGN(16); | ||||
99 | .init.setup : { | ||||
100 | __setup_start = .; | ||||
101 | *(.init.setup) | ||||
102 | __setup_end = .; | ||||
103 | } | ||||
104 | |||||
105 | .initcall.init : { | ||||
106 | __initcall_start = .; | ||||
107 | *(.initcall1.init) | ||||
108 | *(.initcall2.init) | ||||
109 | *(.initcall3.init) | ||||
110 | *(.initcall4.init) | ||||
111 | *(.initcall5.init) | ||||
112 | *(.initcall6.init) | ||||
113 | *(.initcall7.init) | ||||
114 | __initcall_end = .; | ||||
115 | } | ||||
116 | |||||
117 | .con_initcall.init : { | ||||
118 | __con_initcall_start = .; | ||||
119 | *(.con_initcall.init) | ||||
120 | __con_initcall_end = .; | ||||
121 | } | ||||
122 | |||||
123 | SECURITY_INIT | ||||
124 | |||||
125 | . = ALIGN(8); | ||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 126 | __ftr_fixup : { |
127 | __start___ftr_fixup = .; | ||||
128 | *(__ftr_fixup) | ||||
129 | __stop___ftr_fixup = .; | ||||
130 | } | ||||
131 | |||||
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 132 | . = ALIGN(PAGE_SIZE); |
133 | .init.ramfs : { | ||||
134 | __initramfs_start = .; | ||||
135 | *(.init.ramfs) | ||||
136 | __initramfs_end = .; | ||||
137 | } | ||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 138 | |
139 | #ifdef CONFIG_PPC32 | ||||
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 140 | . = ALIGN(32); |
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 141 | #else |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 142 | . = ALIGN(128); |
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 143 | #endif |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 144 | .data.percpu : { |
145 | __per_cpu_start = .; | ||||
146 | *(.data.percpu) | ||||
147 | __per_cpu_end = .; | ||||
148 | } | ||||
149 | |||||
150 | . = ALIGN(8); | ||||
151 | .machine.desc : { | ||||
152 | __machine_desc_start = . ; | ||||
153 | *(.machine.desc) | ||||
154 | __machine_desc_end = . ; | ||||
155 | } | ||||
156 | |||||
157 | /* freed after init ends here */ | ||||
158 | . = ALIGN(PAGE_SIZE); | ||||
159 | __init_end = .; | ||||
160 | |||||
161 | /* | ||||
162 | * And now the various read/write data | ||||
163 | */ | ||||
164 | |||||
165 | . = ALIGN(PAGE_SIZE); | ||||
166 | _sdata = .; | ||||
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 167 | |
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 168 | #ifdef CONFIG_PPC32 |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 169 | .data : |
170 | { | ||||
171 | *(.data) | ||||
172 | *(.sdata) | ||||
173 | *(.got.plt) *(.got) | ||||
174 | } | ||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 175 | #else |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 176 | .data : { |
177 | *(.data .data.rel* .toc1) | ||||
178 | *(.branch_lt) | ||||
179 | } | ||||
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 180 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 181 | .opd : { |
182 | *(.opd) | ||||
183 | } | ||||
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 184 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 185 | .got : { |
186 | __toc_start = .; | ||||
187 | *(.got) | ||||
188 | *(.toc) | ||||
189 | } | ||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 190 | #endif |
Paul Mackerras | 4a28856 | 2005-10-10 22:38:46 +1000 | [diff] [blame] | 191 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 192 | . = ALIGN(PAGE_SIZE); |
193 | _edata = .; | ||||
194 | PROVIDE32 (edata = .); | ||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 195 | |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 196 | /* The initial task and kernel stack */ |
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 197 | #ifdef CONFIG_PPC32 |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 198 | . = ALIGN(8192); |
199 | #else | ||||
200 | . = ALIGN(16384); | ||||
Stephen Rothwell | cabb558 | 2005-09-30 16:16:52 +1000 | [diff] [blame] | 201 | #endif |
Benjamin Herrenschmidt | e822250 | 2006-03-28 23:15:54 +1100 | [diff] [blame^] | 202 | .data.init_task : { |
203 | *(.data.init_task) | ||||
204 | } | ||||
205 | |||||
206 | . = ALIGN(PAGE_SIZE); | ||||
207 | .data.page_aligned : { | ||||
208 | *(.data.page_aligned) | ||||
209 | } | ||||
210 | |||||
211 | .data.cacheline_aligned : { | ||||
212 | *(.data.cacheline_aligned) | ||||
213 | } | ||||
214 | |||||
215 | . = ALIGN(PAGE_SIZE); | ||||
216 | __data_nosave : { | ||||
217 | __nosave_begin = .; | ||||
218 | *(.data.nosave) | ||||
219 | . = ALIGN(PAGE_SIZE); | ||||
220 | __nosave_end = .; | ||||
221 | } | ||||
222 | |||||
223 | /* | ||||
224 | * And finally the bss | ||||
225 | */ | ||||
226 | |||||
227 | .bss : { | ||||
228 | __bss_start = .; | ||||
229 | *(.sbss) *(.scommon) | ||||
230 | *(.dynbss) | ||||
231 | *(.bss) | ||||
232 | *(COMMON) | ||||
233 | __bss_stop = .; | ||||
234 | } | ||||
235 | |||||
236 | . = ALIGN(PAGE_SIZE); | ||||
237 | _end = . ; | ||||
238 | PROVIDE32 (end = .); | ||||
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 239 | } |