Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
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> | |
5 | */ | |
6 | ||
538bf469 CB |
7 | #ifdef CONFIG_XIP_KERNEL |
8 | #include "vmlinux-xip.lds.S" | |
9 | #else | |
10 | ||
65fddcfc | 11 | #include <linux/pgtable.h> |
d7e3b065 | 12 | #include <asm/vmlinux.lds.h> |
f0d5375e | 13 | #include <asm/cache.h> |
4f7a1812 | 14 | #include <asm/thread_info.h> |
f6430a93 | 15 | #include <asm/page.h> |
a9ff6961 | 16 | #include <asm/mpu.h> |
e60a1fec | 17 | |
1da177e4 LT |
18 | OUTPUT_ARCH(arm) |
19 | ENTRY(stext) | |
37d07b72 | 20 | |
1da177e4 LT |
21 | #ifndef __ARMEB__ |
22 | jiffies = jiffies_64; | |
23 | #else | |
24 | jiffies = jiffies_64 + 4; | |
25 | #endif | |
37d07b72 | 26 | |
9d4f13e5 RK |
27 | SECTIONS |
28 | { | |
39df8887 | 29 | /* |
6760b109 RK |
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 | |
33 | * order of matching. | |
34 | * | |
39df8887 RK |
35 | * unwind exit sections must be discarded before the rest of the |
36 | * unwind sections get included. | |
37 | */ | |
38 | /DISCARD/ : { | |
ab42fad0 | 39 | ARM_DISCARD |
39df8887 RK |
40 | #ifndef CONFIG_SMP_ON_UP |
41 | *(.alt.smp.init) | |
c39866f2 NC |
42 | #endif |
43 | #ifndef CONFIG_ARM_UNWIND | |
44 | *(.ARM.exidx) *(.ARM.exidx.*) | |
45 | *(.ARM.extab) *(.ARM.extab.*) | |
39df8887 RK |
46 | #endif |
47 | } | |
48 | ||
b78f63f4 | 49 | . = KERNEL_OFFSET + TEXT_OFFSET; |
1604d79d | 50 | .head.text : { |
e2f81844 | 51 | _text = .; |
1604d79d RK |
52 | HEAD_TEXT |
53 | } | |
1e6b4811 | 54 | |
0f5bf6d0 | 55 | #ifdef CONFIG_STRICT_KERNEL_RWX |
1e6b4811 KC |
56 | . = ALIGN(1<<SECTION_SHIFT); |
57 | #endif | |
58 | ||
046835b4 VM |
59 | #ifdef CONFIG_ARM_MPU |
60 | . = ALIGN(PMSAv8_MINALIGN); | |
61 | #endif | |
3835d69a | 62 | .text : { /* Real text segment */ |
e2f81844 | 63 | _stext = .; /* Text and read-only data */ |
47b4c77d | 64 | ARM_TEXT |
3835d69a RK |
65 | } |
66 | ||
25362dc4 | 67 | #ifdef CONFIG_DEBUG_ALIGN_RODATA |
80d6b0c2 KC |
68 | . = ALIGN(1<<SECTION_SHIFT); |
69 | #endif | |
14c4a533 KC |
70 | _etext = .; /* End of text section */ |
71 | ||
3835d69a RK |
72 | RO_DATA(PAGE_SIZE) |
73 | ||
ee951c63 SB |
74 | . = ALIGN(4); |
75 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { | |
76 | __start___ex_table = .; | |
ab42fad0 | 77 | ARM_MMU_KEEP(*(__ex_table)) |
ee951c63 SB |
78 | __stop___ex_table = .; |
79 | } | |
80 | ||
3835d69a | 81 | #ifdef CONFIG_ARM_UNWIND |
d9a46e6e | 82 | ARM_UNWIND_SECTIONS |
3835d69a RK |
83 | #endif |
84 | ||
0f5bf6d0 | 85 | #ifdef CONFIG_STRICT_KERNEL_RWX |
1e6b4811 | 86 | . = ALIGN(1<<SECTION_SHIFT); |
538bf469 | 87 | #else |
3835d69a | 88 | . = ALIGN(PAGE_SIZE); |
3835d69a | 89 | #endif |
538bf469 CB |
90 | __init_begin = .; |
91 | ||
91470958 | 92 | ARM_VECTORS |
1604d79d RK |
93 | INIT_TEXT_SECTION(8) |
94 | .exit.text : { | |
95 | ARM_EXIT_KEEP(EXIT_TEXT) | |
96 | } | |
97 | .init.proc.info : { | |
5085f3ff | 98 | ARM_CPU_DISCARD(PROC_INFO) |
1604d79d RK |
99 | } |
100 | .init.arch.info : { | |
1da177e4 | 101 | __arch_info_begin = .; |
1604d79d | 102 | *(.arch.info.init) |
1da177e4 | 103 | __arch_info_end = .; |
1604d79d RK |
104 | } |
105 | .init.tagtable : { | |
1da177e4 | 106 | __tagtable_begin = .; |
1604d79d | 107 | *(.taglist.init) |
1da177e4 | 108 | __tagtable_end = .; |
1604d79d | 109 | } |
f00ec48f | 110 | #ifdef CONFIG_SMP_ON_UP |
1604d79d | 111 | .init.smpalt : { |
f00ec48f | 112 | __smpalt_begin = .; |
1604d79d | 113 | *(.alt.smp.init) |
f00ec48f | 114 | __smpalt_end = .; |
1604d79d | 115 | } |
f00ec48f | 116 | #endif |
1604d79d | 117 | .init.pv_table : { |
dc21af99 | 118 | __pv_table_begin = .; |
1604d79d | 119 | *(.pv_table) |
dc21af99 | 120 | __pv_table_end = .; |
1604d79d | 121 | } |
861e37da NP |
122 | |
123 | INIT_DATA_SECTION(16) | |
124 | ||
1604d79d | 125 | .exit.data : { |
a9ad21fe | 126 | ARM_EXIT_KEEP(EXIT_DATA) |
1da177e4 LT |
127 | } |
128 | ||
9973290c | 129 | #ifdef CONFIG_SMP |
f0d5375e | 130 | PERCPU_SECTION(L1_CACHE_BYTES) |
9973290c | 131 | #endif |
78d7530a | 132 | |
b54290e5 NP |
133 | #ifdef CONFIG_HAVE_TCM |
134 | ARM_TCM | |
135 | #endif | |
136 | ||
0f5bf6d0 | 137 | #ifdef CONFIG_STRICT_KERNEL_RWX |
1e6b4811 | 138 | . = ALIGN(1<<SECTION_SHIFT); |
1da177e4 | 139 | #else |
a1c510d0 | 140 | . = ALIGN(THREAD_ALIGN); |
1e6b4811 | 141 | #endif |
562c85ca | 142 | __init_end = .; |
1da177e4 | 143 | |
861e37da | 144 | _sdata = .; |
a1c510d0 | 145 | RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN) |
861e37da | 146 | _edata = .; |
b5effd38 | 147 | |
78d7530a | 148 | BSS_SECTION(0, 0, 0) |
046835b4 VM |
149 | #ifdef CONFIG_ARM_MPU |
150 | . = ALIGN(PMSAv8_MINALIGN); | |
151 | #endif | |
78d7530a NE |
152 | _end = .; |
153 | ||
154 | STABS_DEBUG | |
512dd2ee | 155 | DWARF_DEBUG |
3b14aefb | 156 | ARM_DETAILS |
0c918e75 KC |
157 | |
158 | ARM_ASSERTS | |
1da177e4 LT |
159 | } |
160 | ||
0f5bf6d0 | 161 | #ifdef CONFIG_STRICT_KERNEL_RWX |
64ac2e74 KC |
162 | /* |
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. | |
166 | */ | |
167 | __start_rodata_section_aligned = ALIGN(__start_rodata, 1 << SECTION_SHIFT); | |
91c617d7 | 168 | #endif |
64ac2e74 | 169 | |
728f5c07 RK |
170 | /* |
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) | |
174 | */ | |
1da177e4 | 175 | ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support") |
336fe1d6 | 176 | #ifndef CONFIG_COMPILE_TEST |
1da177e4 | 177 | ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined") |
336fe1d6 | 178 | #endif |
06f75a1f | 179 | |
538bf469 | 180 | #endif /* CONFIG_XIP_KERNEL */ |