1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 #ifdef CONFIG_HOTPLUG_CPU 4 #define ARM_CPU_DISCARD(x) 5 #define ARM_CPU_KEEP(x) x 6 #else 7 #define ARM_CPU_DISCARD(x) x 8 #define ARM_CPU_KEEP(x) 9 #endif 10 11 #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \ 12 defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL) 13 #define ARM_EXIT_KEEP(x) x 14 #define ARM_EXIT_DISCARD(x) 15 #else 16 #define ARM_EXIT_KEEP(x) 17 #define ARM_EXIT_DISCARD(x) x 18 #endif 19 20 #ifdef CONFIG_MMU 21 #define ARM_MMU_KEEP(x) x 22 #define ARM_MMU_DISCARD(x) 23 #else 24 #define ARM_MMU_KEEP(x) 25 #define ARM_MMU_DISCARD(x) x 26 #endif 27 28 #define PROC_INFO \ 29 . = ALIGN(4); \ 30 __proc_info_begin = .; \ 31 *(.proc.info.init) \ 32 __proc_info_end = .; 33 34 #define HYPERVISOR_TEXT \ 35 __hyp_text_start = .; \ 36 *(.hyp.text) \ 37 __hyp_text_end = .; 38 39 #define IDMAP_TEXT \ 40 ALIGN_FUNCTION(); \ 41 __idmap_text_start = .; \ 42 *(.idmap.text) \ 43 __idmap_text_end = .; \ 44 . = ALIGN(PAGE_SIZE); \ 45 __hyp_idmap_text_start = .; \ 46 *(.hyp.idmap.text) \ 47 __hyp_idmap_text_end = .; 48 49 #define ARM_DISCARD \ 50 *(.ARM.exidx.exit.text) \ 51 *(.ARM.extab.exit.text) \ 52 *(.ARM.exidx.text.exit) \ 53 *(.ARM.extab.text.exit) \ 54 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) \ 55 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) \ 56 ARM_EXIT_DISCARD(EXIT_TEXT) \ 57 ARM_EXIT_DISCARD(EXIT_DATA) \ 58 EXIT_CALL \ 59 ARM_MMU_DISCARD(*(.text.fixup)) \ 60 ARM_MMU_DISCARD(*(__ex_table)) \ 61 *(.discard) \ 62 *(.discard.*) 63 64 #define ARM_TEXT \ 65 IDMAP_TEXT \ 66 __entry_text_start = .; \ 67 *(.entry.text) \ 68 __entry_text_end = .; \ 69 IRQENTRY_TEXT \ 70 SOFTIRQENTRY_TEXT \ 71 TEXT_TEXT \ 72 SCHED_TEXT \ 73 CPUIDLE_TEXT \ 74 LOCK_TEXT \ 75 HYPERVISOR_TEXT \ 76 KPROBES_TEXT \ 77 *(.gnu.warning) \ 78 *(.glue_7) \ 79 *(.glue_7t) \ 80 . = ALIGN(4); \ 81 *(.got) /* Global offset table */ \ 82 ARM_CPU_KEEP(PROC_INFO) 83 84 /* Stack unwinding tables */ 85 #define ARM_UNWIND_SECTIONS \ 86 . = ALIGN(8); \ 87 .ARM.unwind_idx : { \ 88 __start_unwind_idx = .; \ 89 *(.ARM.exidx*) \ 90 __stop_unwind_idx = .; \ 91 } \ 92 .ARM.unwind_tab : { \ 93 __start_unwind_tab = .; \ 94 *(.ARM.extab*) \ 95 __stop_unwind_tab = .; \ 96 } 97 98 /* 99 * The vectors and stubs are relocatable code, and the 100 * only thing that matters is their relative offsets 101 */ 102 #define ARM_VECTORS \ 103 __vectors_start = .; \ 104 .vectors 0xffff0000 : AT(__vectors_start) { \ 105 *(.vectors) \ 106 } \ 107 . = __vectors_start + SIZEOF(.vectors); \ 108 __vectors_end = .; \ 109 \ 110 __stubs_start = .; \ 111 .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { \ 112 *(.stubs) \ 113 } \ 114 . = __stubs_start + SIZEOF(.stubs); \ 115 __stubs_end = .; \ 116 \ 117 PROVIDE(vector_fiq_offset = vector_fiq - ADDR(.vectors)); 118 119 #define ARM_TCM \ 120 __itcm_start = ALIGN(4); \ 121 .text_itcm ITCM_OFFSET : AT(__itcm_start - LOAD_OFFSET) { \ 122 __sitcm_text = .; \ 123 *(.tcm.text) \ 124 *(.tcm.rodata) \ 125 . = ALIGN(4); \ 126 __eitcm_text = .; \ 127 } \ 128 . = __itcm_start + SIZEOF(.text_itcm); \ 129 \ 130 __dtcm_start = .; \ 131 .data_dtcm DTCM_OFFSET : AT(__dtcm_start - LOAD_OFFSET) { \ 132 __sdtcm_data = .; \ 133 *(.tcm.data) \ 134 . = ALIGN(4); \ 135 __edtcm_data = .; \ 136 } \ 137 . = __dtcm_start + SIZEOF(.data_dtcm); 138