link.x.in 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. PROVIDE(_stext = ORIGIN(REGION_TEXT));
  2. SECTIONS {
  3. .text.dummy (NOLOAD) :
  4. {
  5. /*
  6. * If we use _stext somewhere before its first appearance below, we
  7. * need to define it as absolute here to avoid linker errors.
  8. */
  9. . = ABSOLUTE(_stext);
  10. } > REGION_TEXT
  11. .text _stext :
  12. {
  13. __stext = .;
  14. *(.text .text.*);
  15. } > REGION_TEXT
  16. __etext = .;
  17. .rodata : ALIGN(16)
  18. {
  19. __srodata = .;
  20. *(.rodata .rodata.*);
  21. } > REGION_RODATA
  22. __erodata = .;
  23. .data : ALIGN(16)
  24. {
  25. __sdata = .;
  26. *(.data .data.*);
  27. *(.got .got.plt);
  28. } > REGION_DATA
  29. __edata = .;
  30. .bss (NOLOAD) : ALIGN(16)
  31. {
  32. __sbss = .;
  33. *(.bss .bss.*);
  34. . = ALIGN(0x1000);
  35. } > REGION_BSS
  36. __ebss = .;
  37. .eh_frame : ALIGN(16)
  38. {
  39. __seh_frame = .;
  40. KEEP(*(.eh_frame .eh_frame*));
  41. } > REGION_EHFRAME
  42. . = ALIGN(0x1000);
  43. __eeh_frame = .;
  44. }
  45. SECTIONS {
  46. /* Stabs debugging sections. */
  47. .stab 0 : { KEEP(*(.stab)); }
  48. .stabstr 0 : { KEEP(*(.stabstr)); }
  49. .stab.excl 0 : { KEEP(*(.stab.excl)); }
  50. .stab.exclstr 0 : { KEEP(*(.stab.exclstr)); }
  51. .stab.index 0 : { KEEP(*(.stab.index)); }
  52. .stab.indexstr 0 : { KEEP(*(.stab.indexstr)); }
  53. .comment 0 : { KEEP(*(.comment)); }
  54. /* DWARF debug sections.
  55. Symbols in the DWARF debugging sections are relative to the beginning
  56. of the section so we begin them at 0. */
  57. /* DWARF 1 */
  58. .debug 0 : { KEEP(*(.debug)); }
  59. .line 0 : { KEEP(*(.line)); }
  60. /* GNU DWARF 1 extensions */
  61. .debug_srcinfo 0 : { KEEP(*(.debug_srcinfo)); }
  62. .debug_sfnames 0 : { KEEP(*(.debug_sfnames)); }
  63. /* DWARF 1.1 and DWARF 2 */
  64. .debug_aranges 0 : { KEEP(*(.debug_aranges)); }
  65. .debug_pubnames 0 : { KEEP(*(.debug_pubnames)); }
  66. /* DWARF 2 */
  67. .debug_info 0 : { KEEP(*(.debug_info)); }
  68. .debug_abbrev 0 : { KEEP(*(.debug_abbrev)); }
  69. .debug_line 0 : { KEEP(*(.debug_line)); }
  70. .debug_frame 0 : { KEEP(*(.debug_frame)); }
  71. .debug_str 0 : { KEEP(*(.debug_str)); }
  72. .debug_loc 0 : { KEEP(*(.debug_loc)); }
  73. .debug_macinfo 0 : { KEEP(*(.debug_macinfo)); }
  74. /* SGI/MIPS DWARF 2 extensions */
  75. .debug_weaknames 0 : { KEEP(*(.debug_weaknames)); }
  76. .debug_funcnames 0 : { KEEP(*(.debug_funcnames)); }
  77. .debug_typenames 0 : { KEEP(*(.debug_typenames)); }
  78. .debug_varnames 0 : { KEEP(*(.debug_varnames)); }
  79. /* DWARF Other */
  80. .debug_ranges 0 : { KEEP(*(.debug_ranges)); }
  81. .debug_line_str 0 : { KEEP(*(.debug_line_str)); }
  82. /DISCARD/ :
  83. {
  84. *(.fini_array*)
  85. *(.note*)
  86. *(.dtors*)
  87. *(.debug_gdb_scripts*)
  88. }
  89. }