aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/vmlinux.lds.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/vmlinux.lds.S')
-rw-r--r--arch/i386/kernel/vmlinux.lds.S150
1 files changed, 91 insertions, 59 deletions
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index c6f84a0322ba..a53c8b1854b5 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -1,18 +1,32 @@
1/* ld script to make i386 Linux kernel 1/* ld script to make i386 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; 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.
3 */ 9 */
4 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 */
5#define LOAD_OFFSET __PAGE_OFFSET 17#define LOAD_OFFSET __PAGE_OFFSET
6 18
7#include <asm-generic/vmlinux.lds.h> 19#include <asm-generic/vmlinux.lds.h>
8#include <asm/thread_info.h> 20#include <asm/thread_info.h>
9#include <asm/page.h> 21#include <asm/page.h>
10#include <asm/cache.h> 22#include <asm/cache.h>
23#include <asm/boot.h>
11 24
12OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") 25OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
13OUTPUT_ARCH(i386) 26OUTPUT_ARCH(i386)
14ENTRY(phys_startup_32) 27ENTRY(phys_startup_32)
15jiffies = jiffies_64; 28jiffies = jiffies_64;
29_proxy_pda = 0;
16 30
17PHDRS { 31PHDRS {
18 text PT_LOAD FLAGS(5); /* R_E */ 32 text PT_LOAD FLAGS(5); /* R_E */
@@ -21,34 +35,37 @@ PHDRS {
21} 35}
22SECTIONS 36SECTIONS
23{ 37{
24 . = __KERNEL_START; 38 . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR;
25 phys_startup_32 = startup_32 - LOAD_OFFSET; 39 phys_startup_32 = startup_32 - LOAD_OFFSET;
26 /* read-only */ 40 /* read-only */
27 _text = .; /* Text and read-only data */
28 .text : AT(ADDR(.text) - LOAD_OFFSET) { 41 .text : AT(ADDR(.text) - LOAD_OFFSET) {
42 _text = .; /* Text and read-only data */
29 *(.text) 43 *(.text)
30 SCHED_TEXT 44 SCHED_TEXT
31 LOCK_TEXT 45 LOCK_TEXT
32 KPROBES_TEXT 46 KPROBES_TEXT
33 *(.fixup) 47 *(.fixup)
34 *(.gnu.warning) 48 *(.gnu.warning)
35 } :text = 0x9090 49 _etext = .; /* End of text section */
36 50 } :text = 0x9090
37 _etext = .; /* End of text section */
38 51
39 . = ALIGN(16); /* Exception table */ 52 . = ALIGN(16); /* Exception table */
40 __start___ex_table = .; 53 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
41 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) } 54 __start___ex_table = .;
42 __stop___ex_table = .; 55 *(__ex_table)
56 __stop___ex_table = .;
57 }
43 58
44 RODATA 59 RODATA
45 60
61 BUG_TABLE
62
46 . = ALIGN(4); 63 . = ALIGN(4);
47 __tracedata_start = .;
48 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { 64 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
65 __tracedata_start = .;
49 *(.tracedata) 66 *(.tracedata)
67 __tracedata_end = .;
50 } 68 }
51 __tracedata_end = .;
52 69
53 /* writeable */ 70 /* writeable */
54 . = ALIGN(4096); 71 . = ALIGN(4096);
@@ -57,11 +74,19 @@ SECTIONS
57 CONSTRUCTORS 74 CONSTRUCTORS
58 } :data 75 } :data
59 76
77 .paravirtprobe : AT(ADDR(.paravirtprobe) - LOAD_OFFSET) {
78 __start_paravirtprobe = .;
79 *(.paravirtprobe)
80 __stop_paravirtprobe = .;
81 }
82
60 . = ALIGN(4096); 83 . = ALIGN(4096);
61 __nosave_begin = .; 84 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) {
62 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) } 85 __nosave_begin = .;
63 . = ALIGN(4096); 86 *(.data.nosave)
64 __nosave_end = .; 87 . = ALIGN(4096);
88 __nosave_end = .;
89 }
65 90
66 . = ALIGN(4096); 91 . = ALIGN(4096);
67 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { 92 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
@@ -75,17 +100,10 @@ SECTIONS
75 100
76 /* rarely changed data like cpu maps */ 101 /* rarely changed data like cpu maps */
77 . = ALIGN(32); 102 . = ALIGN(32);
78 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) } 103 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
79 _edata = .; /* End of data section */ 104 *(.data.read_mostly)
80 105 _edata = .; /* End of data section */
81#ifdef CONFIG_STACK_UNWIND
82 . = ALIGN(4);
83 .eh_frame : AT(ADDR(.eh_frame) - LOAD_OFFSET) {
84 __start_unwind = .;
85 *(.eh_frame)
86 __end_unwind = .;
87 } 106 }
88#endif
89 107
90 . = ALIGN(THREAD_SIZE); /* init_task */ 108 . = ALIGN(THREAD_SIZE); /* init_task */
91 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { 109 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
@@ -94,88 +112,102 @@ SECTIONS
94 112
95 /* might get freed after init */ 113 /* might get freed after init */
96 . = ALIGN(4096); 114 . = ALIGN(4096);
97 __smp_alt_begin = .;
98 __smp_alt_instructions = .;
99 .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) { 115 .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
116 __smp_alt_begin = .;
117 __smp_alt_instructions = .;
100 *(.smp_altinstructions) 118 *(.smp_altinstructions)
119 __smp_alt_instructions_end = .;
101 } 120 }
102 __smp_alt_instructions_end = .;
103 . = ALIGN(4); 121 . = ALIGN(4);
104 __smp_locks = .;
105 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { 122 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
123 __smp_locks = .;
106 *(.smp_locks) 124 *(.smp_locks)
125 __smp_locks_end = .;
107 } 126 }
108 __smp_locks_end = .;
109 .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) { 127 .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
110 *(.smp_altinstr_replacement) 128 *(.smp_altinstr_replacement)
129 __smp_alt_end = .;
111 } 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 */
112 . = ALIGN(4096); 137 . = ALIGN(4096);
113 __smp_alt_end = .;
114 138
115 /* will be freed after init */ 139 /* will be freed after init */
116 . = ALIGN(4096); /* Init code and data */ 140 . = ALIGN(4096); /* Init code and data */
117 __init_begin = .;
118 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { 141 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
142 __init_begin = .;
119 _sinittext = .; 143 _sinittext = .;
120 *(.init.text) 144 *(.init.text)
121 _einittext = .; 145 _einittext = .;
122 } 146 }
123 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } 147 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
124 . = ALIGN(16); 148 . = ALIGN(16);
125 __setup_start = .; 149 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
126 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) } 150 __setup_start = .;
127 __setup_end = .; 151 *(.init.setup)
128 __initcall_start = .; 152 __setup_end = .;
153 }
129 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { 154 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
155 __initcall_start = .;
130 INITCALLS 156 INITCALLS
157 __initcall_end = .;
131 } 158 }
132 __initcall_end = .;
133 __con_initcall_start = .;
134 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { 159 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
160 __con_initcall_start = .;
135 *(.con_initcall.init) 161 *(.con_initcall.init)
162 __con_initcall_end = .;
136 } 163 }
137 __con_initcall_end = .;
138 SECURITY_INIT 164 SECURITY_INIT
139 . = ALIGN(4); 165 . = ALIGN(4);
140 __alt_instructions = .;
141 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { 166 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
167 __alt_instructions = .;
142 *(.altinstructions) 168 *(.altinstructions)
169 __alt_instructions_end = .;
143 } 170 }
144 __alt_instructions_end = .;
145 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { 171 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
146 *(.altinstr_replacement) 172 *(.altinstr_replacement)
147 } 173 }
174 . = ALIGN(4);
175 .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) {
176 __start_parainstructions = .;
177 *(.parainstructions)
178 __stop_parainstructions = .;
179 }
148 /* .exit.text is discard at runtime, not link time, to deal with references 180 /* .exit.text is discard at runtime, not link time, to deal with references
149 from .altinstructions and .eh_frame */ 181 from .altinstructions and .eh_frame */
150 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } 182 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
151 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } 183 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
152 . = ALIGN(4096); 184 . = ALIGN(4096);
153 __initramfs_start = .; 185 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
154 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) } 186 __initramfs_start = .;
155 __initramfs_end = .; 187 *(.init.ramfs)
188 __initramfs_end = .;
189 }
156 . = ALIGN(L1_CACHE_BYTES); 190 . = ALIGN(L1_CACHE_BYTES);
157 __per_cpu_start = .; 191 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) {
158 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) } 192 __per_cpu_start = .;
159 __per_cpu_end = .; 193 *(.data.percpu)
194 __per_cpu_end = .;
195 }
160 . = ALIGN(4096); 196 . = ALIGN(4096);
161 __init_end = .;
162 /* freed after init ends here */ 197 /* freed after init ends here */
163 198
164 __bss_start = .; /* BSS */
165 .bss.page_aligned : AT(ADDR(.bss.page_aligned) - LOAD_OFFSET) {
166 *(.bss.page_aligned)
167 }
168 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { 199 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
200 __init_end = .;
201 __bss_start = .; /* BSS */
202 *(.bss.page_aligned)
169 *(.bss) 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 = . ;
170 } 210 }
171 . = ALIGN(4);
172 __bss_stop = .;
173
174 _end = . ;
175
176 /* This is where the kernel creates the early boot page tables */
177 . = ALIGN(4096);
178 pg0 = .;
179 211
180 /* Sections to be discarded */ 212 /* Sections to be discarded */
181 /DISCARD/ : { 213 /DISCARD/ : {