b5d43670d809d06bf0123859400ca756eaedd52d
[safe/jmp/linux-2.6] / arch / x86 / kernel / vmlinux_64.lds.S
1         /* Exception table */
2         . = ALIGN(16);
3         __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
4                 __start___ex_table = .;
5                  *(__ex_table)
6                 __stop___ex_table = .;
7         } :text = 0x9090
8
9         RODATA
10
11         /* Align data segment to page size boundary */
12         . = ALIGN(PAGE_SIZE);
13         /* Data */
14         .data : AT(ADDR(.data) - LOAD_OFFSET) {
15                 DATA_DATA
16                 CONSTRUCTORS
17                 /* End of data section */
18                 _edata = .;
19         } :data
20
21
22         .data.cacheline_aligned :
23                 AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
24                 . = ALIGN(PAGE_SIZE);
25                 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
26                 *(.data.cacheline_aligned)
27         }
28
29         . = ALIGN(CONFIG_X86_INTERNODE_CACHE_BYTES);
30         .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
31                 *(.data.read_mostly)
32         }
33
34 #define VSYSCALL_ADDR (-10*1024*1024)
35 #define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + \
36                             SIZEOF(.data.read_mostly) + 4095) & ~(4095))
37 #define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + \
38                             SIZEOF(.data.read_mostly) + 4095) & ~(4095))
39
40 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
41 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
42
43 #define VVIRT_OFFSET (VSYSCALL_ADDR - VSYSCALL_VIRT_ADDR)
44 #define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
45
46         . = VSYSCALL_ADDR;
47         .vsyscall_0 : AT(VSYSCALL_PHYS_ADDR) {
48                 *(.vsyscall_0)
49         } :user
50
51         __vsyscall_0 = VSYSCALL_VIRT_ADDR;
52
53         . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
54         .vsyscall_fn : AT(VLOAD(.vsyscall_fn)) {
55                 *(.vsyscall_fn)
56         }
57
58         . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
59         .vsyscall_gtod_data : AT(VLOAD(.vsyscall_gtod_data)) {
60                 *(.vsyscall_gtod_data)
61         }
62
63         vsyscall_gtod_data = VVIRT(.vsyscall_gtod_data);
64         .vsyscall_clock : AT(VLOAD(.vsyscall_clock)) {
65                 *(.vsyscall_clock)
66         }
67         vsyscall_clock = VVIRT(.vsyscall_clock);
68
69
70         .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) {
71                 *(.vsyscall_1)
72         }
73         .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) {
74                 *(.vsyscall_2)
75         }
76
77         .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) {
78                 *(.vgetcpu_mode)
79         }
80         vgetcpu_mode = VVIRT(.vgetcpu_mode);
81
82         . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
83         .jiffies : AT(VLOAD(.jiffies)) {
84                 *(.jiffies)
85         }
86         jiffies = VVIRT(.jiffies);
87
88         .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) {
89                 *(.vsyscall_3)
90         }
91
92         . = VSYSCALL_VIRT_ADDR + PAGE_SIZE;
93
94 #undef VSYSCALL_ADDR
95 #undef VSYSCALL_PHYS_ADDR
96 #undef VSYSCALL_VIRT_ADDR
97 #undef VLOAD_OFFSET
98 #undef VLOAD
99 #undef VVIRT_OFFSET
100 #undef VVIRT
101
102         /* init_task */
103         .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
104                 . = ALIGN(THREAD_SIZE);
105                 *(.data.init_task)
106         } :data.init
107
108         .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
109                 . = ALIGN(PAGE_SIZE);
110                 *(.data.page_aligned)
111         }
112
113         .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
114                 /* might get freed after init */
115                 . = ALIGN(PAGE_SIZE);
116                 __smp_alt_begin = .;
117                 __smp_locks = .;
118                 *(.smp_locks)
119                 __smp_locks_end = .;
120                 . = ALIGN(PAGE_SIZE);
121                 __smp_alt_end = .;
122         }
123
124         /* Init code and data */
125         . = ALIGN(PAGE_SIZE);
126         __init_begin = .;       /* paired with __init_end */
127         .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
128                 _sinittext = .;
129                 INIT_TEXT
130                 _einittext = .;
131         }
132
133         .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
134                 __initdata_begin = .;
135                 INIT_DATA
136                 __initdata_end = .;
137         }
138
139         .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
140                 . = ALIGN(16);
141                 __setup_start = .;
142                 *(.init.setup)
143                 __setup_end = .;
144         }
145
146         .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
147                 __initcall_start = .;
148                 INITCALLS
149                 __initcall_end = .;
150         }
151
152         .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
153                 __con_initcall_start = .;
154                 *(.con_initcall.init)
155                 __con_initcall_end = .;
156         }
157
158         .x86_cpu_dev.init : AT(ADDR(.x86_cpu_dev.init) - LOAD_OFFSET) {
159                 __x86_cpu_dev_start = .;
160                 *(.x86_cpu_dev.init)
161                 __x86_cpu_dev_end = .;
162         }
163
164         SECURITY_INIT
165
166         . = ALIGN(8);
167         .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
168                 __parainstructions = .;
169                 *(.parainstructions)
170                 __parainstructions_end = .;
171         }
172
173         .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
174                 . = ALIGN(8);
175                 __alt_instructions = .;
176                 *(.altinstructions)
177                 __alt_instructions_end = .;
178         }
179
180         .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
181                 *(.altinstr_replacement)
182         }
183
184         /*
185          * .exit.text is discard at runtime, not link time, to deal with
186          *  references from .altinstructions and .eh_frame
187          */
188         .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
189                 EXIT_TEXT
190         }
191
192         .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
193                 EXIT_DATA
194         }
195
196 #ifdef CONFIG_BLK_DEV_INITRD
197         . = ALIGN(PAGE_SIZE);
198         .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
199                 __initramfs_start = .;
200                 *(.init.ramfs)
201                 __initramfs_end = .;
202         }
203 #endif
204
205 #ifdef CONFIG_SMP
206         /*
207          * percpu offsets are zero-based on SMP.  PERCPU_VADDR() changes the
208          * output PHDR, so the next output section - __data_nosave - should
209          * start another section data.init2.  Also, pda should be at the head of
210          * percpu area.  Preallocate it and define the percpu offset symbol
211          * so that it can be accessed as a percpu variable.
212          */
213         . = ALIGN(PAGE_SIZE);
214         PERCPU_VADDR(0, :percpu)
215 #else
216         PERCPU(PAGE_SIZE)
217 #endif
218
219         . = ALIGN(PAGE_SIZE);
220         __init_end = .;
221
222         .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
223                 . = ALIGN(PAGE_SIZE);
224                 __nosave_begin = .;
225                 *(.data.nosave)
226                 . = ALIGN(PAGE_SIZE);
227                 __nosave_end = .;
228         } :data.init2
229         /* use another section data.init2, see PERCPU_VADDR() above */
230
231         .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
232                 . = ALIGN(PAGE_SIZE);
233                 __bss_start = .;                /* BSS */
234                 *(.bss.page_aligned)
235                 *(.bss)
236                 __bss_stop = .;
237         }
238
239         .brk : AT(ADDR(.brk) - LOAD_OFFSET) {
240                 . = ALIGN(PAGE_SIZE);
241                 __brk_base = .;
242                 . += 64 * 1024;         /* 64k alignment slop space */
243                 *(.brk_reservation)     /* areas brk users have reserved */
244                 __brk_limit = .;
245         }
246
247         _end = . ;
248
249         /* Sections to be discarded */
250         /DISCARD/ : {
251                 *(.exitcall.exit)
252                 *(.eh_frame)
253                 *(.discard)
254         }