• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Common module linker script, always used when linking a module.
3 * Archs are free to supply their own linker scripts.  ld will
4 * combine them automatically.
5 */
6#include <asm/page.h>
7
8SECTIONS {
9	/DISCARD/ : {
10		*(.discard)
11		*(.discard.*)
12		/*
13		 * LLD may emit .eh_frame with CONFIG_CFI_CLANG despite
14		 * -fno-asynchronous-unwind-tables. Discard the section.
15		 */
16		*(.eh_frame)
17	}
18
19	__ksymtab		0 : { *(SORT(___ksymtab+*)) }
20	__ksymtab_gpl		0 : { *(SORT(___ksymtab_gpl+*)) }
21	__ksymtab_unused	0 : { *(SORT(___ksymtab_unused+*)) }
22	__ksymtab_unused_gpl	0 : { *(SORT(___ksymtab_unused_gpl+*)) }
23	__ksymtab_gpl_future	0 : { *(SORT(___ksymtab_gpl_future+*)) }
24	__kcrctab		0 : { *(SORT(___kcrctab+*)) }
25	__kcrctab_gpl		0 : { *(SORT(___kcrctab_gpl+*)) }
26	__kcrctab_unused	0 : { *(SORT(___kcrctab_unused+*)) }
27	__kcrctab_unused_gpl	0 : { *(SORT(___kcrctab_unused_gpl+*)) }
28	__kcrctab_gpl_future	0 : { *(SORT(___kcrctab_gpl_future+*)) }
29
30	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
31
32	.altinstructions	0 : ALIGN(8) { KEEP(*(.altinstructions)) }
33	__bug_table		0 : ALIGN(8) { KEEP(*(__bug_table)) }
34	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
35
36	__patchable_function_entries : { *(__patchable_function_entries) }
37
38#ifdef CONFIG_LTO_CLANG
39	/*
40	 * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and
41	 * -ffunction-sections, which increases the size of the final module.
42	 * Merge the split sections in the final binary.
43	 */
44	.bss : {
45		*(.bss .bss.[0-9a-zA-Z_]*)
46		*(.bss..L*)
47	}
48
49	.data : {
50		*(.data .data.[0-9a-zA-Z_]*)
51		*(.data..L*)
52	}
53
54	.rodata : {
55		*(.rodata.._start)
56		*(.rodata .rodata.[0-9a-zA-Z_]*)
57		*(.rodata..L*)
58		*(.rodata.._end)
59	}
60
61	.text : ALIGN(PAGE_SIZE) {
62		*(.text.._start)
63#ifdef CONFIG_CFI_CLANG
64		/*
65		 * With CFI_CLANG, ensure __cfi_check is at the beginning of
66		 * the .text section, and that the section is aligned to page
67		 * size.
68		 */
69		*(.text.__cfi_check)
70#endif
71		*(.text .text.[0-9a-zA-Z_]*)
72		__cfi_jt_start = .;
73		*(.text..L.cfi.jumptable .text..L.cfi.jumptable.*)
74		__cfi_jt_end = .;
75		*(.text.._end)
76		*(.text.._fips140_unchecked)
77	}
78#endif
79}
80
81/* bring in arch-specific sections */
82#include <asm/module.lds.h>
83