OSDN Git Service

[PATCH] paravirt: Add startup infrastructure for paravirtualization
[sagit-ice-cold/kernel_xiaomi_msm8998.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 #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(4);  /* R__ */
28 }
29 SECTIONS
30 {
31   . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
32   phys_startup_32 = startup_32 - LOAD_OFFSET;
33   /* read-only */
34   .text : AT(ADDR(.text) - LOAD_OFFSET) {
35         _text = .;                      /* Text and read-only data */
36         *(.text)
37         SCHED_TEXT
38         LOCK_TEXT
39         KPROBES_TEXT
40         *(.fixup)
41         *(.gnu.warning)
42         _etext = .;                     /* End of text section */
43   } :text = 0x9090
44
45   . = ALIGN(16);                /* Exception table */
46   __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
47         __start___ex_table = .;
48          *(__ex_table)
49         __stop___ex_table = .;
50   }
51
52   RODATA
53
54   . = ALIGN(4);
55   .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
56         __tracedata_start = .;
57         *(.tracedata)
58         __tracedata_end = .;
59   }
60
61   /* writeable */
62   . = ALIGN(4096);
63   .data : AT(ADDR(.data) - LOAD_OFFSET) {       /* Data */
64         *(.data)
65         CONSTRUCTORS
66         } :data
67
68   __start_paravirtprobe = .;
69   .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) {
70         *(.paravirtprobe)
71   }
72   __stop_paravirtprobe = .;
73
74   . = ALIGN(4096);
75   .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
76         __nosave_begin = .;
77         *(.data.nosave)
78         . = ALIGN(4096);
79         __nosave_end = .;
80   }
81
82   . = ALIGN(4096);
83   .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
84         *(.data.idt)
85   }
86
87   . = ALIGN(32);
88   .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
89         *(.data.cacheline_aligned)
90   }
91
92   /* rarely changed data like cpu maps */
93   . = ALIGN(32);
94   .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
95         *(.data.read_mostly)
96         _edata = .;             /* End of data section */
97   }
98
99 #ifdef CONFIG_STACK_UNWIND
100   . = ALIGN(4);
101   .eh_frame : AT(ADDR(.eh_frame) - LOAD_OFFSET) {
102         __start_unwind = .;
103         *(.eh_frame)
104         __end_unwind = .;
105   }
106 #endif
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   __start_parainstructions = .;
176   .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
177         *(.parainstructions)
178   }
179   __stop_parainstructions = .;
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   . = ALIGN(4096);
185   .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
186         __initramfs_start = .;
187         *(.init.ramfs)
188         __initramfs_end = .;
189   }
190   . = ALIGN(L1_CACHE_BYTES);
191   .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
192         __per_cpu_start = .;
193         *(.data.percpu)
194         __per_cpu_end = .;
195   }
196   . = ALIGN(4096);
197   /* freed after init ends here */
198         
199   .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
200         __init_end = .;
201         __bss_start = .;                /* BSS */
202         *(.bss.page_aligned)
203         *(.bss)
204         . = ALIGN(4);
205         __bss_stop = .;
206         _end = . ;
207         /* This is where the kernel creates the early boot page tables */
208         . = ALIGN(4096);
209         pg0 = . ;
210   }
211
212   /* Sections to be discarded */
213   /DISCARD/ : {
214         *(.exitcall.exit)
215         }
216
217   STABS_DEBUG
218
219   DWARF_DEBUG
220
221   NOTES
222 }