1
0

gcc.ld 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /* Script for -z combreloc: combine and sort reloc sections */
  2. OUTPUT_FORMAT("elf32-i386", "elf32-i386",
  3. "elf32-i386")
  4. OUTPUT_ARCH(i386)
  5. ENTRY(_start)
  6. SEARCH_DIR("/usr/i686-linux-gnu/lib32"); SEARCH_DIR("=/usr/local/lib32"); SEARCH_DIR("=/lib32"); SEARCH_DIR("=/usr/lib32"); SEARCH_DIR("=/usr/local/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib/i386-linux-gnu"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/lib");
  7. SECTIONS
  8. {
  9. /* Read-only sections, merged into text segment: */
  10. PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x08048000)); . = SEGMENT_START("text-segment", 0x08048000) + SIZEOF_HEADERS;
  11. .interp : { *(.interp) }
  12. .note.gnu.build-id : { *(.note.gnu.build-id) }
  13. .hash : { *(.hash) }
  14. .gnu.hash : { *(.gnu.hash) }
  15. .dynsym : { *(.dynsym) }
  16. .dynstr : { *(.dynstr) }
  17. .gnu.version : { *(.gnu.version) }
  18. .gnu.version_d : { *(.gnu.version_d) }
  19. .gnu.version_r : { *(.gnu.version_r) }
  20. .rel.dyn :
  21. {
  22. *(.rel.init)
  23. *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
  24. *(.rel.fini)
  25. *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
  26. *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
  27. *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
  28. *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
  29. *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
  30. *(.rel.ctors)
  31. *(.rel.dtors)
  32. *(.rel.got)
  33. *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
  34. *(.rel.ifunc)
  35. }
  36. .rel.plt :
  37. {
  38. *(.rel.plt)
  39. PROVIDE_HIDDEN (__rel_iplt_start = .);
  40. *(.rel.iplt)
  41. PROVIDE_HIDDEN (__rel_iplt_end = .);
  42. }
  43. .init :
  44. {
  45. KEEP (*(.init))
  46. } =0x90909090
  47. .plt : { *(.plt) *(.iplt) }
  48. .text :
  49. {
  50. *(.text.unlikely .text.*_unlikely)
  51. *(.text.exit .text.exit.*)
  52. *(.text.startup .text.startup.*)
  53. *(.text.hot .text.hot.*)
  54. *(.text .stub .text.* .gnu.linkonce.t.*)
  55. /* .gnu.warning sections are handled specially by elf32.em. */
  56. *(.gnu.warning)
  57. } =0x90909090
  58. .fini :
  59. {
  60. KEEP (*(.fini))
  61. } =0x90909090
  62. PROVIDE (__etext = .);
  63. PROVIDE (_etext = .);
  64. PROVIDE (etext = .);
  65. .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  66. .rodata1 : { *(.rodata1) }
  67. /* setction information for finsh shell begin */
  68. . = ALIGN(4);
  69. FSymTab : {
  70. __fsymtab_start = .;
  71. KEEP(*(FSymTab))
  72. __fsymtab_end = .;
  73. }
  74. . = ALIGN(4);
  75. VSymTab : {
  76. __vsymtab_start = .;
  77. KEEP(*(VSymTab))
  78. __vsymtab_end = .;
  79. }
  80. . = ALIGN(4);
  81. rti_fn : {
  82. __rt_init_start = .;
  83. KEEP(*(SORT(.rti_fn*)))
  84. __rt_init_end = .;
  85. }
  86. . = ALIGN(4);
  87. /* setction information for finsh shell end */
  88. .eh_frame_hdr : { *(.eh_frame_hdr) }
  89. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  90. .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
  91. .gcc_except_table.*) }
  92. /* These sections are generated by the Sun/Oracle C++ compiler. */
  93. .exception_ranges : ONLY_IF_RO { *(.exception_ranges
  94. .exception_ranges*) }
  95. /* Adjust the address for the data segment. We want to adjust up to
  96. the same address within the page on the next page up. */
  97. . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
  98. /* Exception handling */
  99. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  100. .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  101. .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
  102. /* Thread Local Storage sections */
  103. .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
  104. .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  105. .preinit_array :
  106. {
  107. PROVIDE_HIDDEN (__preinit_array_start = .);
  108. KEEP (*(.preinit_array))
  109. PROVIDE_HIDDEN (__preinit_array_end = .);
  110. }
  111. .init_array :
  112. {
  113. PROVIDE_HIDDEN (__init_array_start = .);
  114. KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
  115. KEEP (*(.init_array))
  116. KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
  117. PROVIDE_HIDDEN (__init_array_end = .);
  118. }
  119. .fini_array :
  120. {
  121. PROVIDE_HIDDEN (__fini_array_start = .);
  122. KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
  123. KEEP (*(.fini_array))
  124. KEEP (*(EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
  125. PROVIDE_HIDDEN (__fini_array_end = .);
  126. }
  127. .ctors :
  128. {
  129. /* gcc uses crtbegin.o to find the start of
  130. the constructors, so we make sure it is
  131. first. Because this is a wildcard, it
  132. doesn't matter if the user does not
  133. actually link against crtbegin.o; the
  134. linker won't look for a file to match a
  135. wildcard. The wildcard also means that it
  136. doesn't matter which directory crtbegin.o
  137. is in. */
  138. KEEP (*crtbegin.o(.ctors))
  139. KEEP (*crtbegin?.o(.ctors))
  140. /* We don't want to include the .ctor section from
  141. the crtend.o file until after the sorted ctors.
  142. The .ctor section from the crtend file contains the
  143. end of ctors marker and it must be last */
  144. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  145. KEEP (*(SORT(.ctors.*)))
  146. KEEP (*(.ctors))
  147. }
  148. .dtors :
  149. {
  150. KEEP (*crtbegin.o(.dtors))
  151. KEEP (*crtbegin?.o(.dtors))
  152. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  153. KEEP (*(SORT(.dtors.*)))
  154. KEEP (*(.dtors))
  155. }
  156. .jcr : { KEEP (*(.jcr)) }
  157. .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
  158. .dynamic : { *(.dynamic) }
  159. .got : { *(.got) *(.igot) }
  160. . = DATA_SEGMENT_RELRO_END (12, .);
  161. .got.plt : { *(.got.plt) *(.igot.plt) }
  162. .data :
  163. {
  164. *(.data .data.* .gnu.linkonce.d.*)
  165. SORT(CONSTRUCTORS)
  166. }
  167. .data1 : { *(.data1) }
  168. _edata = .; PROVIDE (edata = .);
  169. __bss_start = .;
  170. .bss :
  171. {
  172. *(.dynbss)
  173. *(.bss .bss.* .gnu.linkonce.b.*)
  174. *(COMMON)
  175. /* Align here to ensure that the .bss section occupies space up to
  176. _end. Align after .bss to ensure correct alignment even if the
  177. .bss section disappears because there are no input sections.
  178. FIXME: Why do we need it? When there is no .bss section, we don't
  179. pad the .data section. */
  180. . = ALIGN(. != 0 ? 32 / 8 : 1);
  181. }
  182. . = ALIGN(32 / 8);
  183. . = ALIGN(32 / 8);
  184. _end = .; PROVIDE (end = .);
  185. . = DATA_SEGMENT_END (.);
  186. /* Stabs debugging sections. */
  187. .stab 0 : { *(.stab) }
  188. .stabstr 0 : { *(.stabstr) }
  189. .stab.excl 0 : { *(.stab.excl) }
  190. .stab.exclstr 0 : { *(.stab.exclstr) }
  191. .stab.index 0 : { *(.stab.index) }
  192. .stab.indexstr 0 : { *(.stab.indexstr) }
  193. .comment 0 : { *(.comment) }
  194. /* DWARF debug sections.
  195. Symbols in the DWARF debugging sections are relative to the beginning
  196. of the section so we begin them at 0. */
  197. /* DWARF 1 */
  198. .debug 0 : { *(.debug) }
  199. .line 0 : { *(.line) }
  200. /* GNU DWARF 1 extensions */
  201. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  202. .debug_sfnames 0 : { *(.debug_sfnames) }
  203. /* DWARF 1.1 and DWARF 2 */
  204. .debug_aranges 0 : { *(.debug_aranges) }
  205. .debug_pubnames 0 : { *(.debug_pubnames) }
  206. /* DWARF 2 */
  207. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  208. .debug_abbrev 0 : { *(.debug_abbrev) }
  209. .debug_line 0 : { *(.debug_line) }
  210. .debug_frame 0 : { *(.debug_frame) }
  211. .debug_str 0 : { *(.debug_str) }
  212. .debug_loc 0 : { *(.debug_loc) }
  213. .debug_macinfo 0 : { *(.debug_macinfo) }
  214. /* SGI/MIPS DWARF 2 extensions */
  215. .debug_weaknames 0 : { *(.debug_weaknames) }
  216. .debug_funcnames 0 : { *(.debug_funcnames) }
  217. .debug_typenames 0 : { *(.debug_typenames) }
  218. .debug_varnames 0 : { *(.debug_varnames) }
  219. /* DWARF 3 */
  220. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  221. .debug_ranges 0 : { *(.debug_ranges) }
  222. .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  223. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  224. }