Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-drm-fsl-dcu.git] / arch / i386 / kernel / vmlinux.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 /* Don't define absolute symbols until and unless you know that symbol
12  * value is should remain constant even if kernel image is relocated
13  * at run time. Absolute symbols are not relocated. If symbol value should
14  * change if kernel is relocated, make the symbol section relative and
15  * put it inside the section definition.
16  */
17 #define LOAD_OFFSET __PAGE_OFFSET
18
19 #include <asm-generic/vmlinux.lds.h>
20 #include <asm/thread_info.h>
21 #include <asm/page.h>
22 #include <asm/cache.h>
23 #include <asm/boot.h>
24
25 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
26 OUTPUT_ARCH(i386)
27 ENTRY(phys_startup_32)
28 jiffies = jiffies_64;
29 _proxy_pda = 0;
30
31 PHDRS {
32         text PT_LOAD FLAGS(5);  /* R_E */
33         data PT_LOAD FLAGS(7);  /* RWE */
34         note PT_NOTE FLAGS(4);  /* R__ */
35 }
36 SECTIONS
37 {
38   . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
39   phys_startup_32 = startup_32 - LOAD_OFFSET;
40   /* read-only */
41   .text : AT(ADDR(.text) - LOAD_OFFSET) {
42         _text = .;                      /* Text and read-only data */
43         *(.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   . = ALIGN(16);                /* Exception table */
53   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
54         __start___ex_table = .;
55          *(__ex_table)
56         __stop___ex_table = .;
57   }
58
59   RODATA
60
61   BUG_TABLE
62
63   . = ALIGN(4);
64   .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
65         __tracedata_start = .;
66         *(.tracedata)
67         __tracedata_end = .;
68   }
69
70   /* writeable */
71   . = ALIGN(4096);
72   .data : AT(ADDR(.data) - LOAD_OFFSET) {       /* Data */
73         *(.data)
74         CONSTRUCTORS
75         } :data
76
77   .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) {
78         __start_paravirtprobe = .;
79         *(.paravirtprobe)
80         __stop_paravirtprobe = .;
81   }
82
83   . = ALIGN(4096);
84   .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
85         __nosave_begin = .;
86         *(.data.nosave)
87         . = ALIGN(4096);
88         __nosave_end = .;
89   }
90
91   . = ALIGN(4096);
92   .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
93         *(.data.idt)
94   }
95
96   . = ALIGN(32);
97   .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
98         *(.data.cacheline_aligned)
99   }
100
101   /* rarely changed data like cpu maps */
102   . = ALIGN(32);
103   .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
104         *(.data.read_mostly)
105         _edata = .;             /* End of data section */
106   }
107
108   . = ALIGN(THREAD_SIZE);       /* init_task */
109   .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
110         *(.data.init_task)
111   }
112
113   /* might get freed after init */
114   . = ALIGN(4096);
115   .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
116         __smp_alt_begin = .;
117         __smp_alt_instructions = .;
118         *(.smp_altinstructions)
119         __smp_alt_instructions_end = .;
120   }
121   . = ALIGN(4);
122   .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
123         __smp_locks = .;
124         *(.smp_locks)
125         __smp_locks_end = .;
126   }
127   .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
128         *(.smp_altinstr_replacement)
129         __smp_alt_end = .;
130   }
131   /* will be freed after init
132    * Following ALIGN() is required to make sure no other data falls on the
133    * same page where __smp_alt_end is pointing as that page might be freed
134    * after boot. Always make sure that ALIGN() directive is present after
135    * the section which contains __smp_alt_end.
136    */
137   . = ALIGN(4096);
138
139   /* will be freed after init */
140   . = ALIGN(4096);              /* Init code and data */
141   .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
142         __init_begin = .;
143         _sinittext = .;
144         *(.init.text)
145         _einittext = .;
146   }
147   .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
148   . = ALIGN(16);
149   .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
150         __setup_start = .;
151         *(.init.setup)
152         __setup_end = .;
153    }
154   .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
155         __initcall_start = .;
156         INITCALLS
157         __initcall_end = .;
158   }
159   .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
160         __con_initcall_start = .;
161         *(.con_initcall.init)
162         __con_initcall_end = .;
163   }
164   SECURITY_INIT
165   . = ALIGN(4);
166   .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
167         __alt_instructions = .;
168         *(.altinstructions)
169         __alt_instructions_end = .;
170   }
171   .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
172         *(.altinstr_replacement)
173   }
174   . = ALIGN(4);
175   .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
176         __start_parainstructions = .;
177         *(.parainstructions)
178         __stop_parainstructions = .;
179   }
180   /* .exit.text is discard at runtime, not link time, to deal with references
181      from .altinstructions and .eh_frame */
182   .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
183   .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
184 #if defined(CONFIG_BLK_DEV_INITRD)
185   . = ALIGN(4096);
186   .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
187         __initramfs_start = .;
188         *(.init.ramfs)
189         __initramfs_end = .;
190   }
191 #endif
192   . = ALIGN(L1_CACHE_BYTES);
193   .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
194         __per_cpu_start = .;
195         *(.data.percpu)
196         __per_cpu_end = .;
197   }
198   . = ALIGN(4096);
199   /* freed after init ends here */
200         
201   .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
202         __init_end = .;
203         __bss_start = .;                /* BSS */
204         *(.bss.page_aligned)
205         *(.bss)
206         . = ALIGN(4);
207         __bss_stop = .;
208         _end = . ;
209         /* This is where the kernel creates the early boot page tables */
210         . = ALIGN(4096);
211         pg0 = . ;
212   }
213
214   /* Sections to be discarded */
215   /DISCARD/ : {
216         *(.exitcall.exit)
217         }
218
219   STABS_DEBUG
220
221   DWARF_DEBUG
222
223   NOTES
224 }