diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:12:11 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2007-10-11 05:12:11 -0400 |
commit | a60b778b5a813c6b3663db9244f5a886f0f91027 (patch) | |
tree | b968c7fe2ad188c90db8e8f9b46d8e5f18460202 /arch | |
parent | caadc5e249a19596b1c8400bf8e71320e4f0a14f (diff) |
i386: prepare shared kernel/vmlinux.lds.S
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/vmlinux.lds.S | 216 | ||||
-rw-r--r-- | arch/i386/kernel/vmlinux_32.lds.S | 213 |
2 files changed, 217 insertions, 212 deletions
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S index 7d72cce00529..849ee611f013 100644 --- a/arch/i386/kernel/vmlinux.lds.S +++ b/arch/i386/kernel/vmlinux.lds.S | |||
@@ -1,213 +1,5 @@ | |||
1 | /* ld script to make i386 Linux kernel | 1 | #ifdef CONFIG_X86_32 |
2 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; | 2 | # include "vmlinux_32.lds.S" |
3 | * | 3 | #else |
4 | * Don't define absolute symbols until and unless you know that symbol | 4 | # include "vmlinux_64.lds.S" |
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 | |||
30 | PHDRS { | ||
31 | text PT_LOAD FLAGS(5); /* R_E */ | ||
32 | data PT_LOAD FLAGS(7); /* RWE */ | ||
33 | note PT_NOTE FLAGS(0); /* ___ */ | ||
34 | } | ||
35 | SECTIONS | ||
36 | { | ||
37 | . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR; | ||
38 | phys_startup_32 = startup_32 - LOAD_OFFSET; | ||
39 | |||
40 | .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) { | ||
41 | _text = .; /* Text and read-only data */ | ||
42 | *(.text.head) | ||
43 | } :text = 0x9090 | ||
44 | |||
45 | /* read-only */ | ||
46 | .text : AT(ADDR(.text) - LOAD_OFFSET) { | ||
47 | TEXT_TEXT | ||
48 | SCHED_TEXT | ||
49 | LOCK_TEXT | ||
50 | KPROBES_TEXT | ||
51 | *(.fixup) | ||
52 | *(.gnu.warning) | ||
53 | _etext = .; /* End of text section */ | ||
54 | } :text = 0x9090 | ||
55 | |||
56 | . = ALIGN(16); /* Exception table */ | ||
57 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { | ||
58 | __start___ex_table = .; | ||
59 | *(__ex_table) | ||
60 | __stop___ex_table = .; | ||
61 | } | ||
62 | |||
63 | NOTES :text :note | ||
64 | |||
65 | BUG_TABLE :text | ||
66 | |||
67 | . = ALIGN(4); | ||
68 | .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { | ||
69 | __tracedata_start = .; | ||
70 | *(.tracedata) | ||
71 | __tracedata_end = .; | ||
72 | } | ||
73 | |||
74 | RODATA | ||
75 | |||
76 | /* writeable */ | ||
77 | . = ALIGN(4096); | ||
78 | .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ | ||
79 | DATA_DATA | ||
80 | CONSTRUCTORS | ||
81 | } :data | ||
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.page_aligned) | ||
94 | *(.data.idt) | ||
95 | } | ||
96 | |||
97 | . = ALIGN(32); | ||
98 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { | ||
99 | *(.data.cacheline_aligned) | ||
100 | } | ||
101 | |||
102 | /* rarely changed data like cpu maps */ | ||
103 | . = ALIGN(32); | ||
104 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { | ||
105 | *(.data.read_mostly) | ||
106 | _edata = .; /* End of data section */ | ||
107 | } | ||
108 | |||
109 | . = ALIGN(THREAD_SIZE); /* init_task */ | ||
110 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { | ||
111 | *(.data.init_task) | ||
112 | } | ||
113 | |||
114 | /* might get freed after init */ | ||
115 | . = ALIGN(4096); | ||
116 | .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { | ||
117 | __smp_locks = .; | ||
118 | *(.smp_locks) | ||
119 | __smp_locks_end = .; | ||
120 | } | ||
121 | /* will be freed after init | ||
122 | * Following ALIGN() is required to make sure no other data falls on the | ||
123 | * same page where __smp_alt_end is pointing as that page might be freed | ||
124 | * after boot. Always make sure that ALIGN() directive is present after | ||
125 | * the section which contains __smp_alt_end. | ||
126 | */ | ||
127 | . = ALIGN(4096); | ||
128 | |||
129 | /* will be freed after init */ | ||
130 | . = ALIGN(4096); /* Init code and data */ | ||
131 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { | ||
132 | __init_begin = .; | ||
133 | _sinittext = .; | ||
134 | *(.init.text) | ||
135 | _einittext = .; | ||
136 | } | ||
137 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } | ||
138 | . = ALIGN(16); | ||
139 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { | ||
140 | __setup_start = .; | ||
141 | *(.init.setup) | ||
142 | __setup_end = .; | ||
143 | } | ||
144 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { | ||
145 | __initcall_start = .; | ||
146 | INITCALLS | ||
147 | __initcall_end = .; | ||
148 | } | ||
149 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { | ||
150 | __con_initcall_start = .; | ||
151 | *(.con_initcall.init) | ||
152 | __con_initcall_end = .; | ||
153 | } | ||
154 | SECURITY_INIT | ||
155 | . = ALIGN(4); | ||
156 | .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { | ||
157 | __alt_instructions = .; | ||
158 | *(.altinstructions) | ||
159 | __alt_instructions_end = .; | ||
160 | } | ||
161 | .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { | ||
162 | *(.altinstr_replacement) | ||
163 | } | ||
164 | . = ALIGN(4); | ||
165 | .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) { | ||
166 | __parainstructions = .; | ||
167 | *(.parainstructions) | ||
168 | __parainstructions_end = .; | ||
169 | } | ||
170 | /* .exit.text is discard at runtime, not link time, to deal with references | ||
171 | from .altinstructions and .eh_frame */ | ||
172 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } | ||
173 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } | ||
174 | #if defined(CONFIG_BLK_DEV_INITRD) | ||
175 | . = ALIGN(4096); | ||
176 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { | ||
177 | __initramfs_start = .; | ||
178 | *(.init.ramfs) | ||
179 | __initramfs_end = .; | ||
180 | } | ||
181 | #endif | 5 | #endif |
182 | . = ALIGN(4096); | ||
183 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { | ||
184 | __per_cpu_start = .; | ||
185 | *(.data.percpu) | ||
186 | *(.data.percpu.shared_aligned) | ||
187 | __per_cpu_end = .; | ||
188 | } | ||
189 | . = ALIGN(4096); | ||
190 | /* freed after init ends here */ | ||
191 | |||
192 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { | ||
193 | __init_end = .; | ||
194 | __bss_start = .; /* BSS */ | ||
195 | *(.bss.page_aligned) | ||
196 | *(.bss) | ||
197 | . = ALIGN(4); | ||
198 | __bss_stop = .; | ||
199 | _end = . ; | ||
200 | /* This is where the kernel creates the early boot page tables */ | ||
201 | . = ALIGN(4096); | ||
202 | pg0 = . ; | ||
203 | } | ||
204 | |||
205 | /* Sections to be discarded */ | ||
206 | /DISCARD/ : { | ||
207 | *(.exitcall.exit) | ||
208 | } | ||
209 | |||
210 | STABS_DEBUG | ||
211 | |||
212 | DWARF_DEBUG | ||
213 | } | ||
diff --git a/arch/i386/kernel/vmlinux_32.lds.S b/arch/i386/kernel/vmlinux_32.lds.S new file mode 100644 index 000000000000..7d72cce00529 --- /dev/null +++ b/arch/i386/kernel/vmlinux_32.lds.S | |||
@@ -0,0 +1,213 @@ | |||
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 | |||
30 | PHDRS { | ||
31 | text PT_LOAD FLAGS(5); /* R_E */ | ||
32 | data PT_LOAD FLAGS(7); /* RWE */ | ||
33 | note PT_NOTE FLAGS(0); /* ___ */ | ||
34 | } | ||
35 | SECTIONS | ||
36 | { | ||
37 | . = LOAD_OFFSET + LOAD_PHYSICAL_ADDR; | ||
38 | phys_startup_32 = startup_32 - LOAD_OFFSET; | ||
39 | |||
40 | .text.head : AT(ADDR(.text.head) - LOAD_OFFSET) { | ||
41 | _text = .; /* Text and read-only data */ | ||
42 | *(.text.head) | ||
43 | } :text = 0x9090 | ||
44 | |||
45 | /* read-only */ | ||
46 | .text : AT(ADDR(.text) - LOAD_OFFSET) { | ||
47 | TEXT_TEXT | ||
48 | SCHED_TEXT | ||
49 | LOCK_TEXT | ||
50 | KPROBES_TEXT | ||
51 | *(.fixup) | ||
52 | *(.gnu.warning) | ||
53 | _etext = .; /* End of text section */ | ||
54 | } :text = 0x9090 | ||
55 | |||
56 | . = ALIGN(16); /* Exception table */ | ||
57 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { | ||
58 | __start___ex_table = .; | ||
59 | *(__ex_table) | ||
60 | __stop___ex_table = .; | ||
61 | } | ||
62 | |||
63 | NOTES :text :note | ||
64 | |||
65 | BUG_TABLE :text | ||
66 | |||
67 | . = ALIGN(4); | ||
68 | .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { | ||
69 | __tracedata_start = .; | ||
70 | *(.tracedata) | ||
71 | __tracedata_end = .; | ||
72 | } | ||
73 | |||
74 | RODATA | ||
75 | |||
76 | /* writeable */ | ||
77 | . = ALIGN(4096); | ||
78 | .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ | ||
79 | DATA_DATA | ||
80 | CONSTRUCTORS | ||
81 | } :data | ||
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.page_aligned) | ||
94 | *(.data.idt) | ||
95 | } | ||
96 | |||
97 | . = ALIGN(32); | ||
98 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { | ||
99 | *(.data.cacheline_aligned) | ||
100 | } | ||
101 | |||
102 | /* rarely changed data like cpu maps */ | ||
103 | . = ALIGN(32); | ||
104 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { | ||
105 | *(.data.read_mostly) | ||
106 | _edata = .; /* End of data section */ | ||
107 | } | ||
108 | |||
109 | . = ALIGN(THREAD_SIZE); /* init_task */ | ||
110 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { | ||
111 | *(.data.init_task) | ||
112 | } | ||
113 | |||
114 | /* might get freed after init */ | ||
115 | . = ALIGN(4096); | ||
116 | .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { | ||
117 | __smp_locks = .; | ||
118 | *(.smp_locks) | ||
119 | __smp_locks_end = .; | ||
120 | } | ||
121 | /* will be freed after init | ||
122 | * Following ALIGN() is required to make sure no other data falls on the | ||
123 | * same page where __smp_alt_end is pointing as that page might be freed | ||
124 | * after boot. Always make sure that ALIGN() directive is present after | ||
125 | * the section which contains __smp_alt_end. | ||
126 | */ | ||
127 | . = ALIGN(4096); | ||
128 | |||
129 | /* will be freed after init */ | ||
130 | . = ALIGN(4096); /* Init code and data */ | ||
131 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { | ||
132 | __init_begin = .; | ||
133 | _sinittext = .; | ||
134 | *(.init.text) | ||
135 | _einittext = .; | ||
136 | } | ||
137 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } | ||
138 | . = ALIGN(16); | ||
139 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { | ||
140 | __setup_start = .; | ||
141 | *(.init.setup) | ||
142 | __setup_end = .; | ||
143 | } | ||
144 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { | ||
145 | __initcall_start = .; | ||
146 | INITCALLS | ||
147 | __initcall_end = .; | ||
148 | } | ||
149 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { | ||
150 | __con_initcall_start = .; | ||
151 | *(.con_initcall.init) | ||
152 | __con_initcall_end = .; | ||
153 | } | ||
154 | SECURITY_INIT | ||
155 | . = ALIGN(4); | ||
156 | .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { | ||
157 | __alt_instructions = .; | ||
158 | *(.altinstructions) | ||
159 | __alt_instructions_end = .; | ||
160 | } | ||
161 | .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { | ||
162 | *(.altinstr_replacement) | ||
163 | } | ||
164 | . = ALIGN(4); | ||
165 | .parainstructions : AT(ADDR(.parainstructions) - LOAD_OFFSET) { | ||
166 | __parainstructions = .; | ||
167 | *(.parainstructions) | ||
168 | __parainstructions_end = .; | ||
169 | } | ||
170 | /* .exit.text is discard at runtime, not link time, to deal with references | ||
171 | from .altinstructions and .eh_frame */ | ||
172 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } | ||
173 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } | ||
174 | #if defined(CONFIG_BLK_DEV_INITRD) | ||
175 | . = ALIGN(4096); | ||
176 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { | ||
177 | __initramfs_start = .; | ||
178 | *(.init.ramfs) | ||
179 | __initramfs_end = .; | ||
180 | } | ||
181 | #endif | ||
182 | . = ALIGN(4096); | ||
183 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { | ||
184 | __per_cpu_start = .; | ||
185 | *(.data.percpu) | ||
186 | *(.data.percpu.shared_aligned) | ||
187 | __per_cpu_end = .; | ||
188 | } | ||
189 | . = ALIGN(4096); | ||
190 | /* freed after init ends here */ | ||
191 | |||
192 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { | ||
193 | __init_end = .; | ||
194 | __bss_start = .; /* BSS */ | ||
195 | *(.bss.page_aligned) | ||
196 | *(.bss) | ||
197 | . = ALIGN(4); | ||
198 | __bss_stop = .; | ||
199 | _end = . ; | ||
200 | /* This is where the kernel creates the early boot page tables */ | ||
201 | . = ALIGN(4096); | ||
202 | pg0 = . ; | ||
203 | } | ||
204 | |||
205 | /* Sections to be discarded */ | ||
206 | /DISCARD/ : { | ||
207 | *(.exitcall.exit) | ||
208 | } | ||
209 | |||
210 | STABS_DEBUG | ||
211 | |||
212 | DWARF_DEBUG | ||
213 | } | ||