1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* ld script to make ARM Linux kernel
3 * taken from the i386 version by Russell King
4 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
7 #ifdef CONFIG_XIP_KERNEL
8 #include "vmlinux-xip.lds.S"
11 #include <linux/pgtable.h>
12 #include <asm/vmlinux.lds.h>
13 #include <asm/cache.h>
14 #include <asm/thread_info.h>
24 jiffies = jiffies_64 + 4;
30 * XXX: The linker does not define how output sections are
31 * assigned to input sections when there are multiple statements
32 * matching the same input section name. There is no documented
35 * unwind exit sections must be discarded before the rest of the
36 * unwind sections get included.
40 #ifndef CONFIG_SMP_ON_UP
43 #ifndef CONFIG_ARM_UNWIND
44 *(.ARM.exidx) *(.ARM.exidx.*)
45 *(.ARM.extab) *(.ARM.extab.*)
49 . = KERNEL_OFFSET + TEXT_OFFSET;
55 #ifdef CONFIG_STRICT_KERNEL_RWX
56 . = ALIGN(1<<SECTION_SHIFT);
60 . = ALIGN(PMSAv8_MINALIGN);
62 .text : { /* Real text segment */
63 _stext = .; /* Text and read-only data */
67 #ifdef CONFIG_DEBUG_ALIGN_RODATA
68 . = ALIGN(1<<SECTION_SHIFT);
70 _etext = .; /* End of text section */
75 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
76 __start___ex_table = .;
77 ARM_MMU_KEEP(KEEP(*(__ex_table)))
78 __stop___ex_table = .;
81 #ifdef CONFIG_ARM_UNWIND
85 #ifdef CONFIG_STRICT_KERNEL_RWX
86 . = ALIGN(1<<SECTION_SHIFT);
95 ARM_EXIT_KEEP(EXIT_TEXT)
98 ARM_CPU_DISCARD(PROC_INFO)
101 __arch_info_begin = .;
102 KEEP(*(.arch.info.init))
106 __tagtable_begin = .;
110 #ifdef CONFIG_SMP_ON_UP
118 __pv_table_begin = .;
123 INIT_DATA_SECTION(16)
126 ARM_EXIT_KEEP(EXIT_DATA)
130 PERCPU_SECTION(L1_CACHE_BYTES)
133 #ifdef CONFIG_HAVE_TCM
137 #ifdef CONFIG_STRICT_KERNEL_RWX
138 . = ALIGN(1<<SECTION_SHIFT);
140 . = ALIGN(THREAD_ALIGN);
145 RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN)
149 #ifdef CONFIG_ARM_MPU
150 . = ALIGN(PMSAv8_MINALIGN);
161 #ifdef CONFIG_STRICT_KERNEL_RWX
163 * Without CONFIG_DEBUG_ALIGN_RODATA, __start_rodata_section_aligned will
164 * be the first section-aligned location after __start_rodata. Otherwise,
165 * it will be equal to __start_rodata.
167 __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT);
171 * These must never be empty
172 * If you have to comment these two assert statements out, your
173 * binutils is too old (for other reasons as well)
175 ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
176 #ifndef CONFIG_COMPILE_TEST
177 ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
180 #endif /* CONFIG_XIP_KERNEL */