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 | ||
69 | . = ALIGN(PAGE_SIZE); | |
70 | _etext = .; | |
71 | PROVIDE32 (etext = .); | |
c69cccc9 | 72 | } :kernel |
e8222502 BH |
73 | |
74 | /* Read-only data */ | |
75 | RODATA | |
76 | ||
77 | /* Exception & bug tables */ | |
366234f6 | 78 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { |
14cf11af PM |
79 | __start___ex_table = .; |
80 | *(__ex_table) | |
81 | __stop___ex_table = .; | |
82 | } | |
83 | ||
c69cccc9 SB |
84 | NOTES :kernel :notes |
85 | ||
86 | /* The dummy segment contents for the bug workaround mentioned above | |
87 | near PHDRS. */ | |
88 | .dummy : { | |
89 | LONG(0xf177) | |
90 | } :kernel :dummy | |
8fb775ee | 91 | |
e8222502 BH |
92 | /* |
93 | * Init sections discarded at runtime | |
94 | */ | |
95 | . = ALIGN(PAGE_SIZE); | |
96 | __init_begin = .; | |
97 | ||
366234f6 | 98 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
e8222502 | 99 | _sinittext = .; |
01ba2bdc | 100 | INIT_TEXT |
e8222502 | 101 | _einittext = .; |
c69cccc9 | 102 | } :kernel |
e8222502 BH |
103 | |
104 | /* .exit.text is discarded at runtime, not link time, | |
105 | * to deal with references from __bug_table | |
106 | */ | |
366234f6 | 107 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { |
01ba2bdc SR |
108 | EXIT_TEXT |
109 | } | |
e8222502 | 110 | |
366234f6 | 111 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { |
01ba2bdc | 112 | INIT_DATA |
e8222502 BH |
113 | __vtop_table_begin = .; |
114 | *(.vtop_fixup); | |
115 | __vtop_table_end = .; | |
116 | __ptov_table_begin = .; | |
117 | *(.ptov_fixup); | |
118 | __ptov_table_end = .; | |
c4e3ea25 SR |
119 | #ifdef CONFIG_PPC_ISERIES |
120 | __dt_strings_start = .; | |
121 | *(.dt_strings); | |
122 | __dt_strings_end = .; | |
123 | #endif | |
e8222502 BH |
124 | } |
125 | ||
126 | . = ALIGN(16); | |
366234f6 | 127 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { |
e8222502 BH |
128 | __setup_start = .; |
129 | *(.init.setup) | |
130 | __setup_end = .; | |
131 | } | |
132 | ||
366234f6 | 133 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
e8222502 | 134 | __initcall_start = .; |
61ce1efe | 135 | INITCALLS |
e8222502 BH |
136 | __initcall_end = .; |
137 | } | |
138 | ||
366234f6 | 139 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
e8222502 BH |
140 | __con_initcall_start = .; |
141 | *(.con_initcall.init) | |
142 | __con_initcall_end = .; | |
143 | } | |
144 | ||
145 | SECURITY_INIT | |
146 | ||
147 | . = ALIGN(8); | |
366234f6 | 148 | __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) { |
cabb5587 SR |
149 | __start___ftr_fixup = .; |
150 | *(__ftr_fixup) | |
151 | __stop___ftr_fixup = .; | |
152 | } | |
2d1b2027 KG |
153 | . = ALIGN(8); |
154 | __lwsync_fixup : AT(ADDR(__lwsync_fixup) - LOAD_OFFSET) { | |
155 | __start___lwsync_fixup = .; | |
156 | *(__lwsync_fixup) | |
157 | __stop___lwsync_fixup = .; | |
158 | } | |
3f639ee8 SR |
159 | #ifdef CONFIG_PPC64 |
160 | . = ALIGN(8); | |
366234f6 | 161 | __fw_ftr_fixup : AT(ADDR(__fw_ftr_fixup) - LOAD_OFFSET) { |
3f639ee8 SR |
162 | __start___fw_ftr_fixup = .; |
163 | *(__fw_ftr_fixup) | |
164 | __stop___fw_ftr_fixup = .; | |
165 | } | |
166 | #endif | |
67d38229 | 167 | #ifdef CONFIG_BLK_DEV_INITRD |
e8222502 | 168 | . = ALIGN(PAGE_SIZE); |
366234f6 | 169 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { |
e8222502 BH |
170 | __initramfs_start = .; |
171 | *(.init.ramfs) | |
172 | __initramfs_end = .; | |
173 | } | |
67d38229 | 174 | #endif |
b6e3590f | 175 | . = ALIGN(PAGE_SIZE); |
366234f6 | 176 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { |
e8222502 BH |
177 | __per_cpu_start = .; |
178 | *(.data.percpu) | |
5fb7dc37 | 179 | *(.data.percpu.shared_aligned) |
e8222502 BH |
180 | __per_cpu_end = .; |
181 | } | |
14cf11af | 182 | |
e8222502 | 183 | . = ALIGN(8); |
366234f6 | 184 | .machine.desc : AT(ADDR(.machine.desc) - LOAD_OFFSET) { |
e8222502 BH |
185 | __machine_desc_start = . ; |
186 | *(.machine.desc) | |
187 | __machine_desc_end = . ; | |
188 | } | |
189 | ||
190 | /* freed after init ends here */ | |
191 | . = ALIGN(PAGE_SIZE); | |
192 | __init_end = .; | |
193 | ||
194 | /* | |
195 | * And now the various read/write data | |
196 | */ | |
197 | ||
198 | . = ALIGN(PAGE_SIZE); | |
199 | _sdata = .; | |
14cf11af | 200 | |
cabb5587 | 201 | #ifdef CONFIG_PPC32 |
366234f6 | 202 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
ca967258 | 203 | DATA_DATA |
e8222502 BH |
204 | *(.sdata) |
205 | *(.got.plt) *(.got) | |
206 | } | |
cabb5587 | 207 | #else |
366234f6 | 208 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
3ae0aa9f MD |
209 | DATA_DATA |
210 | *(.data.rel*) | |
211 | *(.toc1) | |
e8222502 BH |
212 | *(.branch_lt) |
213 | } | |
14cf11af | 214 | |
366234f6 | 215 | .opd : AT(ADDR(.opd) - LOAD_OFFSET) { |
e8222502 BH |
216 | *(.opd) |
217 | } | |
218 | ||
366234f6 | 219 | .got : AT(ADDR(.got) - LOAD_OFFSET) { |
e8222502 BH |
220 | __toc_start = .; |
221 | *(.got) | |
222 | *(.toc) | |
223 | } | |
cabb5587 | 224 | #endif |
14cf11af | 225 | |
e8222502 BH |
226 | . = ALIGN(PAGE_SIZE); |
227 | _edata = .; | |
228 | PROVIDE32 (edata = .); | |
229 | ||
230 | /* The initial task and kernel stack */ | |
231 | #ifdef CONFIG_PPC32 | |
232 | . = ALIGN(8192); | |
cabb5587 | 233 | #else |
e8222502 BH |
234 | . = ALIGN(16384); |
235 | #endif | |
366234f6 | 236 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { |
e8222502 BH |
237 | *(.data.init_task) |
238 | } | |
14cf11af | 239 | |
e8222502 | 240 | . = ALIGN(PAGE_SIZE); |
366234f6 | 241 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { |
e8222502 BH |
242 | *(.data.page_aligned) |
243 | } | |
14cf11af | 244 | |
366234f6 | 245 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { |
e8222502 BH |
246 | *(.data.cacheline_aligned) |
247 | } | |
14cf11af | 248 | |
bd67fcf9 | 249 | . = ALIGN(L1_CACHE_BYTES); |
366234f6 | 250 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { |
bd67fcf9 TB |
251 | *(.data.read_mostly) |
252 | } | |
253 | ||
e8222502 | 254 | . = ALIGN(PAGE_SIZE); |
366234f6 | 255 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { |
e8222502 BH |
256 | __nosave_begin = .; |
257 | *(.data.nosave) | |
258 | . = ALIGN(PAGE_SIZE); | |
259 | __nosave_end = .; | |
260 | } | |
4a288563 | 261 | |
e8222502 BH |
262 | /* |
263 | * And finally the bss | |
264 | */ | |
265 | ||
366234f6 | 266 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
e8222502 BH |
267 | __bss_start = .; |
268 | *(.sbss) *(.scommon) | |
269 | *(.dynbss) | |
270 | *(.bss) | |
271 | *(COMMON) | |
272 | __bss_stop = .; | |
273 | } | |
14cf11af | 274 | |
e8222502 BH |
275 | . = ALIGN(PAGE_SIZE); |
276 | _end = . ; | |
277 | PROVIDE32 (end = .); | |
14cf11af | 278 | } |