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