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