Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
[pandora-kernel.git] / arch / x86 / kernel / vmlinux_32.lds.S
1 /* ld script to make i386 Linux kernel
2  * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3  *
4  * Don't define absolute symbols until and unless you know that symbol
5  * value is should remain constant even if kernel image is relocated
6  * at run time. Absolute symbols are not relocated. If symbol value should
7  * change if kernel is relocated, make the symbol section relative and
8  * put it inside the section definition.
9  */
10
11 #define LOAD_OFFSET __PAGE_OFFSET
12
13 #include <asm-generic/vmlinux.lds.h>
14 #include <asm/thread_info.h>
15 #include <asm/page.h>
16 #include <asm/cache.h>
17 #include <asm/boot.h>
18
19 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
20 OUTPUT_ARCH(i386)
21 ENTRY(phys_startup_32)
22 jiffies = jiffies_64;
23
24 PHDRS {
25         text PT_LOAD FLAGS(5);  /* R_E */
26         data PT_LOAD FLAGS(7);  /* RWE */
27         note PT_NOTE FLAGS(0);  /* ___ */
28 }
29 SECTIONS
30 {
31   . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
32   phys_startup_32 = startup_32 - LOAD_OFFSET;
33
34   .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) {
35         _text = .;                      /* Text and read-only data */
36         *(.text.head)
37   } :text = 0x9090
38
39   /* read-only */
40   .text : AT(ADDR(.text) - LOAD_OFFSET) {
41         . = ALIGN(PAGE_SIZE); /* not really needed, already page aligned */
42         *(.text.page_aligned)
43         TEXT_TEXT
44         SCHED_TEXT
45         LOCK_TEXT
46         KPROBES_TEXT
47         *(.fixup)
48         *(.gnu.warning)
49         _etext = .;                     /* End of text section */
50   } :text = 0x9090
51
52   NOTES :text :note
53
54   . = ALIGN(16);                /* Exception table */
55   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
56         __start___ex_table = .;
57          *(__ex_table)
58         __stop___ex_table = .;
59   } :text = 0x9090
60
61   RODATA
62
63   /* writeable */
64   . = ALIGN(PAGE_SIZE);
65   .data : AT(ADDR(.data) - LOAD_OFFSET) {       /* Data */
66         DATA_DATA
67         CONSTRUCTORS
68         } :data
69
70   . = ALIGN(PAGE_SIZE);
71   .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
72         __nosave_begin = .;
73         *(.data.nosave)
74         . = ALIGN(PAGE_SIZE);
75         __nosave_end = .;
76   }
77
78   . = ALIGN(PAGE_SIZE);
79   .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
80         *(.data.page_aligned)
81         *(.data.idt)
82   }
83
84   . = ALIGN(32);
85   .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
86         *(.data.cacheline_aligned)
87   }
88
89   /* rarely changed data like cpu maps */
90   . = ALIGN(32);
91   .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
92         *(.data.read_mostly)
93         _edata = .;             /* End of data section */
94   }
95
96   . = ALIGN(THREAD_SIZE);       /* init_task */
97   .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
98         *(.data.init_task)
99   }
100
101   /* might get freed after init */
102   . = ALIGN(PAGE_SIZE);
103   .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
104         __smp_locks = .;
105         *(.smp_locks)
106         __smp_locks_end = .;
107   }
108   /* will be freed after init
109    * Following ALIGN() is required to make sure no other data falls on the
110    * same page where __smp_alt_end is pointing as that page might be freed
111    * after boot. Always make sure that ALIGN() directive is present after
112    * the section which contains __smp_alt_end.
113    */
114   . = ALIGN(PAGE_SIZE);
115
116   /* will be freed after init */
117   . = ALIGN(PAGE_SIZE);         /* Init code and data */
118   .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
119         __init_begin = .;
120         _sinittext = .;
121         INIT_TEXT
122         _einittext = .;
123   }
124   .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {
125         INIT_DATA
126   }
127   . = ALIGN(16);
128   .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
129         __setup_start = .;
130         *(.init.setup)
131         __setup_end = .;
132    }
133   .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
134         __initcall_start = .;
135         INITCALLS
136         __initcall_end = .;
137   }
138   .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
139         __con_initcall_start = .;
140         *(.con_initcall.init)
141         __con_initcall_end = .;
142   }
143   .x86cpuvendor.init : AT(ADDR(.x86cpuvendor.init) - LOAD_OFFSET) {
144         __x86cpuvendor_start = .;
145         *(.x86cpuvendor.init)
146         __x86cpuvendor_end = .;
147   }
148   SECURITY_INIT
149   . = ALIGN(4);
150   .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
151         __alt_instructions = .;
152         *(.altinstructions)
153         __alt_instructions_end = .;
154   }
155   .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
156         *(.altinstr_replacement)
157   }
158   . = ALIGN(4);
159   .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
160         __parainstructions = .;
161         *(.parainstructions)
162         __parainstructions_end = .;
163   }
164   /* .exit.text is discard at runtime, not link time, to deal with references
165      from .altinstructions and .eh_frame */
166   .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
167         EXIT_TEXT
168   }
169   .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) {
170         EXIT_DATA
171   }
172 #if defined(CONFIG_BLK_DEV_INITRD)
173   . = ALIGN(PAGE_SIZE);
174   .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
175         __initramfs_start = .;
176         *(.init.ramfs)
177         __initramfs_end = .;
178   }
179 #endif
180   . = ALIGN(PAGE_SIZE);
181   .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
182         __per_cpu_start = .;
183         *(.data.percpu)
184         *(.data.percpu.shared_aligned)
185         __per_cpu_end = .;
186   }
187   . = ALIGN(PAGE_SIZE);
188   /* freed after init ends here */
189
190   .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
191         __init_end = .;
192         __bss_start = .;                /* BSS */
193         *(.bss.page_aligned)
194         *(.bss)
195         . = ALIGN(4);
196         __bss_stop = .;
197         _end = . ;
198         /* This is where the kernel creates the early boot page tables */
199         . = ALIGN(PAGE_SIZE);
200         pg0 = . ;
201   }
202
203   /* Sections to be discarded */
204   /DISCARD/ : {
205         *(.exitcall.exit)
206         }
207
208   STABS_DEBUG
209
210   DWARF_DEBUG
211 }
212
213 #ifdef CONFIG_KEXEC
214 /* Link time checks */
215 #include <asm/kexec.h>
216
217 ASSERT(kexec_control_code_size <= KEXEC_CONTROL_CODE_MAX_SIZE,
218        "kexec control code size is too big")
219 #endif