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) = .;
21 #define HYPERVISOR_TEXT \
22 VMLINUX_SYMBOL(__hyp_text_start) = .; \
24 VMLINUX_SYMBOL(__hyp_text_end) = .;
28 VMLINUX_SYMBOL(__idmap_text_start) = .; \
30 VMLINUX_SYMBOL(__idmap_text_end) = .; \
31 . = ALIGN(PAGE_SIZE); \
32 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
34 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .;
36 #ifdef CONFIG_HOTPLUG_CPU
37 #define ARM_CPU_DISCARD(x)
38 #define ARM_CPU_KEEP(x) x
40 #define ARM_CPU_DISCARD(x) x
41 #define ARM_CPU_KEEP(x)
44 #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
45 defined(CONFIG_GENERIC_BUG)
46 #define ARM_EXIT_KEEP(x) x
47 #define ARM_EXIT_DISCARD(x)
49 #define ARM_EXIT_KEEP(x)
50 #define ARM_EXIT_DISCARD(x) x
59 jiffies = jiffies_64 + 4;
65 * XXX: The linker does not define how output sections are
66 * assigned to input sections when there are multiple statements
67 * matching the same input section name. There is no documented
70 * unwind exit sections must be discarded before the rest of the
71 * unwind sections get included.
74 *(.ARM.exidx.exit.text)
75 *(.ARM.extab.exit.text)
76 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
77 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
78 ARM_EXIT_DISCARD(EXIT_TEXT)
79 ARM_EXIT_DISCARD(EXIT_DATA)
85 #ifndef CONFIG_SMP_ON_UP
92 #ifdef CONFIG_XIP_KERNEL
93 . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
95 . = PAGE_OFFSET + TEXT_OFFSET;
102 #ifdef CONFIG_ARM_KERNMEM_PERMS
103 . = ALIGN(1<<SECTION_SHIFT);
106 .text : { /* Real text segment */
107 _stext = .; /* Text and read-only data */
109 __exception_text_start = .;
111 __exception_text_end = .;
122 *(.got) /* Global offset table */
123 ARM_CPU_KEEP(PROC_INFO)
126 #ifdef CONFIG_DEBUG_RODATA
127 . = ALIGN(1<<SECTION_SHIFT);
132 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
133 __start___ex_table = .;
137 __stop___ex_table = .;
140 #ifdef CONFIG_ARM_UNWIND
142 * Stack unwinding tables
146 __start_unwind_idx = .;
148 __stop_unwind_idx = .;
151 __start_unwind_tab = .;
153 __stop_unwind_tab = .;
159 _etext = .; /* End of text and rodata section */
161 #ifndef CONFIG_XIP_KERNEL
162 # ifdef CONFIG_ARM_KERNMEM_PERMS
163 . = ALIGN(1<<SECTION_SHIFT);
165 . = ALIGN(PAGE_SIZE);
170 * The vectors and stubs are relocatable code, and the
171 * only thing that matters is their relative offsets
174 .vectors 0 : AT(__vectors_start) {
177 . = __vectors_start + SIZEOF(.vectors);
181 .stubs 0x1000 : AT(__stubs_start) {
184 . = __stubs_start + SIZEOF(.stubs);
189 ARM_EXIT_KEEP(EXIT_TEXT)
192 ARM_CPU_DISCARD(PROC_INFO)
195 __arch_info_begin = .;
200 __tagtable_begin = .;
204 #ifdef CONFIG_SMP_ON_UP
212 __pv_table_begin = .;
217 #ifndef CONFIG_XIP_KERNEL
226 #ifndef CONFIG_XIP_KERNEL
228 ARM_EXIT_KEEP(EXIT_DATA)
233 PERCPU_SECTION(L1_CACHE_BYTES)
236 #ifdef CONFIG_XIP_KERNEL
237 __data_loc = ALIGN(4); /* location in binary */
238 . = PAGE_OFFSET + TEXT_OFFSET;
240 #ifdef CONFIG_ARM_KERNMEM_PERMS
241 . = ALIGN(1<<SECTION_SHIFT);
243 . = ALIGN(THREAD_SIZE);
249 .data : AT(__data_loc) {
250 _data = .; /* address in memory */
254 * first, the init task union, aligned
255 * to an 8192 byte boundary.
257 INIT_TASK_DATA(THREAD_SIZE)
259 #ifdef CONFIG_XIP_KERNEL
260 . = ALIGN(PAGE_SIZE);
263 ARM_EXIT_KEEP(EXIT_DATA)
264 . = ALIGN(PAGE_SIZE);
269 CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
270 READ_MOSTLY_DATA(L1_CACHE_BYTES)
273 * and the usual data section
280 _edata_loc = __data_loc + SIZEOF(.data);
282 #ifdef CONFIG_HAVE_TCM
284 * We align everything to a page boundary so we can
285 * free it after init has commenced and TCM contents have
286 * been copied to its destination.
289 . = ALIGN(PAGE_SIZE);
295 * Link these to the ITCM RAM
296 * Put VMA to the TCM address and LMA to the common RAM
297 * and we'll upload the contents from RAM to TCM and free
298 * the used RAM after that.
300 .text_itcm ITCM_OFFSET : AT(__itcm_start)
310 * Reset the dot pointer, this is needed to create the
311 * relative __dtcm_start below (to be used as extern in code).
313 . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
319 /* TODO: add remainder of ITCM as well, that can be used for data! */
320 .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
329 /* Reset the dot pointer or the linker gets confused */
330 . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
332 /* End marker for freeing TCM copy in linked object */
333 .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
334 . = ALIGN(PAGE_SIZE);
346 * These must never be empty
347 * If you have to comment these two assert statements out, your
348 * binutils is too old (for other reasons as well)
350 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
351 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
354 * The HYP init code can't be more than a page long,
355 * and should not cross a page boundary.
356 * The above comment applies as well.
358 ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & PAGE_MASK) <= PAGE_SIZE,
359 "HYP init code too big or misaligned")