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#ifdef CONFIG_UNWIND_TABLES 7#define DISCARD_EH_FRAME 8#else 9#define DISCARD_EH_FRAME *(.eh_frame) 10#endif 11 12SECTIONS { 13 /DISCARD/ : { 14 *(.discard) 15 *(.discard.*) 16 } 17 18 __ksymtab 0 : { *(SORT(___ksymtab+*)) } 19 __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) } 20 __kcrctab 0 : { *(SORT(___kcrctab+*)) } 21 __kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) } 22 23 .ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) } 24 .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) } 25 26 .altinstructions 0 : ALIGN(8) { KEEP(*(.altinstructions)) } 27 __bug_table 0 : ALIGN(8) { KEEP(*(__bug_table)) } 28 __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } 29 30 __patchable_function_entries : { *(__patchable_function_entries) } 31 32#ifdef CONFIG_ARCH_USES_CFI_TRAPS 33 __kcfi_traps : { KEEP(*(.kcfi_traps)) } 34#endif 35 36#if IS_ENABLED(CONFIG_CRYPTO_FIPS140_MOD) 37 /* 38 * The FIPS140 module incorporates copies of builtin code, which gets 39 * integrity checked at module load time, and registered in a way that 40 * ensures that the integrity checked versions supersede the builtin 41 * ones. These objects are compiled as builtin code, and so their init 42 * hooks will be exported from the binary in the same way as builtin 43 * initcalls are, i.e., annotated with a level that defines the order 44 * in which the hooks are expected to be invoked. 45 */ 46#define INIT_CALLS_LEVEL(level) \ 47 KEEP(*(.initcall##level##.init*)) \ 48 KEEP(*(.initcall##level##s.init*)) 49 50 .initcalls : { 51 *(.initcalls._start) 52 INIT_CALLS_LEVEL(0) 53 INIT_CALLS_LEVEL(1) 54 INIT_CALLS_LEVEL(2) 55 INIT_CALLS_LEVEL(3) 56 INIT_CALLS_LEVEL(4) 57 INIT_CALLS_LEVEL(5) 58 INIT_CALLS_LEVEL(rootfs) 59 INIT_CALLS_LEVEL(6) 60 INIT_CALLS_LEVEL(7) 61 *(.initcalls._end) 62 } 63#endif 64 65#if defined(CONFIG_LTO_CLANG) || defined(CONFIG_CRYPTO_FIPS140_MERGE_MOD_SECTIONS) 66 /* 67 * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and 68 * -ffunction-sections, which increases the size of the final module. 69 * Merge the split sections in the final binary. 70 */ 71 .bss : { 72 *(.bss .bss.[0-9a-zA-Z_]*) 73 *(.bss..L*) 74 } 75 76 .data : { 77 *(.data .data.[0-9a-zA-Z_]*) 78 *(.data..L*) 79 } 80 81 .rodata : { 82 *(.rodata.._start) 83 *(.rodata .rodata.[0-9a-zA-Z_]*) 84 *(.rodata..L*) 85 *(.rodata.._end) 86 } 87 88 .text : { 89 *(.text.._start) 90 *(.text .text.[0-9a-zA-Z_]*) 91 *(.text.._end) 92 *(.text.._fips140_unchecked) 93 } 94#endif 95} 96 97/* bring in arch-specific sections */ 98#include <asm/module.lds.h> 99