i386pep.xe 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. /* Script for -z separate-code */
  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(pei-x86-64)
  7. SEARCH_DIR("=/usr/local/lib/i386-linux-gnu"); SEARCH_DIR("=/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/lib/i386-linux-gnu"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); SEARCH_DIR("=/usr/x86_64-pep/lib");
  8. SECTIONS
  9. {
  10. /* Make the virtual address and file offset synced if the alignment is
  11. lower than the target page size. */
  12. . = SIZEOF_HEADERS;
  13. . = ALIGN(__section_alignment__);
  14. .text __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) :
  15. {
  16. KEEP (*(SORT_NONE(.init)))
  17. *(.text)
  18. *(SORT(.text$*))
  19. *(.text.*)
  20. *(.gnu.linkonce.t.*)
  21. *(.glue_7t)
  22. *(.glue_7)
  23. . = ALIGN(8);
  24. /* Note: we always define __CTOR_LIST__ and ___CTOR_LIST__ here,
  25. we do not PROVIDE them. This is because the ctors.o startup
  26. code in libgcc defines them as common symbols, with the
  27. expectation that they will be overridden by the definitions
  28. here. If we PROVIDE the symbols then they will not be
  29. overridden and global constructors will not be run.
  30. See PR 22762 for more details.
  31. This does mean that it is not possible for a user to define
  32. their own __CTOR_LIST__ and __DTOR_LIST__ symbols; if they do,
  33. the content from those variables are included but the symbols
  34. defined here silently take precedence. If they truly need to
  35. be redefined, a custom linker script will have to be used.
  36. (The custom script can just be a copy of this script with the
  37. PROVIDE() qualifiers added).
  38. In particular this means that ld -Ur does not work, because
  39. the proper __CTOR_LIST__ set by ld -Ur is overridden by a
  40. bogus __CTOR_LIST__ set by the final link. See PR 46. */
  41. ___CTOR_LIST__ = .;
  42. __CTOR_LIST__ = .;
  43. LONG (-1); LONG (-1);
  44. KEEP (*(.ctors));
  45. KEEP (*(.ctor));
  46. KEEP (*(SORT_BY_NAME(.ctors.*)));
  47. LONG (0); LONG (0);
  48. /* See comment about __CTOR_LIST__ above. The same reasoning
  49. applies here too. */
  50. ___DTOR_LIST__ = .;
  51. __DTOR_LIST__ = .;
  52. LONG (-1); LONG (-1);
  53. KEEP (*(.dtors));
  54. KEEP (*(.dtor));
  55. KEEP (*(SORT_BY_NAME(.dtors.*)));
  56. LONG (0); LONG (0);
  57. KEEP (*(SORT_NONE(.fini)))
  58. /* ??? Why is .gcc_exc here? */
  59. *(.gcc_exc)
  60. PROVIDE (etext = .);
  61. KEEP (*(.gcc_except_table))
  62. }
  63. /* The Cygwin32 library uses a section to avoid copying certain data
  64. on fork. This used to be named ".data". The linker used
  65. to include this between __data_start__ and __data_end__, but that
  66. breaks building the cygwin32 dll. Instead, we name the section
  67. ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
  68. .data BLOCK(__section_alignment__) :
  69. {
  70. __data_start__ = . ;
  71. *(.data)
  72. *(.data2)
  73. *(SORT(.data$*))
  74. KEEP(*(.jcr))
  75. __data_end__ = . ;
  76. *(.data_cygwin_nocopy)
  77. }
  78. .rdata BLOCK(__section_alignment__) :
  79. {
  80. *(.rdata)
  81. *(SORT(.rdata$*))
  82. . = ALIGN(4);
  83. __rt_psrelocs_start = .;
  84. KEEP(*(.rdata_runtime_pseudo_reloc))
  85. __rt_psrelocs_end = .;
  86. }
  87. __rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;
  88. ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
  89. __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
  90. ___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
  91. __RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;
  92. .eh_frame BLOCK(__section_alignment__) :
  93. {
  94. KEEP (*(.eh_frame*))
  95. }
  96. .pdata BLOCK(__section_alignment__) :
  97. {
  98. KEEP(*(.pdata*))
  99. }
  100. .xdata BLOCK(__section_alignment__) :
  101. {
  102. KEEP(*(.xdata*))
  103. }
  104. .bss BLOCK(__section_alignment__) :
  105. {
  106. __bss_start__ = . ;
  107. *(.bss)
  108. *(COMMON)
  109. __bss_end__ = . ;
  110. }
  111. .edata BLOCK(__section_alignment__) :
  112. {
  113. *(.edata)
  114. }
  115. /DISCARD/ :
  116. {
  117. *(.debug$S)
  118. *(.debug$T)
  119. *(.debug$F)
  120. *(.drectve)
  121. *(.note.GNU-stack)
  122. *(.gnu.lto_*)
  123. }
  124. .idata BLOCK(__section_alignment__) :
  125. {
  126. /* This cannot currently be handled with grouped sections.
  127. See pep.em:sort_sections. */
  128. KEEP (SORT(*)(.idata$2))
  129. KEEP (SORT(*)(.idata$3))
  130. /* These zeroes mark the end of the import list. */
  131. LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
  132. KEEP (SORT(*)(.idata$4))
  133. __IAT_start__ = .;
  134. SORT(*)(.idata$5)
  135. __IAT_end__ = .;
  136. KEEP (SORT(*)(.idata$6))
  137. KEEP (SORT(*)(.idata$7))
  138. }
  139. .CRT BLOCK(__section_alignment__) :
  140. {
  141. ___crt_xc_start__ = . ;
  142. KEEP (*(SORT(.CRT$XC*))) /* C initialization */
  143. ___crt_xc_end__ = . ;
  144. ___crt_xi_start__ = . ;
  145. KEEP (*(SORT(.CRT$XI*))) /* C++ initialization */
  146. ___crt_xi_end__ = . ;
  147. ___crt_xl_start__ = . ;
  148. KEEP (*(SORT(.CRT$XL*))) /* TLS callbacks */
  149. /* ___crt_xl_end__ is defined in the TLS Directory support code */
  150. ___crt_xp_start__ = . ;
  151. KEEP (*(SORT(.CRT$XP*))) /* Pre-termination */
  152. ___crt_xp_end__ = . ;
  153. ___crt_xt_start__ = . ;
  154. KEEP (*(SORT(.CRT$XT*))) /* Termination */
  155. ___crt_xt_end__ = . ;
  156. }
  157. /* Windows TLS expects .tls$AAA to be at the start and .tls$ZZZ to be
  158. at the end of the .tls section. This is important because _tls_start MUST
  159. be at the beginning of the section to enable SECREL32 relocations with TLS
  160. data. */
  161. .tls BLOCK(__section_alignment__) :
  162. {
  163. ___tls_start__ = . ;
  164. KEEP (*(.tls$AAA))
  165. KEEP (*(.tls))
  166. KEEP (*(.tls$))
  167. KEEP (*(SORT(.tls$*)))
  168. KEEP (*(.tls$ZZZ))
  169. ___tls_end__ = . ;
  170. }
  171. .endjunk BLOCK(__section_alignment__) :
  172. {
  173. /* end is deprecated, don't use it */
  174. PROVIDE (end = .);
  175. PROVIDE ( _end = .);
  176. __end__ = .;
  177. }
  178. .rsrc BLOCK(__section_alignment__) : SUBALIGN(4)
  179. {
  180. KEEP (*(.rsrc))
  181. KEEP (*(.rsrc$*))
  182. }
  183. .reloc BLOCK(__section_alignment__) :
  184. {
  185. *(.reloc)
  186. }
  187. .stab BLOCK(__section_alignment__) (NOLOAD) :
  188. {
  189. *(.stab)
  190. }
  191. .stabstr BLOCK(__section_alignment__) (NOLOAD) :
  192. {
  193. *(.stabstr)
  194. }
  195. /* DWARF debug sections.
  196. Symbols in the DWARF debugging sections are relative to the beginning
  197. of the section. Unlike other targets that fake this by putting the
  198. section VMA at 0, the PE format will not allow it. */
  199. /* DWARF 1.1 and DWARF 2. */
  200. .debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
  201. {
  202. *(.debug_aranges)
  203. }
  204. .zdebug_aranges BLOCK(__section_alignment__) (NOLOAD) :
  205. {
  206. *(.zdebug_aranges)
  207. }
  208. .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
  209. {
  210. *(.debug_pubnames)
  211. }
  212. .zdebug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
  213. {
  214. *(.zdebug_pubnames)
  215. }
  216. .debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
  217. {
  218. *(.debug_pubtypes)
  219. }
  220. .zdebug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
  221. {
  222. *(.zdebug_pubtypes)
  223. }
  224. /* DWARF 2. */
  225. .debug_info BLOCK(__section_alignment__) (NOLOAD) :
  226. {
  227. *(.debug_info .gnu.linkonce.wi.*)
  228. }
  229. .zdebug_info BLOCK(__section_alignment__) (NOLOAD) :
  230. {
  231. *(.zdebug_info .zdebug.gnu.linkonce.wi.*)
  232. }
  233. .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
  234. {
  235. *(.debug_abbrev)
  236. }
  237. .zdebug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
  238. {
  239. *(.zdebug_abbrev)
  240. }
  241. .debug_line BLOCK(__section_alignment__) (NOLOAD) :
  242. {
  243. *(.debug_line)
  244. }
  245. .zdebug_line BLOCK(__section_alignment__) (NOLOAD) :
  246. {
  247. *(.zdebug_line)
  248. }
  249. .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
  250. {
  251. *(.debug_frame)
  252. }
  253. .zdebug_frame BLOCK(__section_alignment__) (NOLOAD) :
  254. {
  255. *(.zdebug_frame)
  256. }
  257. .debug_str BLOCK(__section_alignment__) (NOLOAD) :
  258. {
  259. *(.debug_str)
  260. }
  261. .zdebug_str BLOCK(__section_alignment__) (NOLOAD) :
  262. {
  263. *(.zdebug_str)
  264. }
  265. .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
  266. {
  267. *(.debug_loc)
  268. }
  269. .zdebug_loc BLOCK(__section_alignment__) (NOLOAD) :
  270. {
  271. *(.zdebug_loc)
  272. }
  273. .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
  274. {
  275. *(.debug_macinfo)
  276. }
  277. .zdebug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
  278. {
  279. *(.zdebug_macinfo)
  280. }
  281. /* SGI/MIPS DWARF 2 extensions. */
  282. .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
  283. {
  284. *(.debug_weaknames)
  285. }
  286. .zdebug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
  287. {
  288. *(.zdebug_weaknames)
  289. }
  290. .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
  291. {
  292. *(.debug_funcnames)
  293. }
  294. .zdebug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
  295. {
  296. *(.zdebug_funcnames)
  297. }
  298. .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
  299. {
  300. *(.debug_typenames)
  301. }
  302. .zdebug_typenames BLOCK(__section_alignment__) (NOLOAD) :
  303. {
  304. *(.zdebug_typenames)
  305. }
  306. .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
  307. {
  308. *(.debug_varnames)
  309. }
  310. .zdebug_varnames BLOCK(__section_alignment__) (NOLOAD) :
  311. {
  312. *(.zdebug_varnames)
  313. }
  314. .debug_macro BLOCK(__section_alignment__) (NOLOAD) :
  315. {
  316. *(.debug_macro)
  317. }
  318. .zdebug_macro BLOCK(__section_alignment__) (NOLOAD) :
  319. {
  320. *(.zdebug_macro)
  321. }
  322. /* DWARF 3. */
  323. .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
  324. {
  325. *(.debug_ranges)
  326. }
  327. .zdebug_ranges BLOCK(__section_alignment__) (NOLOAD) :
  328. {
  329. *(.zdebug_ranges)
  330. }
  331. /* DWARF 4. */
  332. .debug_types BLOCK(__section_alignment__) (NOLOAD) :
  333. {
  334. *(.debug_types .gnu.linkonce.wt.*)
  335. }
  336. .zdebug_types BLOCK(__section_alignment__) (NOLOAD) :
  337. {
  338. *(.zdebug_types .zdebug.gnu.linkonce.wt.*)
  339. }
  340. /* For Go and Rust. */
  341. .debug_gdb_scripts BLOCK(__section_alignment__) (NOLOAD) :
  342. {
  343. *(.debug_gdb_scripts)
  344. }
  345. .zdebug_gdb_scripts BLOCK(__section_alignment__) (NOLOAD) :
  346. {
  347. *(.zdebug_gdb_scripts)
  348. }
  349. }