2 * arch/arm/kernel/vmlinux.lds.S
4 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 /* ld script to make ARM Linux kernel
20 * taken from the i386 version by Russell King
21 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
24 #include <asm-generic/vmlinux.lds.h>
25 #include <asm/cache.h>
26 #include <asm/thread_info.h>
27 #include <asm/memory.h>
32 VMLINUX_SYMBOL(__proc_info_begin) = .; \
34 VMLINUX_SYMBOL(__proc_info_end) = .;
38 VMLINUX_SYMBOL(__idmap_text_start) = .; \
40 VMLINUX_SYMBOL(__idmap_text_end) = .;
42 #ifdef CONFIG_HOTPLUG_CPU
43 #define ARM_CPU_DISCARD(x)
44 #define ARM_CPU_KEEP(x) x
46 #define ARM_CPU_DISCARD(x) x
47 #define ARM_CPU_KEEP(x)
50 #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
51 defined(CONFIG_GENERIC_BUG)
52 #define ARM_EXIT_KEEP(x) x
53 #define ARM_EXIT_DISCARD(x)
55 #define ARM_EXIT_KEEP(x)
56 #define ARM_EXIT_DISCARD(x) x
65 jiffies = jiffies_64 + 4;
71 * XXX: The linker does not define how output sections are
72 * assigned to input sections when there are multiple statements
73 * matching the same input section name. There is no documented
76 * unwind exit sections must be discarded before the rest of the
77 * unwind sections get included.
80 *(.ARM.exidx.exit.text)
81 *(.ARM.extab.exit.text)
82 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
83 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
84 ARM_EXIT_DISCARD(EXIT_TEXT)
85 ARM_EXIT_DISCARD(EXIT_DATA)
87 #ifndef CONFIG_HOTPLUG
88 *(.ARM.exidx.devexit.text)
89 *(.ARM.extab.devexit.text)
95 #ifndef CONFIG_SMP_ON_UP
102 #ifdef CONFIG_XIP_KERNEL
103 . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
105 . = PAGE_OFFSET + TEXT_OFFSET;
111 .text : { /* Real text segment */
112 _stext = .; /* Text and read-only data */
113 __exception_text_start = .;
115 __exception_text_end = .;
129 *(.got) /* Global offset table */
130 ARM_CPU_KEEP(PROC_INFO)
135 #ifdef CONFIG_ARM_UNWIND
137 * Stack unwinding tables
141 __start_unwind_idx = .;
143 __stop_unwind_idx = .;
146 __start_unwind_tab = .;
148 __stop_unwind_tab = .;
152 _etext = .; /* End of text and rodata section */
154 #ifndef CONFIG_XIP_KERNEL
155 . = ALIGN(PAGE_SIZE);
161 ARM_EXIT_KEEP(EXIT_TEXT)
164 ARM_CPU_DISCARD(PROC_INFO)
167 __arch_info_begin = .;
172 __tagtable_begin = .;
176 #ifdef CONFIG_SMP_ON_UP
184 __pv_table_begin = .;
189 #ifndef CONFIG_XIP_KERNEL
198 #ifndef CONFIG_XIP_KERNEL
200 ARM_EXIT_KEEP(EXIT_DATA)
204 PERCPU_SECTION(L1_CACHE_BYTES)
206 #ifdef CONFIG_XIP_KERNEL
207 __data_loc = ALIGN(4); /* location in binary */
208 . = PAGE_OFFSET + TEXT_OFFSET;
211 . = ALIGN(THREAD_SIZE);
215 .data : AT(__data_loc) {
216 _data = .; /* address in memory */
220 * first, the init task union, aligned
221 * to an 8192 byte boundary.
223 INIT_TASK_DATA(THREAD_SIZE)
225 #ifdef CONFIG_XIP_KERNEL
226 . = ALIGN(PAGE_SIZE);
229 ARM_EXIT_KEEP(EXIT_DATA)
230 . = ALIGN(PAGE_SIZE);
235 CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
236 READ_MOSTLY_DATA(L1_CACHE_BYTES)
239 * The exception fixup table (might need resorting at runtime)
242 __start___ex_table = .;
246 __stop___ex_table = .;
249 * and the usual data section
256 _edata_loc = __data_loc + SIZEOF(.data);
258 #ifdef CONFIG_HAVE_TCM
260 * We align everything to a page boundary so we can
261 * free it after init has commenced and TCM contents have
262 * been copied to its destination.
265 . = ALIGN(PAGE_SIZE);
271 * Link these to the ITCM RAM
272 * Put VMA to the TCM address and LMA to the common RAM
273 * and we'll upload the contents from RAM to TCM and free
274 * the used RAM after that.
276 .text_itcm ITCM_OFFSET : AT(__itcm_start)
286 * Reset the dot pointer, this is needed to create the
287 * relative __dtcm_start below (to be used as extern in code).
289 . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
295 /* TODO: add remainder of ITCM as well, that can be used for data! */
296 .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
305 /* Reset the dot pointer or the linker gets confused */
306 . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
308 /* End marker for freeing TCM copy in linked object */
309 .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
310 . = ALIGN(PAGE_SIZE);
321 .comment 0 : { *(.comment) }
325 * These must never be empty
326 * If you have to comment these two assert statements out, your
327 * binutils is too old (for other reasons as well)
329 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
330 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")