blob: c6f84a0322ba30438dda746a630ef68e4ace7306 [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 */
Vivek Goyalc06cb8b2006-11-08 17:44:41 -080054 . = ALIGN(4096);
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070055 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 *(.data)
57 CONSTRUCTORS
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -070058 } :data
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
60 . = ALIGN(4096);
61 __nosave_begin = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070062 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 . = ALIGN(4096);
64 __nosave_end = .;
65
66 . = ALIGN(4096);
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070067 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
68 *(.data.idt)
69 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070070
71 . = ALIGN(32);
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070072 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
73 *(.data.cacheline_aligned)
74 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Christoph Lameter6c036522005-07-07 17:56:59 -070076 /* rarely changed data like cpu maps */
77 . = ALIGN(32);
78 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 _edata = .; /* End of data section */
80
Jan Beulich176a2712006-06-26 13:57:41 +020081#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 }
88#endif
89
Linus Torvalds1da177e2005-04-16 15:20:36 -070090 . = ALIGN(THREAD_SIZE); /* init_task */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070091 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
92 *(.data.init_task)
93 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070094
Gerd Hoffmann9a0b5812006-03-23 02:59:32 -080095 /* might get freed after init */
96 . = ALIGN(4096);
97 __smp_alt_begin = .;
98 __smp_alt_instructions = .;
99 .smp_altinstructions : AT(ADDR(.smp_altinstructions) - LOAD_OFFSET) {
100 *(.smp_altinstructions)
101 }
102 __smp_alt_instructions_end = .;
103 . = ALIGN(4);
104 __smp_locks = .;
105 .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
106 *(.smp_locks)
107 }
108 __smp_locks_end = .;
109 .smp_altinstr_replacement : AT(ADDR(.smp_altinstr_replacement) - LOAD_OFFSET) {
110 *(.smp_altinstr_replacement)
111 }
112 . = ALIGN(4096);
113 __smp_alt_end = .;
114
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 /* will be freed after init */
116 . = ALIGN(4096); /* Init code and data */
117 __init_begin = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700118 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 _sinittext = .;
120 *(.init.text)
121 _einittext = .;
122 }
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700123 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 . = ALIGN(16);
125 __setup_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700126 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 __setup_end = .;
128 __initcall_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700129 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700130 INITCALLS
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 }
132 __initcall_end = .;
133 __con_initcall_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700134 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
135 *(.con_initcall.init)
136 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137 __con_initcall_end = .;
138 SECURITY_INIT
139 . = ALIGN(4);
140 __alt_instructions = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700141 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
142 *(.altinstructions)
143 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 __alt_instructions_end = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700145 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
146 *(.altinstr_replacement)
147 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 /* .exit.text is discard at runtime, not link time, to deal with references
149 from .altinstructions and .eh_frame */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700150 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
151 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 . = ALIGN(4096);
153 __initramfs_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700154 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155 __initramfs_end = .;
Zach Brown379b5442006-01-27 14:02:47 -0800156 . = ALIGN(L1_CACHE_BYTES);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 __per_cpu_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700158 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159 __per_cpu_end = .;
160 . = ALIGN(4096);
161 __init_end = .;
162 /* freed after init ends here */
163
164 __bss_start = .; /* BSS */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700165 .bss.page_aligned : AT(ADDR(.bss.page_aligned) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166 *(.bss.page_aligned)
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700167 }
168 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169 *(.bss)
170 }
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
180 /* Sections to be discarded */
181 /DISCARD/ : {
182 *(.exitcall.exit)
183 }
184
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200185 STABS_DEBUG
186
187 DWARF_DEBUG
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -0700188
189 NOTES
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190}