Ralf Baechle | dbee90b | 2006-02-02 14:31:16 +0000 | [diff] [blame] | 1 | #include <asm/asm-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | #include <asm-generic/vmlinux.lds.h> |
| 3 | |
Ralf Baechle | 41c594a | 2006-04-05 09:45:45 +0100 | [diff] [blame] | 4 | #undef mips |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #define mips mips |
| 6 | OUTPUT_ARCH(mips) |
| 7 | ENTRY(kernel_entry) |
Ralf Baechle | 603bb99 | 2007-10-14 22:49:01 +0100 | [diff] [blame] | 8 | PHDRS { |
| 9 | text PT_LOAD FLAGS(7); /* RWX */ |
| 10 | note PT_NOTE FLAGS(4); /* R__ */ |
| 11 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | jiffies = JIFFIES; |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | SECTIONS |
| 15 | { |
| 16 | #ifdef CONFIG_BOOT_ELF64 |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 17 | /* Read-only sections, merged into text segment: */ |
| 18 | /* . = 0xc000000000000000; */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 20 | /* This is the value for an Origin kernel, taken from an IRIX kernel. */ |
| 21 | /* . = 0xc00000000001c000; */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 23 | /* Set the vaddr for the text segment to a value |
| 24 | * >= 0xa800 0000 0001 9000 if no symmon is going to configured |
| 25 | * >= 0xa800 0000 0030 0000 otherwise |
| 26 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 28 | /* . = 0xa800000000300000; */ |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 29 | . = 0xffffffff80300000; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #endif |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 31 | . = LOADADDR; |
| 32 | /* read-only */ |
| 33 | _text = .; /* Text and read-only data */ |
| 34 | .text : { |
| 35 | TEXT_TEXT |
| 36 | SCHED_TEXT |
| 37 | LOCK_TEXT |
Ralf Baechle | f70fd1b | 2007-10-14 22:50:05 +0100 | [diff] [blame^] | 38 | KPROBES_TEXT |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 39 | *(.fixup) |
| 40 | *(.gnu.warning) |
Ralf Baechle | 603bb99 | 2007-10-14 22:49:01 +0100 | [diff] [blame] | 41 | } :text = 0 |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 42 | _etext = .; /* End of text section */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 44 | /* Exception table */ |
| 45 | . = ALIGN(16); |
| 46 | __ex_table : { |
| 47 | __start___ex_table = .; |
| 48 | *(__ex_table) |
| 49 | __stop___ex_table = .; |
| 50 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 52 | /* Exception table for data bus errors */ |
| 53 | __dbe_table : { |
| 54 | __start___dbe_table = .; |
| 55 | *(__dbe_table) |
| 56 | __stop___dbe_table = .; |
| 57 | } |
Ralf Baechle | 603bb99 | 2007-10-14 22:49:01 +0100 | [diff] [blame] | 58 | |
| 59 | NOTES :text :note |
| 60 | .dummy : { *(.dummy) } :text |
| 61 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 62 | RODATA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 64 | /* writeable */ |
| 65 | .data : { /* Data */ |
| 66 | . = . + DATAOFFSET; /* for CONFIG_MAPPED_KERNEL */ |
| 67 | /* |
| 68 | * This ALIGN is needed as a workaround for a bug a gcc bug upto 4.1 which |
| 69 | * limits the maximum alignment to at most 32kB and results in the following |
| 70 | * warning: |
| 71 | * |
| 72 | * CC arch/mips/kernel/init_task.o |
| 73 | * arch/mips/kernel/init_task.c:30: warning: alignment of ‘init_thread_union’ |
| 74 | * is greater than maximum object file alignment. Using 32768 |
| 75 | */ |
| 76 | . = ALIGN(_PAGE_SIZE); |
| 77 | *(.data.init_task) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 79 | DATA_DATA |
| 80 | CONSTRUCTORS |
| 81 | } |
| 82 | _gp = . + 0x8000; |
| 83 | .lit8 : { |
| 84 | *(.lit8) |
| 85 | } |
| 86 | .lit4 : { |
| 87 | *(.lit4) |
| 88 | } |
| 89 | /* We want the small data sections together, so single-instruction offsets |
| 90 | can access them all, and initialized data all before uninitialized, so |
| 91 | we can shorten the on-disk segment size. */ |
| 92 | .sdata : { |
| 93 | *(.sdata) |
| 94 | } |
Maciej W. Rozycki | 6f6b394 | 2007-10-01 13:24:04 +0100 | [diff] [blame] | 95 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 96 | . = ALIGN(_PAGE_SIZE); |
| 97 | .data_nosave : { |
| 98 | __nosave_begin = .; |
| 99 | *(.data.nosave) |
| 100 | } |
| 101 | . = ALIGN(_PAGE_SIZE); |
| 102 | __nosave_end = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 104 | . = ALIGN(32); |
| 105 | .data.cacheline_aligned : { |
| 106 | *(.data.cacheline_aligned) |
| 107 | } |
| 108 | _edata = .; /* End of data section */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 110 | /* will be freed after init */ |
| 111 | . = ALIGN(_PAGE_SIZE); /* Init code and data */ |
| 112 | __init_begin = .; |
| 113 | .init.text : { |
| 114 | _sinittext = .; |
| 115 | *(.init.text) |
| 116 | _einittext = .; |
| 117 | } |
| 118 | .init.data : { |
| 119 | *(.init.data) |
| 120 | } |
| 121 | . = ALIGN(16); |
| 122 | .init.setup : { |
| 123 | __setup_start = .; |
| 124 | *(.init.setup) |
| 125 | __setup_end = .; |
| 126 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 128 | .initcall.init : { |
| 129 | __initcall_start = .; |
| 130 | INITCALLS |
| 131 | __initcall_end = .; |
| 132 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 134 | .con_initcall.init : { |
| 135 | __con_initcall_start = .; |
| 136 | *(.con_initcall.init) |
| 137 | __con_initcall_end = .; |
| 138 | } |
| 139 | SECURITY_INIT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 141 | /* .exit.text is discarded at runtime, not link time, to deal with |
| 142 | * references from .rodata |
| 143 | */ |
| 144 | .exit.text : { |
| 145 | *(.exit.text) |
| 146 | } |
| 147 | .exit.data : { |
| 148 | *(.exit.data) |
| 149 | } |
Jean-Paul Saman | 67d3822 | 2007-02-10 01:44:44 -0800 | [diff] [blame] | 150 | #if defined(CONFIG_BLK_DEV_INITRD) |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 151 | . = ALIGN(_PAGE_SIZE); |
| 152 | .init.ramfs : { |
| 153 | __initramfs_start = .; |
| 154 | *(.init.ramfs) |
| 155 | __initramfs_end = .; |
| 156 | } |
Jean-Paul Saman | 67d3822 | 2007-02-10 01:44:44 -0800 | [diff] [blame] | 157 | #endif |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 158 | PERCPU(_PAGE_SIZE) |
| 159 | . = ALIGN(_PAGE_SIZE); |
| 160 | __init_end = .; |
| 161 | /* freed after init ends here */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 163 | __bss_start = .; /* BSS */ |
| 164 | .sbss : { |
| 165 | *(.sbss) |
| 166 | *(.scommon) |
| 167 | } |
| 168 | .bss : { |
| 169 | *(.bss) |
| 170 | *(COMMON) |
| 171 | } |
| 172 | __bss_stop = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 174 | _end = . ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 176 | /* Sections to be discarded */ |
| 177 | /DISCARD/ : { |
| 178 | *(.exitcall.exit) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 180 | /* ABI crap starts here */ |
| 181 | *(.MIPS.options) |
| 182 | *(.options) |
| 183 | *(.pdr) |
| 184 | *(.reginfo) |
| 185 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 187 | /* These mark the ABI of the kernel for debuggers. */ |
| 188 | .mdebug.abi32 : { |
| 189 | KEEP(*(.mdebug.abi32)) |
| 190 | } |
| 191 | .mdebug.abi64 : { |
| 192 | KEEP(*(.mdebug.abi64)) |
| 193 | } |
Daniel Jacobowitz | 6c76988 | 2007-08-03 11:43:01 -0400 | [diff] [blame] | 194 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 195 | /* This is the MIPS specific mdebug section. */ |
| 196 | .mdebug : { |
| 197 | *(.mdebug) |
| 198 | } |
Atsushi Nemoto | 78665aa | 2006-05-11 00:41:26 +0900 | [diff] [blame] | 199 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 200 | STABS_DEBUG |
| 201 | DWARF_DEBUG |
Atsushi Nemoto | 04b6b3b | 2006-05-10 15:36:04 +0900 | [diff] [blame] | 202 | |
Sam Ravnborg | 0f5c906 | 2007-09-15 23:35:53 +0200 | [diff] [blame] | 203 | /* These must appear regardless of . */ |
| 204 | .gptab.sdata : { |
| 205 | *(.gptab.data) |
| 206 | *(.gptab.sdata) |
| 207 | } |
| 208 | .gptab.sbss : { |
| 209 | *(.gptab.bss) |
| 210 | *(.gptab.sbss) |
| 211 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | } |