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>
6 #include <asm-generic/vmlinux.lds.h>
8 #include <asm/thread_info.h>
9 #include <asm/memory.h>
11 #ifdef CONFIG_ARM_KERNMEM_PERMS
12 #include <asm/pgtable.h>
17 VMLINUX_SYMBOL(__proc_info_begin) = .; \
19 VMLINUX_SYMBOL(__proc_info_end) = .;
23 VMLINUX_SYMBOL(__idmap_text_start) = .; \
25 VMLINUX_SYMBOL(__idmap_text_end) = .; \
27 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
29 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
31 #ifdef CONFIG_HOTPLUG_CPU
32 #define ARM_CPU_DISCARD(x)
33 #define ARM_CPU_KEEP(x) x
35 #define ARM_CPU_DISCARD(x) x
36 #define ARM_CPU_KEEP(x)
39 #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
40 defined(CONFIG_GENERIC_BUG)
41 #define ARM_EXIT_KEEP(x) x
42 #define ARM_EXIT_DISCARD(x)
44 #define ARM_EXIT_KEEP(x)
45 #define ARM_EXIT_DISCARD(x) x
54 jiffies = jiffies_64 + 4;
60 * XXX: The linker does not define how output sections are
61 * assigned to input sections when there are multiple statements
62 * matching the same input section name. There is no documented
65 * unwind exit sections must be discarded before the rest of the
66 * unwind sections get included.
69 *(.ARM.exidx.exit.text)
70 *(.ARM.extab.exit.text)
71 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
72 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
73 ARM_EXIT_DISCARD(EXIT_TEXT)
74 ARM_EXIT_DISCARD(EXIT_DATA)
80 #ifndef CONFIG_SMP_ON_UP
87 #ifdef CONFIG_XIP_KERNEL
88 . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
90 . = PAGE_OFFSET + TEXT_OFFSET;
97 #ifdef CONFIG_ARM_KERNMEM_PERMS
98 . = ALIGN(1<<SECTION_SHIFT);
101 .text : { /* Real text segment */
102 _stext = .; /* Text and read-only data */
103 __exception_text_start = .;
105 __exception_text_end = .;
119 *(.got) /* Global offset table */
120 ARM_CPU_KEEP(PROC_INFO)
123 #ifdef CONFIG_DEBUG_RODATA
124 . = ALIGN(1<<SECTION_SHIFT);
129 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
130 __start___ex_table = .;
134 __stop___ex_table = .;
137 #ifdef CONFIG_ARM_UNWIND
139 * Stack unwinding tables
143 __start_unwind_idx = .;
145 __stop_unwind_idx = .;
148 __start_unwind_tab = .;
150 __stop_unwind_tab = .;
156 _etext = .; /* End of text and rodata section */
158 #ifndef CONFIG_XIP_KERNEL
159 # ifdef CONFIG_ARM_KERNMEM_PERMS
160 . = ALIGN(1<<SECTION_SHIFT);
162 . = ALIGN(PAGE_SIZE);
167 * The vectors and stubs are relocatable code, and the
168 * only thing that matters is their relative offsets
171 .vectors 0 : AT(__vectors_start) {
174 . = __vectors_start + SIZEOF(.vectors);
178 .stubs 0x1000 : AT(__stubs_start) {
181 . = __stubs_start + SIZEOF(.stubs);
186 ARM_EXIT_KEEP(EXIT_TEXT)
189 ARM_CPU_DISCARD(PROC_INFO)
192 __arch_info_begin = .;
197 __tagtable_begin = .;
201 #ifdef CONFIG_SMP_ON_UP
209 __pv_table_begin = .;
214 #ifndef CONFIG_XIP_KERNEL
223 #ifndef CONFIG_XIP_KERNEL
225 ARM_EXIT_KEEP(EXIT_DATA)
230 PERCPU_SECTION(L1_CACHE_BYTES)
233 #ifdef CONFIG_XIP_KERNEL
234 __data_loc = ALIGN(4); /* location in binary */
235 . = PAGE_OFFSET + TEXT_OFFSET;
237 #ifdef CONFIG_ARM_KERNMEM_PERMS
238 . = ALIGN(1<<SECTION_SHIFT);
240 . = ALIGN(THREAD_SIZE);
246 .data : AT(__data_loc) {
247 _data = .; /* address in memory */
251 * first, the init task union, aligned
252 * to an 8192 byte boundary.
254 INIT_TASK_DATA(THREAD_SIZE)
256 #ifdef CONFIG_XIP_KERNEL
257 . = ALIGN(PAGE_SIZE);
260 ARM_EXIT_KEEP(EXIT_DATA)
261 . = ALIGN(PAGE_SIZE);
266 CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
267 READ_MOSTLY_DATA(L1_CACHE_BYTES)
270 * and the usual data section
277 _edata_loc = __data_loc + SIZEOF(.data);
279 #ifdef CONFIG_HAVE_TCM
281 * We align everything to a page boundary so we can
282 * free it after init has commenced and TCM contents have
283 * been copied to its destination.
286 . = ALIGN(PAGE_SIZE);
292 * Link these to the ITCM RAM
293 * Put VMA to the TCM address and LMA to the common RAM
294 * and we'll upload the contents from RAM to TCM and free
295 * the used RAM after that.
297 .text_itcm ITCM_OFFSET : AT(__itcm_start)
307 * Reset the dot pointer, this is needed to create the
308 * relative __dtcm_start below (to be used as extern in code).
310 . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
316 /* TODO: add remainder of ITCM as well, that can be used for data! */
317 .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
326 /* Reset the dot pointer or the linker gets confused */
327 . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
329 /* End marker for freeing TCM copy in linked object */
330 .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
331 . = ALIGN(PAGE_SIZE);
343 * These must never be empty
344 * If you have to comment these two assert statements out, your
345 * binutils is too old (for other reasons as well)
347 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
348 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
350 * The HYP init code can't be more than a page long.
351 * The above comment applies as well.
353 ASSERT(((__hyp_idmap_text_end - __hyp_idmap_text_start) <= PAGE_SIZE), "HYP init code too big")