xref: /openbmc/linux/scripts/module.lds.S (revision 01ab991f)
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 */
6SECTIONS {
7	/DISCARD/ : {
8		*(.discard)
9		*(.discard.*)
10	}
11
12	__ksymtab		0 : { *(SORT(___ksymtab+*)) }
13	__ksymtab_gpl		0 : { *(SORT(___ksymtab_gpl+*)) }
14	__kcrctab		0 : { *(SORT(___kcrctab+*)) }
15	__kcrctab_gpl		0 : { *(SORT(___kcrctab_gpl+*)) }
16
17	.ctors			0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) }
18	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
19
20	.altinstructions	0 : ALIGN(8) { KEEP(*(.altinstructions)) }
21	__bug_table		0 : ALIGN(8) { KEEP(*(__bug_table)) }
22	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
23
24	__patchable_function_entries : { *(__patchable_function_entries) }
25
26#ifdef CONFIG_ARCH_USES_CFI_TRAPS
27	__kcfi_traps 		: { KEEP(*(.kcfi_traps)) }
28#endif
29
30#ifdef CONFIG_LTO_CLANG
31	/*
32	 * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and
33	 * -ffunction-sections, which increases the size of the final module.
34	 * Merge the split sections in the final binary.
35	 */
36	.bss : {
37		*(.bss .bss.[0-9a-zA-Z_]*)
38		*(.bss..L*)
39	}
40
41	.data : {
42		*(.data .data.[0-9a-zA-Z_]*)
43		*(.data..L*)
44	}
45
46	.rodata : {
47		*(.rodata .rodata.[0-9a-zA-Z_]*)
48		*(.rodata..L*)
49	}
50#endif
51}
52
53/* bring in arch-specific sections */
54#include <asm/module.lds.h>
55