1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <asm-generic/vmlinux.lds.h>
4 #ifdef CONFIG_HOTPLUG_CPU
5 #define ARM_CPU_DISCARD(x)
6 #define ARM_CPU_KEEP(x) x
8 #define ARM_CPU_DISCARD(x) x
9 #define ARM_CPU_KEEP(x)
12 #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
13 defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL)
14 #define ARM_EXIT_KEEP(x) x
15 #define ARM_EXIT_DISCARD(x)
17 #define ARM_EXIT_KEEP(x)
18 #define ARM_EXIT_DISCARD(x) x
22 #define ARM_MMU_KEEP(x) x
23 #define ARM_MMU_DISCARD(x)
25 #define ARM_MMU_KEEP(x)
26 #define ARM_MMU_DISCARD(x) x
30 * ld.lld does not support NOCROSSREFS:
31 * https://github.com/ClangBuiltLinux/linux/issues/1609
33 #ifdef CONFIG_LD_IS_LLD
37 /* Set start/end symbol names to the LMA for the section */
38 #define ARM_LMA(sym, section) \
39 sym##_start = LOADADDR(section); \
40 sym##_end = LOADADDR(section) + SIZEOF(section)
44 __proc_info_begin = .; \
45 KEEP(*(.proc.info.init)) \
50 __idmap_text_start = .; \
52 __idmap_text_end = .; \
55 *(.ARM.exidx.exit.text) \
56 *(.ARM.extab.exit.text) \
57 *(.ARM.exidx.text.exit) \
58 *(.ARM.extab.text.exit) \
59 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) \
60 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) \
61 ARM_EXIT_DISCARD(EXIT_TEXT) \
62 ARM_EXIT_DISCARD(EXIT_DATA) \
64 ARM_MMU_DISCARD(*(.text.fixup)) \
65 ARM_MMU_DISCARD(*(__ex_table)) \
69 * Sections that should stay zero sized, which is safer to explicitly
70 * check instead of blindly discarding.
74 *(.iplt) *(.rel.iplt) *(.iplt) *(.igot.plt) \
76 ASSERT(SIZEOF(.plt) == 0, \
77 "Unexpected run-time procedure linkages detected!")
81 .ARM.attributes 0 : { *(.ARM.attributes) }
83 #define ARM_STUBS_TEXT \
92 __entry_text_start = .; \
94 __entry_text_end = .; \
103 *(.got) /* Global offset table */ \
104 ARM_CPU_KEEP(PROC_INFO)
106 /* Stack unwinding tables */
107 #define ARM_UNWIND_SECTIONS \
109 .ARM.unwind_idx : { \
110 __start_unwind_idx = .; \
112 __stop_unwind_idx = .; \
114 .ARM.unwind_tab : { \
115 __start_unwind_tab = .; \
117 __stop_unwind_tab = .; \
121 * The vectors and stubs are relocatable code, and the
122 * only thing that matters is their relative offsets
124 #define ARM_VECTORS \
126 OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { \
130 .vectors.bhb.loop8 { \
131 *(.vectors.bhb.loop8) \
133 .vectors.bhb.bpiall { \
134 *(.vectors.bhb.bpiall) \
137 ARM_LMA(__vectors, .vectors); \
138 ARM_LMA(__vectors_bhb_loop8, .vectors.bhb.loop8); \
139 ARM_LMA(__vectors_bhb_bpiall, .vectors.bhb.bpiall); \
140 . = __vectors_lma + SIZEOF(.vectors) + \
141 SIZEOF(.vectors.bhb.loop8) + \
142 SIZEOF(.vectors.bhb.bpiall); \
145 .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { \
148 ARM_LMA(__stubs, .stubs); \
149 . = __stubs_lma + SIZEOF(.stubs); \
151 PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors));
154 __itcm_start = ALIGN(4); \
155 .text_itcm ITCM_OFFSET : AT(__itcm_start - LOAD_OFFSET) { \
162 . = __itcm_start + SIZEOF(.text_itcm); \
165 .data_dtcm DTCM_OFFSET : AT(__dtcm_start - LOAD_OFFSET) { \
171 . = __dtcm_start + SIZEOF(.data_dtcm);