elf_x86_64.xsw 8.2 KB

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