i386pe.xu 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. /* Script for -Ur */
  2. /* Copyright (C) 2014-2020 Free Software Foundation, Inc.
  3. Copying and distribution of this script, with or without modification,
  4. are permitted in any medium without royalty provided the copyright
  5. notice and this notice are preserved. */
  6. OUTPUT_FORMAT(pe-i386)
  7. SEARCH_DIR("=/usr/x86_64-pep/lib");
  8. SECTIONS
  9. {
  10. .text :
  11. {
  12. *(.text)
  13. /* Note: we always define __CTOR_LIST__ and ___CTOR_LIST__ here,
  14. we do not PROVIDE them. This is because the ctors.o startup
  15. code in libgcc defines them as common symbols, with the
  16. expectation that they will be overridden by the definitions
  17. here. If we PROVIDE the symbols then they will not be
  18. overridden and global constructors will not be run.
  19. See PR 22762 for more details.
  20. This does mean that it is not possible for a user to define
  21. their own __CTOR_LIST__ and __DTOR_LIST__ symbols; if they do,
  22. the content from those variables are included but the symbols
  23. defined here silently take precedence. If they truly need to
  24. be redefined, a custom linker script will have to be used.
  25. (The custom script can just be a copy of this script with the
  26. PROVIDE() qualifiers added).
  27. In particular this means that ld -Ur does not work, because
  28. the proper __CTOR_LIST__ set by ld -Ur is overridden by a
  29. bogus __CTOR_LIST__ set by the final link. See PR 46. */
  30. ___CTOR_LIST__ = .;
  31. __CTOR_LIST__ = .;
  32. LONG (-1);
  33. KEEP(*(.ctors));
  34. KEEP(*(.ctor));
  35. KEEP(*(SORT_BY_NAME(.ctors.*)));
  36. LONG (0);
  37. /* See comment about __CTOR_LIST__ above. The same reasoning
  38. applies here too. */
  39. ___DTOR_LIST__ = .;
  40. __DTOR_LIST__ = .;
  41. LONG (-1);
  42. KEEP(*(.dtors));
  43. KEEP(*(.dtor));
  44. KEEP(*(SORT_BY_NAME(.dtors.*)));
  45. LONG (0);
  46. }
  47. /* The Cygwin32 library uses a section to avoid copying certain data
  48. on fork. This used to be named ".data". The linker used
  49. to include this between __data_start__ and __data_end__, but that
  50. breaks building the cygwin32 dll. Instead, we name the section
  51. ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
  52. .data :
  53. {
  54. *(.data)
  55. KEEP(*(.jcr))
  56. }
  57. .rdata :
  58. {
  59. *(.rdata)
  60. . = ALIGN(4);
  61. }
  62. .eh_frame :
  63. {
  64. KEEP(*(.eh_frame))
  65. }
  66. .pdata :
  67. {
  68. KEEP(*(.pdata))
  69. }
  70. .bss :
  71. {
  72. *(.bss)
  73. *(COMMON)
  74. }
  75. .edata :
  76. {
  77. *(.edata)
  78. }
  79. /DISCARD/ :
  80. {
  81. *(.debug$S)
  82. *(.debug$T)
  83. *(.debug$F)
  84. *(.drectve)
  85. }
  86. .idata :
  87. {
  88. /* This cannot currently be handled with grouped sections.
  89. See pe.em:sort_sections. */
  90. }
  91. .CRT :
  92. {
  93. /* ___crt_xl_end__ is defined in the TLS Directory support code */
  94. }
  95. /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be
  96. at the end of section. This is important because _tls_start MUST
  97. be at the beginning of the section to enable SECREL32 relocations with TLS
  98. data. */
  99. .tls :
  100. {
  101. *(.tls)
  102. }
  103. .endjunk :
  104. {
  105. /* end is deprecated, don't use it */
  106. }
  107. .rsrc : SUBALIGN(4)
  108. {
  109. *(.rsrc)
  110. }
  111. .reloc :
  112. {
  113. *(.reloc)
  114. }
  115. .stab :
  116. {
  117. *(.stab)
  118. }
  119. .stabstr :
  120. {
  121. *(.stabstr)
  122. }
  123. /* DWARF debug sections.
  124. Symbols in the DWARF debugging sections are relative to the beginning
  125. of the section. Unlike other targets that fake this by putting the
  126. section VMA at 0, the PE format will not allow it. */
  127. /* DWARF 1.1 and DWARF 2. */
  128. .debug_aranges :
  129. {
  130. *(.debug_aranges)
  131. }
  132. .zdebug_aranges :
  133. {
  134. *(.zdebug_aranges)
  135. }
  136. .debug_pubnames :
  137. {
  138. *(.debug_pubnames)
  139. }
  140. .zdebug_pubnames :
  141. {
  142. *(.zdebug_pubnames)
  143. }
  144. .debug_pubtypes :
  145. {
  146. *(.debug_pubtypes)
  147. }
  148. .zdebug_pubtypes :
  149. {
  150. *(.zdebug_pubtypes)
  151. }
  152. /* DWARF 2. */
  153. .debug_info :
  154. {
  155. *(.debug_info)
  156. }
  157. .zdebug_info :
  158. {
  159. *(.zdebug_info)
  160. }
  161. .debug_abbrev :
  162. {
  163. *(.debug_abbrev)
  164. }
  165. .zdebug_abbrev :
  166. {
  167. *(.zdebug_abbrev)
  168. }
  169. .debug_line :
  170. {
  171. *(.debug_line)
  172. }
  173. .zdebug_line :
  174. {
  175. *(.zdebug_line)
  176. }
  177. .debug_frame :
  178. {
  179. *(.debug_frame*)
  180. }
  181. .zdebug_frame :
  182. {
  183. *(.zdebug_frame*)
  184. }
  185. .debug_str :
  186. {
  187. *(.debug_str)
  188. }
  189. .zdebug_str :
  190. {
  191. *(.zdebug_str)
  192. }
  193. .debug_loc :
  194. {
  195. *(.debug_loc)
  196. }
  197. .zdebug_loc :
  198. {
  199. *(.zdebug_loc)
  200. }
  201. .debug_macinfo :
  202. {
  203. *(.debug_macinfo)
  204. }
  205. .zdebug_macinfo :
  206. {
  207. *(.zdebug_macinfo)
  208. }
  209. /* SGI/MIPS DWARF 2 extensions. */
  210. .debug_weaknames :
  211. {
  212. *(.debug_weaknames)
  213. }
  214. .zdebug_weaknames :
  215. {
  216. *(.zdebug_weaknames)
  217. }
  218. .debug_funcnames :
  219. {
  220. *(.debug_funcnames)
  221. }
  222. .zdebug_funcnames :
  223. {
  224. *(.zdebug_funcnames)
  225. }
  226. .debug_typenames :
  227. {
  228. *(.debug_typenames)
  229. }
  230. .zdebug_typenames :
  231. {
  232. *(.zdebug_typenames)
  233. }
  234. .debug_varnames :
  235. {
  236. *(.debug_varnames)
  237. }
  238. .zdebug_varnames :
  239. {
  240. *(.zdebug_varnames)
  241. }
  242. .debug_macro :
  243. {
  244. *(.debug_macro)
  245. }
  246. .zdebug_macro :
  247. {
  248. *(.zdebug_macro)
  249. }
  250. /* DWARF 3. */
  251. .debug_ranges :
  252. {
  253. *(.debug_ranges)
  254. }
  255. .zdebug_ranges :
  256. {
  257. *(.zdebug_ranges)
  258. }
  259. /* DWARF 4. */
  260. .debug_types :
  261. {
  262. *(.debug_types)
  263. }
  264. .zdebug_types :
  265. {
  266. *(.zdebug_types)
  267. }
  268. /* For Go and Rust. */
  269. .debug_gdb_scripts :
  270. {
  271. *(.debug_gdb_scripts)
  272. }
  273. .zdebug_gdb_scripts :
  274. {
  275. *(.zdebug_gdb_scripts)
  276. }
  277. }