18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Common module linker script, always used when linking a module.
38c2ecf20Sopenharmony_ci * Archs are free to supply their own linker scripts.  ld will
48c2ecf20Sopenharmony_ci * combine them automatically.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifdef CONFIG_CFI_CLANG
78c2ecf20Sopenharmony_ci# include <asm/page.h>
88c2ecf20Sopenharmony_ci# define ALIGN_CFI 		ALIGN(PAGE_SIZE)
98c2ecf20Sopenharmony_ci# define SANITIZER_DISCARDS	*(.eh_frame)
108c2ecf20Sopenharmony_ci#else
118c2ecf20Sopenharmony_ci# define ALIGN_CFI
128c2ecf20Sopenharmony_ci# define SANITIZER_DISCARDS
138c2ecf20Sopenharmony_ci#endif
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSECTIONS {
168c2ecf20Sopenharmony_ci	/DISCARD/ : {
178c2ecf20Sopenharmony_ci		*(.discard)
188c2ecf20Sopenharmony_ci		*(.discard.*)
198c2ecf20Sopenharmony_ci		*(*.discard.*)
208c2ecf20Sopenharmony_ci		SANITIZER_DISCARDS
218c2ecf20Sopenharmony_ci	}
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	__ksymtab		0 : { *(SORT(___ksymtab+*)) }
248c2ecf20Sopenharmony_ci	__ksymtab_gpl		0 : { *(SORT(___ksymtab_gpl+*)) }
258c2ecf20Sopenharmony_ci	__ksymtab_unused	0 : { *(SORT(___ksymtab_unused+*)) }
268c2ecf20Sopenharmony_ci	__ksymtab_unused_gpl	0 : { *(SORT(___ksymtab_unused_gpl+*)) }
278c2ecf20Sopenharmony_ci	__ksymtab_gpl_future	0 : { *(SORT(___ksymtab_gpl_future+*)) }
288c2ecf20Sopenharmony_ci	__kcrctab		0 : { *(SORT(___kcrctab+*)) }
298c2ecf20Sopenharmony_ci	__kcrctab_gpl		0 : { *(SORT(___kcrctab_gpl+*)) }
308c2ecf20Sopenharmony_ci	__kcrctab_unused	0 : { *(SORT(___kcrctab_unused+*)) }
318c2ecf20Sopenharmony_ci	__kcrctab_unused_gpl	0 : { *(SORT(___kcrctab_unused_gpl+*)) }
328c2ecf20Sopenharmony_ci	__kcrctab_gpl_future	0 : { *(SORT(___kcrctab_gpl_future+*)) }
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci	.altinstructions	0 : ALIGN(8) { KEEP(*(.altinstructions)) }
378c2ecf20Sopenharmony_ci	__bug_table		0 : ALIGN(8) { KEEP(*(__bug_table)) }
388c2ecf20Sopenharmony_ci	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	__patchable_function_entries : { *(__patchable_function_entries) }
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#ifdef CONFIG_LTO_CLANG
438c2ecf20Sopenharmony_ci	/*
448c2ecf20Sopenharmony_ci	 * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and
458c2ecf20Sopenharmony_ci	 * -ffunction-sections, which increases the size of the final module.
468c2ecf20Sopenharmony_ci	 * Merge the split sections in the final binary.
478c2ecf20Sopenharmony_ci	 */
488c2ecf20Sopenharmony_ci	.bss : {
498c2ecf20Sopenharmony_ci		*(.bss .bss.[0-9a-zA-Z_]*)
508c2ecf20Sopenharmony_ci		*(.bss..L*)
518c2ecf20Sopenharmony_ci	}
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	.data : {
548c2ecf20Sopenharmony_ci		*(.data .data.[0-9a-zA-Z_]*)
558c2ecf20Sopenharmony_ci		*(.data..L*)
568c2ecf20Sopenharmony_ci	}
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci	.rodata : {
598c2ecf20Sopenharmony_ci		*(.rodata .rodata.[0-9a-zA-Z_]*)
608c2ecf20Sopenharmony_ci		*(.rodata..L*)
618c2ecf20Sopenharmony_ci	}
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	/*
648c2ecf20Sopenharmony_ci	 * With CONFIG_CFI_CLANG, we assume __cfi_check is at the beginning
658c2ecf20Sopenharmony_ci	 * of the .text section, and is aligned to PAGE_SIZE.
668c2ecf20Sopenharmony_ci	 */
678c2ecf20Sopenharmony_ci	.text : ALIGN_CFI {
688c2ecf20Sopenharmony_ci		*(.text.__cfi_check)
698c2ecf20Sopenharmony_ci		*(.text .text.[0-9a-zA-Z_]* .text..L.cfi*)
708c2ecf20Sopenharmony_ci	}
718c2ecf20Sopenharmony_ci#endif
728c2ecf20Sopenharmony_ci}
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/* bring in arch-specific sections */
758c2ecf20Sopenharmony_ci#include <asm/module.lds.h>
76