blob: adc1f232afeeddad4e92b8ee26412440966aef4d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* ld script to make i386 Linux kernel
2 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
3 */
4
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -07005#define LOAD_OFFSET __PAGE_OFFSET
6
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <asm-generic/vmlinux.lds.h>
8#include <asm/thread_info.h>
9#include <asm/page.h>
Zach Brown379b5442006-01-27 14:02:47 -080010#include <asm/cache.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
12OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
13OUTPUT_ARCH(i386)
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070014ENTRY(phys_startup_32)
Linus Torvalds1da177e2005-04-16 15:20:36 -070015jiffies = jiffies_64;
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -070016
17PHDRS {
18 text PT_LOAD FLAGS(5); /* R_E */
19 data PT_LOAD FLAGS(7); /* RWE */
20 note PT_NOTE FLAGS(4); /* R__ */
21}
Linus Torvalds1da177e2005-04-16 15:20:36 -070022SECTIONS
23{
Eric W. Biederman3d345e32005-06-25 14:57:49 -070024 . = __KERNEL_START;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070025 phys_startup_32 = startup_32 - LOAD_OFFSET;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 /* read-only */
27 _text = .; /* Text and read-only data */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070028 .text : AT(ADDR(.text) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 *(.text)
30 SCHED_TEXT
31 LOCK_TEXT
Prasanna S Panchamukhi3d97ae52005-09-06 15:19:27 -070032 KPROBES_TEXT
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 *(.fixup)
34 *(.gnu.warning)
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -070035 } :text = 0x9090
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
37 _etext = .; /* End of text section */
38
39 . = ALIGN(16); /* Exception table */
40 __start___ex_table = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070041 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 __stop___ex_table = .;
43
44 RODATA
45
Linus Torvaldseb71c872006-06-24 14:27:42 -070046 . = ALIGN(4);
47 __tracedata_start = .;
48 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {
49 *(.tracedata)
50 }
51 __tracedata_end = .;
52
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 /* writeable */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070054 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 *(.data)
56 CONSTRUCTORS
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -070057 } :data
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
59 . = ALIGN(4096);
60 __nosave_begin = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070061 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 . = ALIGN(4096);
63 __nosave_end = .;
64
65 . = ALIGN(4096);
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070066 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
67 *(.data.idt)
68 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070069
70 . = ALIGN(32);
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070071 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
72 *(.data.cacheline_aligned)
73 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
Christoph Lameter6c036522005-07-07 17:56:59 -070075 /* rarely changed data like cpu maps */
76 . = ALIGN(32);
77 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070078 _edata = .; /* End of data section */
79
Jan Beulich176a2712006-06-26 13:57:41 +020080#ifdef CONFIG_STACK_UNWIND
81 . = ALIGN(4);
82 .eh_frame : AT(ADDR(.eh_frame) - LOAD_OFFSET) {
83 __start_unwind = .;
84 *(.eh_frame)
85 __end_unwind = .;
86 }
87#endif
88
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 . = ALIGN(THREAD_SIZE); /* init_task */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070090 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
91 *(.data.init_task)
92 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
Gerd Hoffmann9a0b5812006-03-23 02:59:32 -080094 /* might get freed after init */
95 . = ALIGN(4096);
96 __smp_alt_begin = .;
97 __smp_alt_instructions = .;
98 .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
99 *(.smp_altinstructions)
100 }
101 __smp_alt_instructions_end = .;
102 . = ALIGN(4);
103 __smp_locks = .;
104 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
105 *(.smp_locks)
106 }
107 __smp_locks_end = .;
108 .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
109 *(.smp_altinstr_replacement)
110 }
111 . = ALIGN(4096);
112 __smp_alt_end = .;
113
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 /* will be freed after init */
115 . = ALIGN(4096); /* Init code and data */
116 __init_begin = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700117 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 _sinittext = .;
119 *(.init.text)
120 _einittext = .;
121 }
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700122 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 . = ALIGN(16);
124 __setup_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700125 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126 __setup_end = .;
127 __initcall_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700128 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700129 INITCALLS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 }
131 __initcall_end = .;
132 __con_initcall_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700133 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
134 *(.con_initcall.init)
135 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 __con_initcall_end = .;
137 SECURITY_INIT
138 . = ALIGN(4);
139 __alt_instructions = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700140 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
141 *(.altinstructions)
142 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 __alt_instructions_end = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700144 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
145 *(.altinstr_replacement)
146 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147 /* .exit.text is discard at runtime, not link time, to deal with references
148 from .altinstructions and .eh_frame */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700149 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
150 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 . = ALIGN(4096);
152 __initramfs_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700153 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 __initramfs_end = .;
Zach Brown379b5442006-01-27 14:02:47 -0800155 . = ALIGN(L1_CACHE_BYTES);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 __per_cpu_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700157 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 __per_cpu_end = .;
159 . = ALIGN(4096);
160 __init_end = .;
161 /* freed after init ends here */
162
163 __bss_start = .; /* BSS */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700164 .bss.page_aligned : AT(ADDR(.bss.page_aligned) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 *(.bss.page_aligned)
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700166 }
167 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168 *(.bss)
169 }
170 . = ALIGN(4);
171 __bss_stop = .;
172
173 _end = . ;
174
175 /* This is where the kernel creates the early boot page tables */
176 . = ALIGN(4096);
177 pg0 = .;
178
179 /* Sections to be discarded */
180 /DISCARD/ : {
181 *(.exitcall.exit)
182 }
183
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200184 STABS_DEBUG
185
186 DWARF_DEBUG
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -0700187
188 NOTES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189}