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