Commit | Line | Data |
---|---|---|
c51e3a41 | 1 | #ifdef CONFIG_PPC64 |
e8222502 | 2 | #define PROVIDE32(x) PROVIDE(__unused__##x) |
c51e3a41 | 3 | #else |
e8222502 | 4 | #define PROVIDE32(x) PROVIDE(x) |
c51e3a41 | 5 | #endif |
4846c5de | 6 | #include <asm/page.h> |
14cf11af | 7 | #include <asm-generic/vmlinux.lds.h> |
bd67fcf9 | 8 | #include <asm/cache.h> |
14cf11af | 9 | |
e19e4ab4 ME |
10 | ENTRY(_stext) |
11 | ||
c69cccc9 SB |
12 | PHDRS { |
13 | kernel PT_LOAD FLAGS(7); /* RWX */ | |
14 | notes PT_NOTE FLAGS(0); | |
15 | dummy PT_NOTE FLAGS(0); | |
16 | ||
17 | /* binutils < 2.18 has a bug that makes it misbehave when taking an | |
18 | ELF file with all segments at load address 0 as input. This | |
19 | happens when running "strip" on vmlinux, because of the AT() magic | |
20 | in this linker script. People using GCC >= 4.2 won't run into | |
21 | this problem, because the "build-id" support will put some data | |
22 | into the "notes" segment (at a non-zero load address). | |
23 | ||
24 | To work around this, we force some data into both the "dummy" | |
25 | segment and the kernel segment, so the dummy segment will get a | |
26 | non-zero load address. It's not enough to always create the | |
27 | "notes" segment, since if nothing gets assigned to it, its load | |
28 | address will be zero. */ | |
29 | } | |
30 | ||
cabb5587 SR |
31 | #ifdef CONFIG_PPC64 |
32 | OUTPUT_ARCH(powerpc:common64) | |
33 | jiffies = jiffies_64; | |
34 | #else | |
14cf11af PM |
35 | OUTPUT_ARCH(powerpc:common) |
36 | jiffies = jiffies_64 + 4; | |
cabb5587 | 37 | #endif |
14cf11af PM |
38 | SECTIONS |
39 | { | |
e8222502 BH |
40 | /* Sections to be discarded. */ |
41 | /DISCARD/ : { | |
42 | *(.exitcall.exit) | |
01ba2bdc | 43 | EXIT_DATA |
e8222502 | 44 | } |
14cf11af | 45 | |
e8222502 | 46 | . = KERNELBASE; |
14cf11af | 47 | |
e8222502 BH |
48 | /* |
49 | * Text, read only data and other permanent read-only sections | |
50 | */ | |
51 | ||
52 | /* Text and gots */ | |
366234f6 | 53 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
748a7683 KG |
54 | ALIGN_FUNCTION(); |
55 | *(.text.head) | |
fd593d12 | 56 | _text = .; |
fac23fe4 | 57 | *(.text .fixup .text.init.refok .exit.text.refok __ftr_alt_*) |
e8222502 BH |
58 | SCHED_TEXT |
59 | LOCK_TEXT | |
60 | KPROBES_TEXT | |
14cf11af | 61 | |
e8222502 BH |
62 | #ifdef CONFIG_PPC32 |
63 | *(.got1) | |
64 | __got2_start = .; | |
65 | *(.got2) | |
66 | __got2_end = .; | |
67 | #endif /* CONFIG_PPC32 */ | |
68 | ||
c69cccc9 | 69 | } :kernel |
e8222502 | 70 | |
303996da SR |
71 | . = ALIGN(PAGE_SIZE); |
72 | _etext = .; | |
73 | PROVIDE32 (etext = .); | |
74 | ||
e8222502 BH |
75 | /* Read-only data */ |
76 | RODATA | |
77 | ||
78 | /* Exception & bug tables */ | |
366234f6 | 79 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { |
14cf11af PM |
80 | __start___ex_table = .; |
81 | *(__ex_table) | |
82 | __stop___ex_table = .; | |
83 | } | |
84 | ||
c69cccc9 SB |
85 | NOTES :kernel :notes |
86 | ||
87 | /* The dummy segment contents for the bug workaround mentioned above | |
88 | near PHDRS. */ | |
80c60bf9 | 89 | .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) { |
c69cccc9 SB |
90 | LONG(0xf177) |
91 | } :kernel :dummy | |
8fb775ee | 92 | |
e8222502 BH |
93 | /* |
94 | * Init sections discarded at runtime | |
95 | */ | |
96 | . = ALIGN(PAGE_SIZE); | |
97 | __init_begin = .; | |
98 | ||
366234f6 | 99 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
e8222502 | 100 | _sinittext = .; |
01ba2bdc | 101 | INIT_TEXT |
e8222502 | 102 | _einittext = .; |
c69cccc9 | 103 | } :kernel |
e8222502 BH |
104 | |
105 | /* .exit.text is discarded at runtime, not link time, | |
106 | * to deal with references from __bug_table | |
107 | */ | |
366234f6 | 108 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { |
01ba2bdc SR |
109 | EXIT_TEXT |
110 | } | |
e8222502 | 111 | |
366234f6 | 112 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { |
01ba2bdc | 113 | INIT_DATA |
e8222502 BH |
114 | __vtop_table_begin = .; |
115 | *(.vtop_fixup); | |
116 | __vtop_table_end = .; | |
117 | __ptov_table_begin = .; | |
118 | *(.ptov_fixup); | |
119 | __ptov_table_end = .; | |
c4e3ea25 SR |
120 | #ifdef CONFIG_PPC_ISERIES |
121 | __dt_strings_start = .; | |
122 | *(.dt_strings); | |
123 | __dt_strings_end = .; | |
124 | #endif | |
e8222502 BH |
125 | } |
126 | ||
127 | . = ALIGN(16); | |
366234f6 | 128 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { |
e8222502 BH |
129 | __setup_start = .; |
130 | *(.init.setup) | |
131 | __setup_end = .; | |
132 | } | |
133 | ||
366234f6 | 134 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
e8222502 | 135 | __initcall_start = .; |
61ce1efe | 136 | INITCALLS |
e8222502 BH |
137 | __initcall_end = .; |
138 | } | |
139 | ||
366234f6 | 140 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
e8222502 BH |
141 | __con_initcall_start = .; |
142 | *(.con_initcall.init) | |
143 | __con_initcall_end = .; | |
144 | } | |
145 | ||
146 | SECURITY_INIT | |
147 | ||
148 | . = ALIGN(8); | |
366234f6 | 149 | __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) { |
cabb5587 SR |
150 | __start___ftr_fixup = .; |
151 | *(__ftr_fixup) | |
152 | __stop___ftr_fixup = .; | |
153 | } | |
2d1b2027 KG |
154 | . = ALIGN(8); |
155 | __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) { | |
156 | __start___lwsync_fixup = .; | |
157 | *(__lwsync_fixup) | |
158 | __stop___lwsync_fixup = .; | |
159 | } | |
3f639ee8 SR |
160 | #ifdef CONFIG_PPC64 |
161 | . = ALIGN(8); | |
366234f6 | 162 | __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) { |
3f639ee8 SR |
163 | __start___fw_ftr_fixup = .; |
164 | *(__fw_ftr_fixup) | |
165 | __stop___fw_ftr_fixup = .; | |
166 | } | |
167 | #endif | |
67d38229 | 168 | #ifdef CONFIG_BLK_DEV_INITRD |
e8222502 | 169 | . = ALIGN(PAGE_SIZE); |
366234f6 | 170 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { |
e8222502 BH |
171 | __initramfs_start = .; |
172 | *(.init.ramfs) | |
173 | __initramfs_end = .; | |
174 | } | |
67d38229 | 175 | #endif |
b6e3590f | 176 | . = ALIGN(PAGE_SIZE); |
366234f6 | 177 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { |
e8222502 BH |
178 | __per_cpu_start = .; |
179 | *(.data.percpu) | |
5fb7dc37 | 180 | *(.data.percpu.shared_aligned) |
e8222502 BH |
181 | __per_cpu_end = .; |
182 | } | |
14cf11af | 183 | |
e8222502 | 184 | . = ALIGN(8); |
366234f6 | 185 | .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) { |
e8222502 BH |
186 | __machine_desc_start = . ; |
187 | *(.machine.desc) | |
188 | __machine_desc_end = . ; | |
189 | } | |
190 | ||
191 | /* freed after init ends here */ | |
192 | . = ALIGN(PAGE_SIZE); | |
193 | __init_end = .; | |
194 | ||
195 | /* | |
196 | * And now the various read/write data | |
197 | */ | |
198 | ||
199 | . = ALIGN(PAGE_SIZE); | |
200 | _sdata = .; | |
14cf11af | 201 | |
cabb5587 | 202 | #ifdef CONFIG_PPC32 |
366234f6 | 203 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
ca967258 | 204 | DATA_DATA |
e8222502 BH |
205 | *(.sdata) |
206 | *(.got.plt) *(.got) | |
207 | } | |
cabb5587 | 208 | #else |
366234f6 | 209 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
3ae0aa9f MD |
210 | DATA_DATA |
211 | *(.data.rel*) | |
212 | *(.toc1) | |
e8222502 BH |
213 | *(.branch_lt) |
214 | } | |
14cf11af | 215 | |
366234f6 | 216 | .opd : AT(ADDR(.opd) - LOAD_OFFSET) { |
e8222502 BH |
217 | *(.opd) |
218 | } | |
219 | ||
366234f6 | 220 | .got : AT(ADDR(.got) - LOAD_OFFSET) { |
e8222502 BH |
221 | __toc_start = .; |
222 | *(.got) | |
223 | *(.toc) | |
224 | } | |
cabb5587 | 225 | #endif |
14cf11af | 226 | |
e8222502 BH |
227 | . = ALIGN(PAGE_SIZE); |
228 | _edata = .; | |
229 | PROVIDE32 (edata = .); | |
230 | ||
231 | /* The initial task and kernel stack */ | |
232 | #ifdef CONFIG_PPC32 | |
233 | . = ALIGN(8192); | |
cabb5587 | 234 | #else |
e8222502 BH |
235 | . = ALIGN(16384); |
236 | #endif | |
366234f6 | 237 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { |
e8222502 BH |
238 | *(.data.init_task) |
239 | } | |
14cf11af | 240 | |
e8222502 | 241 | . = ALIGN(PAGE_SIZE); |
366234f6 | 242 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { |
e8222502 BH |
243 | *(.data.page_aligned) |
244 | } | |
14cf11af | 245 | |
366234f6 | 246 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { |
e8222502 BH |
247 | *(.data.cacheline_aligned) |
248 | } | |
14cf11af | 249 | |
bd67fcf9 | 250 | . = ALIGN(L1_CACHE_BYTES); |
366234f6 | 251 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { |
bd67fcf9 TB |
252 | *(.data.read_mostly) |
253 | } | |
254 | ||
e8222502 | 255 | . = ALIGN(PAGE_SIZE); |
366234f6 | 256 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { |
e8222502 BH |
257 | __nosave_begin = .; |
258 | *(.data.nosave) | |
259 | . = ALIGN(PAGE_SIZE); | |
260 | __nosave_end = .; | |
261 | } | |
4a288563 | 262 | |
e8222502 BH |
263 | /* |
264 | * And finally the bss | |
265 | */ | |
266 | ||
366234f6 | 267 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
e8222502 BH |
268 | __bss_start = .; |
269 | *(.sbss) *(.scommon) | |
270 | *(.dynbss) | |
271 | *(.bss) | |
272 | *(COMMON) | |
273 | __bss_stop = .; | |
274 | } | |
14cf11af | 275 | |
e8222502 BH |
276 | . = ALIGN(PAGE_SIZE); |
277 | _end = . ; | |
278 | PROVIDE32 (end = .); | |
14cf11af | 279 | } |