405d967dc7000 scripts/module-common.lds (Tejun Heo 2009-06-24 15:13:38 +0900 1) /*
405d967dc7000 scripts/module-common.lds (Tejun Heo 2009-06-24 15:13:38 +0900 2) * Common module linker script, always used when linking a module.
405d967dc7000 scripts/module-common.lds (Tejun Heo 2009-06-24 15:13:38 +0900 3) * Archs are free to supply their own linker scripts. ld will
405d967dc7000 scripts/module-common.lds (Tejun Heo 2009-06-24 15:13:38 +0900 4) * combine them automatically.
405d967dc7000 scripts/module-common.lds (Tejun Heo 2009-06-24 15:13:38 +0900 5) */
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 6) #ifdef CONFIG_CFI_CLANG
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 7) # include <asm/page.h>
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 8) # define ALIGN_CFI ALIGN(PAGE_SIZE)
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 9) # define SANITIZER_DISCARDS *(.eh_frame)
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 10) #else
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 11) # define ALIGN_CFI
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 12) # define SANITIZER_DISCARDS
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 13) #endif
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 14)
405d967dc7000 scripts/module-common.lds (Tejun Heo 2009-06-24 15:13:38 +0900 15) SECTIONS {
e390f9a9689a4 scripts/module-common.lds (Josh Poimboeuf 2017-03-01 12:04:44 -0600 16) /DISCARD/ : {
e390f9a9689a4 scripts/module-common.lds (Josh Poimboeuf 2017-03-01 12:04:44 -0600 17) *(.discard)
e390f9a9689a4 scripts/module-common.lds (Josh Poimboeuf 2017-03-01 12:04:44 -0600 18) *(.discard.*)
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 19) SANITIZER_DISCARDS
e390f9a9689a4 scripts/module-common.lds (Josh Poimboeuf 2017-03-01 12:04:44 -0600 20) }
f02e8a6596b7d scripts/module-common.lds (Alessio Igor Bogani 2011-04-14 14:59:39 +0200 21)
5d8591bc0fbae scripts/module-common.lds (Rabin Vincent 2015-02-06 15:09:57 +1030 22) __ksymtab 0 : { *(SORT(___ksymtab+*)) }
5d8591bc0fbae scripts/module-common.lds (Rabin Vincent 2015-02-06 15:09:57 +1030 23) __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) }
5d8591bc0fbae scripts/module-common.lds (Rabin Vincent 2015-02-06 15:09:57 +1030 24) __kcrctab 0 : { *(SORT(___kcrctab+*)) }
5d8591bc0fbae scripts/module-common.lds (Rabin Vincent 2015-02-06 15:09:57 +1030 25) __kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) }
9ddf82521c86a scripts/module-common.lds (Andrey Ryabinin 2015-02-13 14:40:10 -0800 26)
4c5afb74d9450 scripts/module.lds.S (Reiner Huober 2021-07-06 15:02:52 +0200 27) .ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) }
5bd933fe44816 scripts/module-common.lds (David Daney 2017-03-07 17:31:08 -0800 28) .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
ab42632156bec scripts/module-common.lds (David Daney 2017-03-01 14:04:53 -0800 29)
ab42632156bec scripts/module-common.lds (David Daney 2017-03-01 14:04:53 -0800 30) __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) }
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 31)
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 32) __patchable_function_entries : { *(__patchable_function_entries) }
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 33)
6a3193cdd5e5b scripts/module.lds.S (Sean Christopherson 2021-03-22 16:44:38 -0700 34) #ifdef CONFIG_LTO_CLANG
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 35) /*
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 36) * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 37) * -ffunction-sections, which increases the size of the final module.
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 38) * Merge the split sections in the final binary.
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 39) */
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 40) .bss : {
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 41) *(.bss .bss.[0-9a-zA-Z_]*)
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 42) *(.bss..L*)
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 43) }
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 44)
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 45) .data : {
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 46) *(.data .data.[0-9a-zA-Z_]*)
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 47) *(.data..L*)
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 48) }
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 49)
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 50) .rodata : {
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 51) *(.rodata .rodata.[0-9a-zA-Z_]*)
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 52) *(.rodata..L*)
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 53) }
dd2776222abb9 scripts/module.lds.S (Sami Tolvanen 2020-12-11 10:46:22 -0800 54)
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 55) /*
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 56) * With CONFIG_CFI_CLANG, we assume __cfi_check is at the beginning
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 57) * of the .text section, and is aligned to PAGE_SIZE.
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 58) */
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 59) .text : ALIGN_CFI {
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 60) *(.text.__cfi_check)
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 61) *(.text .text.[0-9a-zA-Z_]* .text..L.cfi*)
28aad1c290531 scripts/module.lds.S (Sami Tolvanen 2021-04-08 11:28:29 -0700 62) }
6a3193cdd5e5b scripts/module.lds.S (Sean Christopherson 2021-03-22 16:44:38 -0700 63) #endif
405d967dc7000 scripts/module-common.lds (Tejun Heo 2009-06-24 15:13:38 +0900 64) }
596b0474d3d9b scripts/module.lds.S (Masahiro Yamada 2020-09-08 13:27:08 +0900 65)
596b0474d3d9b scripts/module.lds.S (Masahiro Yamada 2020-09-08 13:27:08 +0900 66) /* bring in arch-specific sections */
596b0474d3d9b scripts/module.lds.S (Masahiro Yamada 2020-09-08 13:27:08 +0900 67) #include <asm/module.lds.h>