xref: /linux/arch/arm/include/asm/vmlinux.lds.h (revision 0d3b051adbb72ed81956447d0d1e54d5943ee6f5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #include <asm-generic/vmlinux.lds.h>
3 
4 #ifdef CONFIG_HOTPLUG_CPU
5 #define ARM_CPU_DISCARD(x)
6 #define ARM_CPU_KEEP(x)		x
7 #else
8 #define ARM_CPU_DISCARD(x)	x
9 #define ARM_CPU_KEEP(x)
10 #endif
11 
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)
16 #else
17 #define ARM_EXIT_KEEP(x)
18 #define ARM_EXIT_DISCARD(x)	x
19 #endif
20 
21 #ifdef CONFIG_MMU
22 #define ARM_MMU_KEEP(x)		x
23 #define ARM_MMU_DISCARD(x)
24 #else
25 #define ARM_MMU_KEEP(x)
26 #define ARM_MMU_DISCARD(x)	x
27 #endif
28 
29 #define PROC_INFO							\
30 		. = ALIGN(4);						\
31 		__proc_info_begin = .;					\
32 		*(.proc.info.init)					\
33 		__proc_info_end = .;
34 
35 #define IDMAP_TEXT							\
36 		ALIGN_FUNCTION();					\
37 		__idmap_text_start = .;					\
38 		*(.idmap.text)						\
39 		__idmap_text_end = .;					\
40 
41 #define ARM_DISCARD							\
42 		*(.ARM.exidx.exit.text)					\
43 		*(.ARM.extab.exit.text)					\
44 		*(.ARM.exidx.text.exit)					\
45 		*(.ARM.extab.text.exit)					\
46 		ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))		\
47 		ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))		\
48 		ARM_EXIT_DISCARD(EXIT_TEXT)				\
49 		ARM_EXIT_DISCARD(EXIT_DATA)				\
50 		EXIT_CALL						\
51 		ARM_MMU_DISCARD(*(.text.fixup))				\
52 		ARM_MMU_DISCARD(*(__ex_table))				\
53 		COMMON_DISCARDS
54 
55 /*
56  * Sections that should stay zero sized, which is safer to explicitly
57  * check instead of blindly discarding.
58  */
59 #define ARM_ASSERTS							\
60 	.plt : {							\
61 		*(.iplt) *(.rel.iplt) *(.iplt) *(.igot.plt)		\
62 	}								\
63 	ASSERT(SIZEOF(.plt) == 0,					\
64 	       "Unexpected run-time procedure linkages detected!")
65 
66 #define ARM_DETAILS							\
67 		ELF_DETAILS						\
68 		.ARM.attributes 0 : { *(.ARM.attributes) }
69 
70 #define ARM_STUBS_TEXT							\
71 		*(.gnu.warning)						\
72 		*(.glue_7)						\
73 		*(.glue_7t)						\
74 		*(.vfp11_veneer)                                        \
75 		*(.v4_bx)
76 
77 #define ARM_TEXT							\
78 		IDMAP_TEXT						\
79 		__entry_text_start = .;					\
80 		*(.entry.text)						\
81 		__entry_text_end = .;					\
82 		IRQENTRY_TEXT						\
83 		SOFTIRQENTRY_TEXT					\
84 		TEXT_TEXT						\
85 		SCHED_TEXT						\
86 		CPUIDLE_TEXT						\
87 		LOCK_TEXT						\
88 		KPROBES_TEXT						\
89 		ARM_STUBS_TEXT						\
90 		. = ALIGN(4);						\
91 		*(.got)			/* Global offset table */	\
92 		ARM_CPU_KEEP(PROC_INFO)
93 
94 /* Stack unwinding tables */
95 #define ARM_UNWIND_SECTIONS						\
96 	. = ALIGN(8);							\
97 	.ARM.unwind_idx : {						\
98 		__start_unwind_idx = .;					\
99 		*(.ARM.exidx*)						\
100 		__stop_unwind_idx = .;					\
101 	}								\
102 	.ARM.unwind_tab : {						\
103 		__start_unwind_tab = .;					\
104 		*(.ARM.extab*)						\
105 		__stop_unwind_tab = .;					\
106 	}
107 
108 /*
109  * The vectors and stubs are relocatable code, and the
110  * only thing that matters is their relative offsets
111  */
112 #define ARM_VECTORS							\
113 	__vectors_start = .;						\
114 	.vectors 0xffff0000 : AT(__vectors_start) {			\
115 		*(.vectors)						\
116 	}								\
117 	. = __vectors_start + SIZEOF(.vectors);				\
118 	__vectors_end = .;						\
119 									\
120 	__stubs_start = .;						\
121 	.stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) {		\
122 		*(.stubs)						\
123 	}								\
124 	. = __stubs_start + SIZEOF(.stubs);				\
125 	__stubs_end = .;						\
126 									\
127 	PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors));
128 
129 #define ARM_TCM								\
130 	__itcm_start = ALIGN(4);					\
131 	.text_itcm ITCM_OFFSET : AT(__itcm_start - LOAD_OFFSET) {	\
132 		__sitcm_text = .;					\
133 		*(.tcm.text)						\
134 		*(.tcm.rodata)						\
135 		. = ALIGN(4);						\
136 		__eitcm_text = .;					\
137 	}								\
138 	. = __itcm_start + SIZEOF(.text_itcm);				\
139 									\
140 	__dtcm_start = .;						\
141 	.data_dtcm DTCM_OFFSET : AT(__dtcm_start - LOAD_OFFSET) {	\
142 		__sdtcm_data = .;					\
143 		*(.tcm.data)						\
144 		. = ALIGN(4);						\
145 		__edtcm_data = .;					\
146 	}								\
147 	. = __dtcm_start + SIZEOF(.data_dtcm);
148