18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#include <asm-generic/vmlinux.lds.h> 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifdef CONFIG_HOTPLUG_CPU 58c2ecf20Sopenharmony_ci#define ARM_CPU_DISCARD(x) 68c2ecf20Sopenharmony_ci#define ARM_CPU_KEEP(x) x 78c2ecf20Sopenharmony_ci#else 88c2ecf20Sopenharmony_ci#define ARM_CPU_DISCARD(x) x 98c2ecf20Sopenharmony_ci#define ARM_CPU_KEEP(x) 108c2ecf20Sopenharmony_ci#endif 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \ 138c2ecf20Sopenharmony_ci defined(CONFIG_GENERIC_BUG) || defined(CONFIG_JUMP_LABEL) 148c2ecf20Sopenharmony_ci#define ARM_EXIT_KEEP(x) x 158c2ecf20Sopenharmony_ci#define ARM_EXIT_DISCARD(x) 168c2ecf20Sopenharmony_ci#else 178c2ecf20Sopenharmony_ci#define ARM_EXIT_KEEP(x) 188c2ecf20Sopenharmony_ci#define ARM_EXIT_DISCARD(x) x 198c2ecf20Sopenharmony_ci#endif 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#ifdef CONFIG_MMU 228c2ecf20Sopenharmony_ci#define ARM_MMU_KEEP(x) x 238c2ecf20Sopenharmony_ci#define ARM_MMU_DISCARD(x) 248c2ecf20Sopenharmony_ci#else 258c2ecf20Sopenharmony_ci#define ARM_MMU_KEEP(x) 268c2ecf20Sopenharmony_ci#define ARM_MMU_DISCARD(x) x 278c2ecf20Sopenharmony_ci#endif 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* 308c2ecf20Sopenharmony_ci * ld.lld does not support NOCROSSREFS: 318c2ecf20Sopenharmony_ci * https://github.com/ClangBuiltLinux/linux/issues/1609 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci#ifdef CONFIG_LD_IS_LLD 348c2ecf20Sopenharmony_ci#define NOCROSSREFS 358c2ecf20Sopenharmony_ci#endif 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* Set start/end symbol names to the LMA for the section */ 388c2ecf20Sopenharmony_ci#define ARM_LMA(sym, section) \ 398c2ecf20Sopenharmony_ci sym##_start = LOADADDR(section); \ 408c2ecf20Sopenharmony_ci sym##_end = LOADADDR(section) + SIZEOF(section) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define PROC_INFO \ 438c2ecf20Sopenharmony_ci . = ALIGN(4); \ 448c2ecf20Sopenharmony_ci __proc_info_begin = .; \ 458c2ecf20Sopenharmony_ci *(.proc.info.init) \ 468c2ecf20Sopenharmony_ci __proc_info_end = .; 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define IDMAP_TEXT \ 498c2ecf20Sopenharmony_ci ALIGN_FUNCTION(); \ 508c2ecf20Sopenharmony_ci __idmap_text_start = .; \ 518c2ecf20Sopenharmony_ci *(.idmap.text) \ 528c2ecf20Sopenharmony_ci __idmap_text_end = .; \ 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci#define ARM_DISCARD \ 558c2ecf20Sopenharmony_ci *(.ARM.exidx.exit.text) \ 568c2ecf20Sopenharmony_ci *(.ARM.extab.exit.text) \ 578c2ecf20Sopenharmony_ci *(.ARM.exidx.text.exit) \ 588c2ecf20Sopenharmony_ci *(.ARM.extab.text.exit) \ 598c2ecf20Sopenharmony_ci ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) \ 608c2ecf20Sopenharmony_ci ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) \ 618c2ecf20Sopenharmony_ci ARM_EXIT_DISCARD(EXIT_TEXT) \ 628c2ecf20Sopenharmony_ci ARM_EXIT_DISCARD(EXIT_DATA) \ 638c2ecf20Sopenharmony_ci EXIT_CALL \ 648c2ecf20Sopenharmony_ci ARM_MMU_DISCARD(*(.text.fixup)) \ 658c2ecf20Sopenharmony_ci ARM_MMU_DISCARD(*(__ex_table)) \ 668c2ecf20Sopenharmony_ci COMMON_DISCARDS \ 678c2ecf20Sopenharmony_ci *(.ARM.exidx.discard.text) \ 688c2ecf20Sopenharmony_ci *(.interp .dynamic) \ 698c2ecf20Sopenharmony_ci *(.dynsym .dynstr .hash) 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* 738c2ecf20Sopenharmony_ci * Sections that should stay zero sized, which is safer to explicitly 748c2ecf20Sopenharmony_ci * check instead of blindly discarding. 758c2ecf20Sopenharmony_ci */ 768c2ecf20Sopenharmony_ci#define ARM_ASSERTS \ 778c2ecf20Sopenharmony_ci .plt : { \ 788c2ecf20Sopenharmony_ci *(.iplt) *(.rel.iplt) *(.iplt) *(.igot.plt) *(.plt) \ 798c2ecf20Sopenharmony_ci } \ 808c2ecf20Sopenharmony_ci ASSERT(SIZEOF(.plt) == 0, \ 818c2ecf20Sopenharmony_ci "Unexpected run-time procedure linkages detected!") 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci#define ARM_DETAILS \ 848c2ecf20Sopenharmony_ci ELF_DETAILS \ 858c2ecf20Sopenharmony_ci .ARM.attributes 0 : { *(.ARM.attributes) } 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define ARM_STUBS_TEXT \ 888c2ecf20Sopenharmony_ci *(.gnu.warning) \ 898c2ecf20Sopenharmony_ci *(.glue_7) \ 908c2ecf20Sopenharmony_ci *(.glue_7t) \ 918c2ecf20Sopenharmony_ci *(.vfp11_veneer) \ 928c2ecf20Sopenharmony_ci *(.v4_bx) 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci#define ARM_TEXT \ 958c2ecf20Sopenharmony_ci IDMAP_TEXT \ 968c2ecf20Sopenharmony_ci __entry_text_start = .; \ 978c2ecf20Sopenharmony_ci *(.entry.text) \ 988c2ecf20Sopenharmony_ci __entry_text_end = .; \ 998c2ecf20Sopenharmony_ci IRQENTRY_TEXT \ 1008c2ecf20Sopenharmony_ci SOFTIRQENTRY_TEXT \ 1018c2ecf20Sopenharmony_ci TEXT_TEXT \ 1028c2ecf20Sopenharmony_ci SCHED_TEXT \ 1038c2ecf20Sopenharmony_ci CPUIDLE_TEXT \ 1048c2ecf20Sopenharmony_ci LOCK_TEXT \ 1058c2ecf20Sopenharmony_ci KPROBES_TEXT \ 1068c2ecf20Sopenharmony_ci ARM_STUBS_TEXT \ 1078c2ecf20Sopenharmony_ci . = ALIGN(4); \ 1088c2ecf20Sopenharmony_ci *(.got) /* Global offset table */ \ 1098c2ecf20Sopenharmony_ci *(.got.plt) \ 1108c2ecf20Sopenharmony_ci ARM_CPU_KEEP(PROC_INFO) 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/* Stack unwinding tables */ 1138c2ecf20Sopenharmony_ci#define ARM_UNWIND_SECTIONS \ 1148c2ecf20Sopenharmony_ci . = ALIGN(8); \ 1158c2ecf20Sopenharmony_ci .ARM.unwind_idx : { \ 1168c2ecf20Sopenharmony_ci __start_unwind_idx = .; \ 1178c2ecf20Sopenharmony_ci *(.ARM.exidx*) \ 1188c2ecf20Sopenharmony_ci __stop_unwind_idx = .; \ 1198c2ecf20Sopenharmony_ci } \ 1208c2ecf20Sopenharmony_ci .ARM.unwind_tab : { \ 1218c2ecf20Sopenharmony_ci __start_unwind_tab = .; \ 1228c2ecf20Sopenharmony_ci *(.ARM.extab*) \ 1238c2ecf20Sopenharmony_ci __stop_unwind_tab = .; \ 1248c2ecf20Sopenharmony_ci } 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci/* 1278c2ecf20Sopenharmony_ci * The vectors and stubs are relocatable code, and the 1288c2ecf20Sopenharmony_ci * only thing that matters is their relative offsets 1298c2ecf20Sopenharmony_ci */ 1308c2ecf20Sopenharmony_ci#define ARM_VECTORS \ 1318c2ecf20Sopenharmony_ci __vectors_lma = .; \ 1328c2ecf20Sopenharmony_ci OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { \ 1338c2ecf20Sopenharmony_ci .vectors { \ 1348c2ecf20Sopenharmony_ci *(.vectors) \ 1358c2ecf20Sopenharmony_ci } \ 1368c2ecf20Sopenharmony_ci .vectors.bhb.loop8 { \ 1378c2ecf20Sopenharmony_ci *(.vectors.bhb.loop8) \ 1388c2ecf20Sopenharmony_ci } \ 1398c2ecf20Sopenharmony_ci .vectors.bhb.bpiall { \ 1408c2ecf20Sopenharmony_ci *(.vectors.bhb.bpiall) \ 1418c2ecf20Sopenharmony_ci } \ 1428c2ecf20Sopenharmony_ci } \ 1438c2ecf20Sopenharmony_ci ARM_LMA(__vectors, .vectors); \ 1448c2ecf20Sopenharmony_ci ARM_LMA(__vectors_bhb_loop8, .vectors.bhb.loop8); \ 1458c2ecf20Sopenharmony_ci ARM_LMA(__vectors_bhb_bpiall, .vectors.bhb.bpiall); \ 1468c2ecf20Sopenharmony_ci . = __vectors_lma + SIZEOF(.vectors) + \ 1478c2ecf20Sopenharmony_ci SIZEOF(.vectors.bhb.loop8) + \ 1488c2ecf20Sopenharmony_ci SIZEOF(.vectors.bhb.bpiall); \ 1498c2ecf20Sopenharmony_ci \ 1508c2ecf20Sopenharmony_ci __stubs_lma = .; \ 1518c2ecf20Sopenharmony_ci .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { \ 1528c2ecf20Sopenharmony_ci *(.stubs) \ 1538c2ecf20Sopenharmony_ci } \ 1548c2ecf20Sopenharmony_ci ARM_LMA(__stubs, .stubs); \ 1558c2ecf20Sopenharmony_ci . = __stubs_lma + SIZEOF(.stubs); 1568c2ecf20Sopenharmony_ci \ 1578c2ecf20Sopenharmony_ci#define ARM_TCM \ 1588c2ecf20Sopenharmony_ci __itcm_start = ALIGN(4); \ 1598c2ecf20Sopenharmony_ci .text_itcm ITCM_OFFSET : AT(__itcm_start - LOAD_OFFSET) { \ 1608c2ecf20Sopenharmony_ci __sitcm_text = .; \ 1618c2ecf20Sopenharmony_ci *(.tcm.text) \ 1628c2ecf20Sopenharmony_ci *(.tcm.rodata) \ 1638c2ecf20Sopenharmony_ci . = ALIGN(4); \ 1648c2ecf20Sopenharmony_ci __eitcm_text = .; \ 1658c2ecf20Sopenharmony_ci } \ 1668c2ecf20Sopenharmony_ci . = __itcm_start + SIZEOF(.text_itcm); \ 1678c2ecf20Sopenharmony_ci \ 1688c2ecf20Sopenharmony_ci __dtcm_start = .; \ 1698c2ecf20Sopenharmony_ci .data_dtcm DTCM_OFFSET : AT(__dtcm_start - LOAD_OFFSET) { \ 1708c2ecf20Sopenharmony_ci __sdtcm_data = .; \ 1718c2ecf20Sopenharmony_ci *(.tcm.data) \ 1728c2ecf20Sopenharmony_ci . = ALIGN(4); \ 1738c2ecf20Sopenharmony_ci __edtcm_data = .; \ 1748c2ecf20Sopenharmony_ci } \ 1758c2ecf20Sopenharmony_ci . = __dtcm_start + SIZEOF(.data_dtcm); 176