blob: 18f99cce58957af5695310d1aab65f13cc582303 [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;
16SECTIONS
17{
Eric W. Biederman3d345e32005-06-25 14:57:49 -070018 . = __KERNEL_START;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070019 phys_startup_32 = startup_32 - LOAD_OFFSET;
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 /* read-only */
21 _text = .; /* Text and read-only data */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070022 .text : AT(ADDR(.text) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070023 *(.text)
24 SCHED_TEXT
25 LOCK_TEXT
Prasanna S Panchamukhi3d97ae52005-09-06 15:19:27 -070026 KPROBES_TEXT
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 *(.fixup)
28 *(.gnu.warning)
29 } = 0x9090
30
31 _etext = .; /* End of text section */
32
33 . = ALIGN(16); /* Exception table */
34 __start___ex_table = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070035 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 __stop___ex_table = .;
37
38 RODATA
39
40 /* writeable */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070041 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 *(.data)
43 CONSTRUCTORS
44 }
45
46 . = ALIGN(4096);
47 __nosave_begin = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070048 .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 . = ALIGN(4096);
50 __nosave_end = .;
51
52 . = ALIGN(4096);
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070053 .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) {
54 *(.data.idt)
55 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
57 . = ALIGN(32);
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070058 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
59 *(.data.cacheline_aligned)
60 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
Christoph Lameter6c036522005-07-07 17:56:59 -070062 /* rarely changed data like cpu maps */
63 . = ALIGN(32);
64 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 _edata = .; /* End of data section */
66
67 . = ALIGN(THREAD_SIZE); /* init_task */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070068 .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) {
69 *(.data.init_task)
70 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
72 /* will be freed after init */
73 . = ALIGN(4096); /* Init code and data */
74 __init_begin = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070075 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 _sinittext = .;
77 *(.init.text)
78 _einittext = .;
79 }
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070080 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 . = ALIGN(16);
82 __setup_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070083 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 __setup_end = .;
85 __initcall_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070086 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 *(.initcall1.init)
88 *(.initcall2.init)
89 *(.initcall3.init)
90 *(.initcall4.init)
91 *(.initcall5.init)
92 *(.initcall6.init)
93 *(.initcall7.init)
94 }
95 __initcall_end = .;
96 __con_initcall_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -070097 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
98 *(.con_initcall.init)
99 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 __con_initcall_end = .;
101 SECURITY_INIT
102 . = ALIGN(4);
103 __alt_instructions = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700104 .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
105 *(.altinstructions)
106 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 __alt_instructions_end = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700108 .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
109 *(.altinstr_replacement)
110 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 /* .exit.text is discard at runtime, not link time, to deal with references
112 from .altinstructions and .eh_frame */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700113 .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) }
114 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 . = ALIGN(4096);
116 __initramfs_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700117 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 __initramfs_end = .;
Zach Brown379b5442006-01-27 14:02:47 -0800119 . = ALIGN(L1_CACHE_BYTES);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120 __per_cpu_start = .;
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700121 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 __per_cpu_end = .;
123 . = ALIGN(4096);
124 __init_end = .;
125 /* freed after init ends here */
126
127 __bss_start = .; /* BSS */
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700128 .bss.page_aligned : AT(ADDR(.bss.page_aligned) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 *(.bss.page_aligned)
Eric W. Biedermanad0d75e2005-06-25 14:57:47 -0700130 }
131 .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 *(.bss)
133 }
134 . = ALIGN(4);
135 __bss_stop = .;
136
137 _end = . ;
138
139 /* This is where the kernel creates the early boot page tables */
140 . = ALIGN(4096);
141 pg0 = .;
142
143 /* Sections to be discarded */
144 /DISCARD/ : {
145 *(.exitcall.exit)
146 }
147
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200148 STABS_DEBUG
149
150 DWARF_DEBUG
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151}