module.lds.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #include <asm-generic/codetag.lds.h>
  12. SECTIONS {
  13. /DISCARD/ : {
  14. *(.discard)
  15. *(.discard.*)
  16. *(.export_symbol)
  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. .ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) }
  23. .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
  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. __patchable_function_entries : { *(__patchable_function_entries) }
  28. #ifdef CONFIG_ARCH_USES_CFI_TRAPS
  29. __kcfi_traps : { KEEP(*(.kcfi_traps)) }
  30. #endif
  31. #ifdef CONFIG_LTO_CLANG
  32. /*
  33. * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and
  34. * -ffunction-sections, which increases the size of the final module.
  35. * Merge the split sections in the final binary.
  36. */
  37. .bss : {
  38. *(.bss .bss.[0-9a-zA-Z_]*)
  39. *(.bss..L*)
  40. }
  41. .data : {
  42. *(.data .data.[0-9a-zA-Z_]*)
  43. *(.data..L*)
  44. CODETAG_SECTIONS()
  45. }
  46. .rodata : {
  47. *(.rodata .rodata.[0-9a-zA-Z_]*)
  48. *(.rodata..L*)
  49. }
  50. #else
  51. .data : {
  52. CODETAG_SECTIONS()
  53. }
  54. #endif
  55. }
  56. /* bring in arch-specific sections */
  57. #include <asm/module.lds.h>