Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* ld script to make ARM Linux kernel |
| 2 | * taken from the i386 version by Russell King |
| 3 | * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> |
| 4 | */ |
| 5 | |
| 6 | #include <asm-generic/vmlinux.lds.h> |
Russell King | 4f7a181 | 2005-05-05 13:11:00 +0100 | [diff] [blame] | 7 | #include <asm/thread_info.h> |
Nicolas Pitre | 37d07b7 | 2005-10-29 21:44:56 +0100 | [diff] [blame] | 8 | #include <asm/memory.h> |
Linus Walleij | f6430a9 | 2009-06-24 23:38:56 +0100 | [diff] [blame] | 9 | #include <asm/page.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | |
| 11 | OUTPUT_ARCH(arm) |
| 12 | ENTRY(stext) |
Nicolas Pitre | 37d07b7 | 2005-10-29 21:44:56 +0100 | [diff] [blame] | 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #ifndef __ARMEB__ |
| 15 | jiffies = jiffies_64; |
| 16 | #else |
| 17 | jiffies = jiffies_64 + 4; |
| 18 | #endif |
Nicolas Pitre | 37d07b7 | 2005-10-29 21:44:56 +0100 | [diff] [blame] | 19 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | SECTIONS |
| 21 | { |
Russell King | 9d4f13e | 2006-01-03 17:28:33 +0000 | [diff] [blame] | 22 | #ifdef CONFIG_XIP_KERNEL |
| 23 | . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR); |
| 24 | #else |
| 25 | . = PAGE_OFFSET + TEXT_OFFSET; |
| 26 | #endif |
Russell King | 08fdffd | 2007-05-08 15:15:45 +0100 | [diff] [blame] | 27 | |
| 28 | .init : { /* Init code and data */ |
Tim Abbott | 2abc1c5 | 2009-10-02 16:32:46 -0400 | [diff] [blame] | 29 | _stext = .; |
| 30 | _sinittext = .; |
| 31 | HEAD_TEXT |
Sam Ravnborg | 01ba2bd | 2008-01-20 14:15:03 +0100 | [diff] [blame] | 32 | INIT_TEXT |
Russell King | 08fdffd | 2007-05-08 15:15:45 +0100 | [diff] [blame] | 33 | _einittext = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | __proc_info_begin = .; |
Ben Dooks | 02b7dd1 | 2005-09-20 16:35:03 +0100 | [diff] [blame] | 35 | *(.proc.info.init) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | __proc_info_end = .; |
| 37 | __arch_info_begin = .; |
Ben Dooks | 9d0fd1e | 2005-09-20 16:45:20 +0100 | [diff] [blame] | 38 | *(.arch.info.init) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | __arch_info_end = .; |
| 40 | __tagtable_begin = .; |
Ben Dooks | 9506057 | 2005-09-20 16:20:49 +0100 | [diff] [blame] | 41 | *(.taglist.init) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | __tagtable_end = .; |
Nelson Elhage | 78d7530 | 2009-10-02 16:32:47 -0400 | [diff] [blame] | 43 | |
| 44 | INIT_SETUP(16) |
| 45 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | __early_begin = .; |
Ben Dooks | bfe6815 | 2005-09-20 16:25:12 +0100 | [diff] [blame] | 47 | *(.early_param.init) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | __early_end = .; |
Nelson Elhage | 78d7530 | 2009-10-02 16:32:47 -0400 | [diff] [blame] | 49 | |
| 50 | INIT_CALLS |
| 51 | CON_INITCALL |
| 52 | SECURITY_INITCALL |
| 53 | INIT_RAM_FS |
| 54 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | #ifndef CONFIG_XIP_KERNEL |
| 56 | __init_begin = _stext; |
Sam Ravnborg | 01ba2bd | 2008-01-20 14:15:03 +0100 | [diff] [blame] | 57 | INIT_DATA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | #endif |
| 59 | } |
| 60 | |
Nelson Elhage | 78d7530 | 2009-10-02 16:32:47 -0400 | [diff] [blame] | 61 | PERCPU(PAGE_SIZE) |
| 62 | |
| 63 | #ifndef CONFIG_XIP_KERNEL |
| 64 | . = ALIGN(PAGE_SIZE); |
| 65 | __init_end = .; |
| 66 | #endif |
| 67 | |
Alan Jenkins | e3f28c1 | 2009-11-07 21:03:52 +0000 | [diff] [blame^] | 68 | /* |
| 69 | * unwind exit sections must be discarded before the rest of the |
| 70 | * unwind sections get included. |
| 71 | */ |
| 72 | /DISCARD/ : { |
Catalin Marinas | bff595c | 2009-02-16 11:41:36 +0100 | [diff] [blame] | 73 | *(.ARM.exidx.exit.text) |
| 74 | *(.ARM.extab.exit.text) |
Catalin Marinas | 7436127 | 2009-06-19 16:39:29 +0100 | [diff] [blame] | 75 | #ifndef CONFIG_HOTPLUG_CPU |
| 76 | *(.ARM.exidx.cpuexit.text) |
| 77 | *(.ARM.extab.cpuexit.text) |
| 78 | #endif |
| 79 | #ifndef CONFIG_HOTPLUG |
| 80 | *(.ARM.exidx.devexit.text) |
| 81 | *(.ARM.extab.devexit.text) |
| 82 | #endif |
Russell King | 9641c7c | 2006-06-21 20:38:17 +0100 | [diff] [blame] | 83 | #ifndef CONFIG_MMU |
| 84 | *(.fixup) |
| 85 | *(__ex_table) |
| 86 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | .text : { /* Real text segment */ |
| 90 | _text = .; /* Text and read-only data */ |
Russell King | 7ab3f8d | 2007-03-02 15:01:36 +0000 | [diff] [blame] | 91 | __exception_text_start = .; |
| 92 | *(.exception.text) |
| 93 | __exception_text_end = .; |
Sam Ravnborg | 7664709 | 2007-05-13 00:31:33 +0200 | [diff] [blame] | 94 | TEXT_TEXT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | SCHED_TEXT |
| 96 | LOCK_TEXT |
Nicolas Pitre | 785d3cd | 2007-12-03 15:27:56 -0500 | [diff] [blame] | 97 | KPROBES_TEXT |
Russell King | 9641c7c | 2006-06-21 20:38:17 +0100 | [diff] [blame] | 98 | #ifdef CONFIG_MMU |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | *(.fixup) |
Russell King | 9641c7c | 2006-06-21 20:38:17 +0100 | [diff] [blame] | 100 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | *(.gnu.warning) |
| 102 | *(.rodata) |
| 103 | *(.rodata.*) |
| 104 | *(.glue_7) |
| 105 | *(.glue_7t) |
| 106 | *(.got) /* Global offset table */ |
| 107 | } |
| 108 | |
Linus Walleij | f6430a9 | 2009-06-24 23:38:56 +0100 | [diff] [blame] | 109 | RO_DATA(PAGE_SIZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | |
| 111 | _etext = .; /* End of text and rodata section */ |
| 112 | |
Catalin Marinas | bff595c | 2009-02-16 11:41:36 +0100 | [diff] [blame] | 113 | #ifdef CONFIG_ARM_UNWIND |
| 114 | /* |
| 115 | * Stack unwinding tables |
| 116 | */ |
| 117 | . = ALIGN(8); |
| 118 | .ARM.unwind_idx : { |
| 119 | __start_unwind_idx = .; |
| 120 | *(.ARM.exidx*) |
| 121 | __stop_unwind_idx = .; |
| 122 | } |
| 123 | .ARM.unwind_tab : { |
| 124 | __start_unwind_tab = .; |
| 125 | *(.ARM.extab*) |
| 126 | __stop_unwind_tab = .; |
| 127 | } |
| 128 | #endif |
| 129 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | #ifdef CONFIG_XIP_KERNEL |
| 131 | __data_loc = ALIGN(4); /* location in binary */ |
Russell King | 9d4f13e | 2006-01-03 17:28:33 +0000 | [diff] [blame] | 132 | . = PAGE_OFFSET + TEXT_OFFSET; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | #else |
Russell King | 4f7a181 | 2005-05-05 13:11:00 +0100 | [diff] [blame] | 134 | . = ALIGN(THREAD_SIZE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | __data_loc = .; |
| 136 | #endif |
| 137 | |
| 138 | .data : AT(__data_loc) { |
Russell King | 37efe64 | 2008-12-01 11:53:07 +0000 | [diff] [blame] | 139 | _data = .; /* address in memory */ |
Catalin Marinas | 8c7e657 | 2009-05-30 14:00:17 +0100 | [diff] [blame] | 140 | _sdata = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | |
| 142 | /* |
| 143 | * first, the init task union, aligned |
| 144 | * to an 8192 byte boundary. |
| 145 | */ |
Nelson Elhage | 78d7530 | 2009-10-02 16:32:47 -0400 | [diff] [blame] | 146 | INIT_TASK_DATA(THREAD_SIZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
| 148 | #ifdef CONFIG_XIP_KERNEL |
Linus Walleij | f6430a9 | 2009-06-24 23:38:56 +0100 | [diff] [blame] | 149 | . = ALIGN(PAGE_SIZE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | __init_begin = .; |
Sam Ravnborg | 01ba2bd | 2008-01-20 14:15:03 +0100 | [diff] [blame] | 151 | INIT_DATA |
Linus Walleij | f6430a9 | 2009-06-24 23:38:56 +0100 | [diff] [blame] | 152 | . = ALIGN(PAGE_SIZE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | __init_end = .; |
| 154 | #endif |
| 155 | |
Nelson Elhage | 78d7530 | 2009-10-02 16:32:47 -0400 | [diff] [blame] | 156 | NOSAVE_DATA |
| 157 | CACHELINE_ALIGNED_DATA(32) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | |
| 159 | /* |
Nicolas Pitre | 13b1f64 | 2005-10-13 22:04:37 +0100 | [diff] [blame] | 160 | * The exception fixup table (might need resorting at runtime) |
| 161 | */ |
| 162 | . = ALIGN(32); |
| 163 | __start___ex_table = .; |
Russell King | 9641c7c | 2006-06-21 20:38:17 +0100 | [diff] [blame] | 164 | #ifdef CONFIG_MMU |
Nicolas Pitre | 13b1f64 | 2005-10-13 22:04:37 +0100 | [diff] [blame] | 165 | *(__ex_table) |
Russell King | 9641c7c | 2006-06-21 20:38:17 +0100 | [diff] [blame] | 166 | #endif |
Nicolas Pitre | 13b1f64 | 2005-10-13 22:04:37 +0100 | [diff] [blame] | 167 | __stop___ex_table = .; |
| 168 | |
| 169 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | * and the usual data section |
| 171 | */ |
Sam Ravnborg | ca96725 | 2007-05-17 13:38:44 +0200 | [diff] [blame] | 172 | DATA_DATA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | CONSTRUCTORS |
| 174 | |
| 175 | _edata = .; |
| 176 | } |
Nicolas Pitre | e98ff7f | 2007-02-22 16:18:09 +0100 | [diff] [blame] | 177 | _edata_loc = __data_loc + SIZEOF(.data); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | |
Linus Walleij | bc58177 | 2009-09-15 17:30:37 +0100 | [diff] [blame] | 179 | #ifdef CONFIG_HAVE_TCM |
| 180 | /* |
| 181 | * We align everything to a page boundary so we can |
| 182 | * free it after init has commenced and TCM contents have |
| 183 | * been copied to its destination. |
| 184 | */ |
| 185 | .tcm_start : { |
| 186 | . = ALIGN(PAGE_SIZE); |
| 187 | __tcm_start = .; |
| 188 | __itcm_start = .; |
| 189 | } |
| 190 | |
| 191 | /* |
| 192 | * Link these to the ITCM RAM |
| 193 | * Put VMA to the TCM address and LMA to the common RAM |
| 194 | * and we'll upload the contents from RAM to TCM and free |
| 195 | * the used RAM after that. |
| 196 | */ |
| 197 | .text_itcm ITCM_OFFSET : AT(__itcm_start) |
| 198 | { |
| 199 | __sitcm_text = .; |
| 200 | *(.tcm.text) |
| 201 | *(.tcm.rodata) |
| 202 | . = ALIGN(4); |
| 203 | __eitcm_text = .; |
| 204 | } |
| 205 | |
| 206 | /* |
| 207 | * Reset the dot pointer, this is needed to create the |
| 208 | * relative __dtcm_start below (to be used as extern in code). |
| 209 | */ |
| 210 | . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm); |
| 211 | |
| 212 | .dtcm_start : { |
| 213 | __dtcm_start = .; |
| 214 | } |
| 215 | |
| 216 | /* TODO: add remainder of ITCM as well, that can be used for data! */ |
| 217 | .data_dtcm DTCM_OFFSET : AT(__dtcm_start) |
| 218 | { |
| 219 | . = ALIGN(4); |
| 220 | __sdtcm_data = .; |
| 221 | *(.tcm.data) |
| 222 | . = ALIGN(4); |
| 223 | __edtcm_data = .; |
| 224 | } |
| 225 | |
| 226 | /* Reset the dot pointer or the linker gets confused */ |
| 227 | . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm); |
| 228 | |
| 229 | /* End marker for freeing TCM copy in linked object */ |
| 230 | .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){ |
| 231 | . = ALIGN(PAGE_SIZE); |
| 232 | __tcm_end = .; |
| 233 | } |
| 234 | #endif |
| 235 | |
Nelson Elhage | 78d7530 | 2009-10-02 16:32:47 -0400 | [diff] [blame] | 236 | BSS_SECTION(0, 0, 0) |
| 237 | _end = .; |
| 238 | |
| 239 | STABS_DEBUG |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | .comment 0 : { *(.comment) } |
Alan Jenkins | e3f28c1 | 2009-11-07 21:03:52 +0000 | [diff] [blame^] | 241 | |
| 242 | /* Default discards */ |
| 243 | DISCARDS |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | } |
| 245 | |
Russell King | 728f5c0 | 2005-11-17 16:43:14 +0000 | [diff] [blame] | 246 | /* |
| 247 | * These must never be empty |
| 248 | * If you have to comment these two assert statements out, your |
| 249 | * binutils is too old (for other reasons as well) |
| 250 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support") |
| 252 | ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined") |