1 /* ld script to make ARM Linux kernel
2 * taken from the i386 version by Russell King
6 #include <asm-generic/vmlinux.lds.h>
8 #include <asm/thread_info.h>
9 #include <asm/memory.h>
13 VMLINUX_SYMBOL(__proc_info_begin) = .; \
15 VMLINUX_SYMBOL(__proc_info_end) = .;
19 VMLINUX_SYMBOL(__idmap_text_start) = .; \
21 VMLINUX_SYMBOL(__idmap_text_end) = .;
23 #ifdef CONFIG_HOTPLUG_CPU
24 #define ARM_CPU_DISCARD(x)
25 #define ARM_CPU_KEEP(x) x
27 #define ARM_CPU_DISCARD(x) x
28 #define ARM_CPU_KEEP(x)
31 #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
32 defined(CONFIG_GENERIC_BUG)
33 #define ARM_EXIT_KEEP(x) x
34 #define ARM_EXIT_DISCARD(x)
36 #define ARM_EXIT_KEEP(x)
37 #define ARM_EXIT_DISCARD(x) x
46 jiffies = jiffies_64 + 4;
52 * XXX: The linker does not define how output sections are
53 * assigned to input sections when there are multiple statements
54 * matching the same input section name. There is no documented
57 * unwind exit sections must be discarded before the rest of the
58 * unwind sections get included.
61 *(.ARM.exidx.exit.text)
62 *(.ARM.extab.exit.text)
63 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
64 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
65 ARM_EXIT_DISCARD(EXIT_TEXT)
66 ARM_EXIT_DISCARD(EXIT_DATA)
68 #ifndef CONFIG_HOTPLUG
69 *(.ARM.exidx.devexit.text)
70 *(.ARM.extab.devexit.text)
76 #ifndef CONFIG_SMP_ON_UP
83 #ifdef CONFIG_XIP_KERNEL
84 . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
86 . = PAGE_OFFSET + TEXT_OFFSET;
92 .text : { /* Real text segment */
93 _stext = .; /* Text and read-only data */
94 __exception_text_start = .;
96 __exception_text_end = .;
110 *(.got) /* Global offset table */
111 ARM_CPU_KEEP(PROC_INFO)
116 #ifdef CONFIG_ARM_UNWIND
118 * Stack unwinding tables
122 __start_unwind_idx = .;
124 __stop_unwind_idx = .;
127 __start_unwind_tab = .;
129 __stop_unwind_tab = .;
133 _etext = .; /* End of text and rodata section */
135 #ifndef CONFIG_XIP_KERNEL
136 . = ALIGN(PAGE_SIZE);
142 ARM_EXIT_KEEP(EXIT_TEXT)
145 ARM_CPU_DISCARD(PROC_INFO)
148 __arch_info_begin = .;
153 __tagtable_begin = .;
157 #ifdef CONFIG_SMP_ON_UP
165 __pv_table_begin = .;
170 #ifndef CONFIG_XIP_KERNEL
179 #ifndef CONFIG_XIP_KERNEL
181 ARM_EXIT_KEEP(EXIT_DATA)
185 PERCPU_SECTION(L1_CACHE_BYTES)
187 #ifdef CONFIG_XIP_KERNEL
188 __data_loc = ALIGN(4); /* location in binary */
189 . = PAGE_OFFSET + TEXT_OFFSET;
192 . = ALIGN(THREAD_SIZE);
196 .data : AT(__data_loc) {
197 _data = .; /* address in memory */
201 * first, the init task union, aligned
202 * to an 8192 byte boundary.
204 INIT_TASK_DATA(THREAD_SIZE)
206 #ifdef CONFIG_XIP_KERNEL
207 . = ALIGN(PAGE_SIZE);
210 ARM_EXIT_KEEP(EXIT_DATA)
211 . = ALIGN(PAGE_SIZE);
216 CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
217 READ_MOSTLY_DATA(L1_CACHE_BYTES)
220 * The exception fixup table (might need resorting at runtime)
223 __start___ex_table = .;
227 __stop___ex_table = .;
230 * and the usual data section
237 _edata_loc = __data_loc + SIZEOF(.data);
239 #ifdef CONFIG_HAVE_TCM
241 * We align everything to a page boundary so we can
242 * free it after init has commenced and TCM contents have
243 * been copied to its destination.
246 . = ALIGN(PAGE_SIZE);
252 * Link these to the ITCM RAM
253 * Put VMA to the TCM address and LMA to the common RAM
254 * and we'll upload the contents from RAM to TCM and free
255 * the used RAM after that.
257 .text_itcm ITCM_OFFSET : AT(__itcm_start)
267 * Reset the dot pointer, this is needed to create the
268 * relative __dtcm_start below (to be used as extern in code).
270 . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
276 /* TODO: add remainder of ITCM as well, that can be used for data! */
277 .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
286 /* Reset the dot pointer or the linker gets confused */
287 . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
289 /* End marker for freeing TCM copy in linked object */
290 .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
291 . = ALIGN(PAGE_SIZE);
302 .comment 0 : { *(.comment) }
306 * These must never be empty
307 * If you have to comment these two assert statements out, your
308 * binutils is too old (for other reasons as well)
310 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
311 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")