xref: /linux/scripts/module.lds.S (revision 2f0f6b0773be0a1ec475097ae54848eea42adc7d)
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
7#include <asm-generic/codetag.lds.h>
8
9SECTIONS {
10	/DISCARD/ : {
11		*(.discard)
12		*(.discard.*)
13		*(.export_symbol)
14		*(.no_trim_symbol)
15	}
16
17	__ksymtab		0 : ALIGN(8) { *(SORT(___ksymtab+*)) }
18	__kcrctab		0 : ALIGN(4) { *(SORT(___kcrctab+*)) }
19	__kflagstab		0 : ALIGN(1) { *(SORT(___kflagstab+*)) }
20
21	.ctors			0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) }
22	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
23
24	.altinstructions	0 : ALIGN(8) { KEEP(*(.altinstructions)) }
25	__bug_table		0 : ALIGN(8) { KEEP(*(__bug_table)) }
26	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
27	__ex_table		0 : ALIGN(4) { KEEP(*(__ex_table)) }
28
29	__patchable_function_entries 0 : { *(__patchable_function_entries) }
30
31	.init.klp_funcs		0 : ALIGN(8) { KEEP(*(.init.klp_funcs)) }
32	.init.klp_objects	0 : ALIGN(8) { KEEP(*(.init.klp_objects)) }
33
34#ifdef CONFIG_ARCH_USES_CFI_TRAPS
35	__kcfi_traps		0 : { KEEP(*(.kcfi_traps)) }
36#endif
37
38#ifndef CONFIG_ARCH_WANTS_MODULES_TEXT_SECTIONS
39	.text			0 : {
40		*(.text .text.[0-9a-zA-Z_]*)
41	}
42#endif
43
44	.bss			0 : {
45		*(.bss .bss.[0-9a-zA-Z_]*)
46		*(.bss..L*)
47	}
48
49	.data			0 : {
50		*(.data .data.[0-9a-zA-Z_]*)
51		*(.data..L*)
52	}
53
54	.rodata			0 : {
55		*(.rodata .rodata.[0-9a-zA-Z_]*)
56		*(.rodata..L*)
57	}
58
59	MOD_SEPARATE_CODETAG_SECTIONS()
60}
61
62/* bring in arch-specific sections */
63#include <asm/module.lds.h>
64