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