elf32_x86_64.xce 9.0 KB

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