ldscript.i386 7.5 KB

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