Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Common module linker script, always used when linking a module.
0003  * Archs are free to supply their own linker scripts.  ld will
0004  * combine them automatically.
0005  */
0006 #ifdef CONFIG_CFI_CLANG
0007 # include <asm/page.h>
0008 # define ALIGN_CFI      ALIGN(PAGE_SIZE)
0009 # define SANITIZER_DISCARDS *(.eh_frame)
0010 #else
0011 # define ALIGN_CFI
0012 # define SANITIZER_DISCARDS
0013 #endif
0014 
0015 SECTIONS {
0016     /DISCARD/ : {
0017         *(.discard)
0018         *(.discard.*)
0019         SANITIZER_DISCARDS
0020     }
0021 
0022     __ksymtab       0 : { *(SORT(___ksymtab+*)) }
0023     __ksymtab_gpl       0 : { *(SORT(___ksymtab_gpl+*)) }
0024     __kcrctab       0 : { *(SORT(___kcrctab+*)) }
0025     __kcrctab_gpl       0 : { *(SORT(___kcrctab_gpl+*)) }
0026 
0027     .ctors          0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) }
0028     .init_array     0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
0029 
0030     .altinstructions    0 : ALIGN(8) { KEEP(*(.altinstructions)) }
0031     __bug_table     0 : ALIGN(8) { KEEP(*(__bug_table)) }
0032     __jump_table        0 : ALIGN(8) { KEEP(*(__jump_table)) }
0033 
0034     __patchable_function_entries : { *(__patchable_function_entries) }
0035 
0036 #ifdef CONFIG_LTO_CLANG
0037     /*
0038      * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and
0039      * -ffunction-sections, which increases the size of the final module.
0040      * Merge the split sections in the final binary.
0041      */
0042     .bss : {
0043         *(.bss .bss.[0-9a-zA-Z_]*)
0044         *(.bss..L*)
0045     }
0046 
0047     .data : {
0048         *(.data .data.[0-9a-zA-Z_]*)
0049         *(.data..L*)
0050     }
0051 
0052     .rodata : {
0053         *(.rodata .rodata.[0-9a-zA-Z_]*)
0054         *(.rodata..L*)
0055     }
0056 
0057     /*
0058      * With CONFIG_CFI_CLANG, we assume __cfi_check is at the beginning
0059      * of the .text section, and is aligned to PAGE_SIZE.
0060      */
0061     .text : ALIGN_CFI {
0062         *(.text.__cfi_check)
0063         *(.text .text.[0-9a-zA-Z_]* .text..L.cfi*)
0064     }
0065 #endif
0066 }
0067 
0068 /* bring in arch-specific sections */
0069 #include <asm/module.lds.h>