Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* ld script to make i386 Linux kernel |
| 2 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; |
| 3 | */ |
| 4 | |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 5 | #define LOAD_OFFSET __PAGE_OFFSET |
| 6 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include <asm-generic/vmlinux.lds.h> |
| 8 | #include <asm/thread_info.h> |
| 9 | #include <asm/page.h> |
Zach Brown | 379b544 | 2006-01-27 14:02:47 -0800 | [diff] [blame] | 10 | #include <asm/cache.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
| 12 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") |
| 13 | OUTPUT_ARCH(i386) |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 14 | ENTRY(phys_startup_32) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | jiffies = jiffies_64; |
Jeremy Fitzhardinge | 9c9b8b3 | 2006-09-25 23:32:26 -0700 | [diff] [blame] | 16 | |
| 17 | PHDRS { |
| 18 | text PT_LOAD FLAGS(5); /* R_E */ |
| 19 | data PT_LOAD FLAGS(7); /* RWE */ |
| 20 | note PT_NOTE FLAGS(4); /* R__ */ |
| 21 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | SECTIONS |
| 23 | { |
Eric W. Biederman | 3d345e3 | 2005-06-25 14:57:49 -0700 | [diff] [blame] | 24 | . = __KERNEL_START; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 25 | phys_startup_32 = startup_32 - LOAD_OFFSET; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | /* read-only */ |
| 27 | _text = .; /* Text and read-only data */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 28 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | *(.text) |
| 30 | SCHED_TEXT |
| 31 | LOCK_TEXT |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 32 | KPROBES_TEXT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | *(.fixup) |
| 34 | *(.gnu.warning) |
Jeremy Fitzhardinge | 9c9b8b3 | 2006-09-25 23:32:26 -0700 | [diff] [blame] | 35 | } :text = 0x9090 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | _etext = .; /* End of text section */ |
| 38 | |
| 39 | . = ALIGN(16); /* Exception table */ |
| 40 | __start___ex_table = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 41 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | __stop___ex_table = .; |
| 43 | |
| 44 | RODATA |
| 45 | |
Linus Torvalds | eb71c87 | 2006-06-24 14:27:42 -0700 | [diff] [blame] | 46 | . = ALIGN(4); |
| 47 | __tracedata_start = .; |
| 48 | .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { |
| 49 | *(.tracedata) |
| 50 | } |
| 51 | __tracedata_end = .; |
| 52 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | /* writeable */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 54 | .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | *(.data) |
| 56 | CONSTRUCTORS |
Jeremy Fitzhardinge | 9c9b8b3 | 2006-09-25 23:32:26 -0700 | [diff] [blame] | 57 | } :data |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
| 59 | . = ALIGN(4096); |
| 60 | __nosave_begin = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 61 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | . = ALIGN(4096); |
| 63 | __nosave_end = .; |
| 64 | |
| 65 | . = ALIGN(4096); |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 66 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { |
| 67 | *(.data.idt) |
| 68 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
| 70 | . = ALIGN(32); |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 71 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { |
| 72 | *(.data.cacheline_aligned) |
| 73 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | |
Christoph Lameter | 6c03652 | 2005-07-07 17:56:59 -0700 | [diff] [blame] | 75 | /* rarely changed data like cpu maps */ |
| 76 | . = ALIGN(32); |
| 77 | .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | _edata = .; /* End of data section */ |
| 79 | |
Jan Beulich | 176a271 | 2006-06-26 13:57:41 +0200 | [diff] [blame] | 80 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | . = ALIGN(THREAD_SIZE); /* init_task */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 90 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { |
| 91 | *(.data.init_task) |
| 92 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | |
Gerd Hoffmann | 9a0b581 | 2006-03-23 02:59:32 -0800 | [diff] [blame] | 94 | /* 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | /* will be freed after init */ |
| 115 | . = ALIGN(4096); /* Init code and data */ |
| 116 | __init_begin = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 117 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | _sinittext = .; |
| 119 | *(.init.text) |
| 120 | _einittext = .; |
| 121 | } |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 122 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | . = ALIGN(16); |
| 124 | __setup_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 125 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | __setup_end = .; |
| 127 | __initcall_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 128 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
Andrew Morton | 61ce1ef | 2006-10-27 11:41:44 -0700 | [diff] [blame^] | 129 | INITCALLS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | } |
| 131 | __initcall_end = .; |
| 132 | __con_initcall_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 133 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
| 134 | *(.con_initcall.init) |
| 135 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | __con_initcall_end = .; |
| 137 | SECURITY_INIT |
| 138 | . = ALIGN(4); |
| 139 | __alt_instructions = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 140 | .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { |
| 141 | *(.altinstructions) |
| 142 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | __alt_instructions_end = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 144 | .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { |
| 145 | *(.altinstr_replacement) |
| 146 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | /* .exit.text is discard at runtime, not link time, to deal with references |
| 148 | from .altinstructions and .eh_frame */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 149 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } |
| 150 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | . = ALIGN(4096); |
| 152 | __initramfs_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 153 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | __initramfs_end = .; |
Zach Brown | 379b544 | 2006-01-27 14:02:47 -0800 | [diff] [blame] | 155 | . = ALIGN(L1_CACHE_BYTES); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | __per_cpu_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 157 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | __per_cpu_end = .; |
| 159 | . = ALIGN(4096); |
| 160 | __init_end = .; |
| 161 | /* freed after init ends here */ |
| 162 | |
| 163 | __bss_start = .; /* BSS */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 164 | .bss.page_aligned : AT(ADDR(.bss.page_aligned) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | *(.bss.page_aligned) |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 166 | } |
| 167 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | *(.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' Giarrusso | a7d0c21 | 2005-09-10 19:44:54 +0200 | [diff] [blame] | 184 | STABS_DEBUG |
| 185 | |
| 186 | DWARF_DEBUG |
Jeremy Fitzhardinge | 9c9b8b3 | 2006-09-25 23:32:26 -0700 | [diff] [blame] | 187 | |
| 188 | NOTES |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | } |