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> |
| 10 | |
| 11 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") |
| 12 | OUTPUT_ARCH(i386) |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 13 | ENTRY(phys_startup_32) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | jiffies = jiffies_64; |
| 15 | SECTIONS |
| 16 | { |
Eric W. Biederman | 3d345e3 | 2005-06-25 14:57:49 -0700 | [diff] [blame] | 17 | . = __KERNEL_START; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 18 | phys_startup_32 = startup_32 - LOAD_OFFSET; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | /* read-only */ |
| 20 | _text = .; /* Text and read-only data */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 21 | .text : AT(ADDR(.text) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | *(.text) |
| 23 | SCHED_TEXT |
| 24 | LOCK_TEXT |
Prasanna S Panchamukhi | 3d97ae5 | 2005-09-06 15:19:27 -0700 | [diff] [blame] | 25 | KPROBES_TEXT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | *(.fixup) |
| 27 | *(.gnu.warning) |
| 28 | } = 0x9090 |
| 29 | |
| 30 | _etext = .; /* End of text section */ |
| 31 | |
| 32 | . = ALIGN(16); /* Exception table */ |
| 33 | __start___ex_table = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 34 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | __stop___ex_table = .; |
| 36 | |
| 37 | RODATA |
| 38 | |
| 39 | /* writeable */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 40 | .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | *(.data) |
| 42 | CONSTRUCTORS |
| 43 | } |
| 44 | |
| 45 | . = ALIGN(4096); |
| 46 | __nosave_begin = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 47 | .data_nosave : AT(ADDR(.data_nosave) - LOAD_OFFSET) { *(.data.nosave) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | . = ALIGN(4096); |
| 49 | __nosave_end = .; |
| 50 | |
| 51 | . = ALIGN(4096); |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 52 | .data.page_aligned : AT(ADDR(.data.page_aligned) - LOAD_OFFSET) { |
| 53 | *(.data.idt) |
| 54 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | . = ALIGN(32); |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 57 | .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { |
| 58 | *(.data.cacheline_aligned) |
| 59 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Christoph Lameter | 6c03652 | 2005-07-07 17:56:59 -0700 | [diff] [blame] | 61 | /* rarely changed data like cpu maps */ |
| 62 | . = ALIGN(32); |
| 63 | .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] | 64 | _edata = .; /* End of data section */ |
| 65 | |
| 66 | . = ALIGN(THREAD_SIZE); /* init_task */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 67 | .data.init_task : AT(ADDR(.data.init_task) - LOAD_OFFSET) { |
| 68 | *(.data.init_task) |
| 69 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
| 71 | /* will be freed after init */ |
| 72 | . = ALIGN(4096); /* Init code and data */ |
| 73 | __init_begin = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 74 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | _sinittext = .; |
| 76 | *(.init.text) |
| 77 | _einittext = .; |
| 78 | } |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 79 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { *(.init.data) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | . = ALIGN(16); |
| 81 | __setup_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 82 | .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { *(.init.setup) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | __setup_end = .; |
| 84 | __initcall_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 85 | .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | *(.initcall1.init) |
| 87 | *(.initcall2.init) |
| 88 | *(.initcall3.init) |
| 89 | *(.initcall4.init) |
| 90 | *(.initcall5.init) |
| 91 | *(.initcall6.init) |
| 92 | *(.initcall7.init) |
| 93 | } |
| 94 | __initcall_end = .; |
| 95 | __con_initcall_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 96 | .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
| 97 | *(.con_initcall.init) |
| 98 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | __con_initcall_end = .; |
| 100 | SECURITY_INIT |
| 101 | . = ALIGN(4); |
| 102 | __alt_instructions = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 103 | .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) { |
| 104 | *(.altinstructions) |
| 105 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | __alt_instructions_end = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 107 | .altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) { |
| 108 | *(.altinstr_replacement) |
| 109 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | /* .exit.text is discard at runtime, not link time, to deal with references |
| 111 | from .altinstructions and .eh_frame */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 112 | .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) { *(.exit.text) } |
| 113 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { *(.exit.data) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | . = ALIGN(4096); |
| 115 | __initramfs_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 116 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { *(.init.ramfs) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | __initramfs_end = .; |
| 118 | . = ALIGN(32); |
| 119 | __per_cpu_start = .; |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 120 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | __per_cpu_end = .; |
| 122 | . = ALIGN(4096); |
| 123 | __init_end = .; |
| 124 | /* freed after init ends here */ |
| 125 | |
| 126 | __bss_start = .; /* BSS */ |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 127 | .bss.page_aligned : AT(ADDR(.bss.page_aligned) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | *(.bss.page_aligned) |
Eric W. Biederman | ad0d75e | 2005-06-25 14:57:47 -0700 | [diff] [blame] | 129 | } |
| 130 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 131 | *(.bss) |
| 132 | } |
| 133 | . = ALIGN(4); |
| 134 | __bss_stop = .; |
| 135 | |
| 136 | _end = . ; |
| 137 | |
| 138 | /* This is where the kernel creates the early boot page tables */ |
| 139 | . = ALIGN(4096); |
| 140 | pg0 = .; |
| 141 | |
| 142 | /* Sections to be discarded */ |
| 143 | /DISCARD/ : { |
| 144 | *(.exitcall.exit) |
| 145 | } |
| 146 | |
Paolo 'Blaisorblade' Giarrusso | a7d0c21 | 2005-09-10 19:44:54 +0200 | [diff] [blame^] | 147 | STABS_DEBUG |
| 148 | |
| 149 | DWARF_DEBUG |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | } |