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 #ifdef CONFIG_XIP_KERNEL
7 #include "vmlinux-xip.lds.S"
10 #include <asm-generic/vmlinux.lds.h>
11 #include <asm/cache.h>
12 #include <asm/thread_info.h>
13 #include <asm/memory.h>
15 #ifdef CONFIG_DEBUG_RODATA
16 #include <asm/pgtable.h>
21 VMLINUX_SYMBOL(__proc_info_begin) = .; \
23 VMLINUX_SYMBOL(__proc_info_end) = .;
27 VMLINUX_SYMBOL(__idmap_text_start) = .; \
29 VMLINUX_SYMBOL(__idmap_text_end) = .; \
30 . = ALIGN(PAGE_SIZE); \
31 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
33 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
35 #ifdef CONFIG_HOTPLUG_CPU
36 #define ARM_CPU_DISCARD(x)
37 #define ARM_CPU_KEEP(x) x
39 #define ARM_CPU_DISCARD(x) x
40 #define ARM_CPU_KEEP(x)
43 #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
44 defined(CONFIG_GENERIC_BUG)
45 #define ARM_EXIT_KEEP(x) x
46 #define ARM_EXIT_DISCARD(x)
48 #define ARM_EXIT_KEEP(x)
49 #define ARM_EXIT_DISCARD(x) x
58 jiffies = jiffies_64 + 4;
64 * XXX: The linker does not define how output sections are
65 * assigned to input sections when there are multiple statements
66 * matching the same input section name. There is no documented
69 * unwind exit sections must be discarded before the rest of the
70 * unwind sections get included.
73 *(.ARM.exidx.exit.text)
74 *(.ARM.extab.exit.text)
75 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
76 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
77 ARM_EXIT_DISCARD(EXIT_TEXT)
78 ARM_EXIT_DISCARD(EXIT_DATA)
84 #ifndef CONFIG_SMP_ON_UP
91 . = PAGE_OFFSET + TEXT_OFFSET;
97 #ifdef CONFIG_DEBUG_RODATA
98 . = ALIGN(1<<SECTION_SHIFT);
101 .text : { /* Real text segment */
102 _stext = .; /* Text and read-only data */
104 __exception_text_start = .;
106 __exception_text_end = .;
116 *(.got) /* Global offset table */
117 ARM_CPU_KEEP(PROC_INFO)
120 #ifdef CONFIG_DEBUG_ALIGN_RODATA
121 . = ALIGN(1<<SECTION_SHIFT);
126 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
127 __start___ex_table = .;
131 __stop___ex_table = .;
134 #ifdef CONFIG_ARM_UNWIND
136 * Stack unwinding tables
140 __start_unwind_idx = .;
142 __stop_unwind_idx = .;
145 __start_unwind_tab = .;
147 __stop_unwind_tab = .;
153 _etext = .; /* End of text and rodata section */
155 #ifdef CONFIG_DEBUG_RODATA
156 . = ALIGN(1<<SECTION_SHIFT);
158 . = ALIGN(PAGE_SIZE);
163 * The vectors and stubs are relocatable code, and the
164 * only thing that matters is their relative offsets
167 .vectors 0 : AT(__vectors_start) {
170 . = __vectors_start + SIZEOF(.vectors);
174 .stubs 0x1000 : AT(__stubs_start) {
177 . = __stubs_start + SIZEOF(.stubs);
182 ARM_EXIT_KEEP(EXIT_TEXT)
185 ARM_CPU_DISCARD(PROC_INFO)
188 __arch_info_begin = .;
193 __tagtable_begin = .;
197 #ifdef CONFIG_SMP_ON_UP
205 __pv_table_begin = .;
218 ARM_EXIT_KEEP(EXIT_DATA)
222 PERCPU_SECTION(L1_CACHE_BYTES)
225 #ifdef CONFIG_DEBUG_RODATA
226 . = ALIGN(1<<SECTION_SHIFT);
228 . = ALIGN(THREAD_SIZE);
233 .data : AT(__data_loc) {
234 _data = .; /* address in memory */
238 * first, the init task union, aligned
239 * to an 8192 byte boundary.
241 INIT_TASK_DATA(THREAD_SIZE)
244 CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
245 READ_MOSTLY_DATA(L1_CACHE_BYTES)
248 * and the usual data section
255 _edata_loc = __data_loc + SIZEOF(.data);
257 #ifdef CONFIG_HAVE_TCM
259 * We align everything to a page boundary so we can
260 * free it after init has commenced and TCM contents have
261 * been copied to its destination.
264 . = ALIGN(PAGE_SIZE);
270 * Link these to the ITCM RAM
271 * Put VMA to the TCM address and LMA to the common RAM
272 * and we'll upload the contents from RAM to TCM and free
273 * the used RAM after that.
275 .text_itcm ITCM_OFFSET : AT(__itcm_start)
285 * Reset the dot pointer, this is needed to create the
286 * relative __dtcm_start below (to be used as extern in code).
288 . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
294 /* TODO: add remainder of ITCM as well, that can be used for data! */
295 .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
304 /* Reset the dot pointer or the linker gets confused */
305 . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
307 /* End marker for freeing TCM copy in linked object */
308 .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
309 . = ALIGN(PAGE_SIZE);
321 * These must never be empty
322 * If you have to comment these two assert statements out, your
323 * binutils is too old (for other reasons as well)
325 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
326 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
329 * The HYP init code can't be more than a page long,
330 * and should not cross a page boundary.
331 * The above comment applies as well.
333 ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & PAGE_MASK) <= PAGE_SIZE,
334 "HYP init code too big or misaligned")
336 #endif /* CONFIG_XIP_KERNEL */