shlelf_fd.xwe 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /* Script for -z combreloc -z separate-code -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("elf32-sh-fdpic", "elf32-sh-fdpic",
  7. "elf32-sh-fdpic")
  8. OUTPUT_ARCH(sh)
  9. ENTRY(_start)
  10. SEARCH_DIR("=/usr/sh4-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.got.funcdesc)
  36. *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
  37. *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
  38. *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
  39. *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
  40. *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
  41. PROVIDE_HIDDEN (__rela_iplt_start = .);
  42. *(.rela.iplt)
  43. PROVIDE_HIDDEN (__rela_iplt_end = .);
  44. }
  45. .rela.plt :
  46. {
  47. *(.rela.plt)
  48. }
  49. . = ALIGN(CONSTANT (MAXPAGESIZE));
  50. .init :
  51. {
  52. KEEP (*(SORT_NONE(.init)))
  53. }
  54. .plt : { *(.plt) }
  55. .iplt : { *(.iplt) }
  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. .sdata2 :
  81. {
  82. *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
  83. }
  84. .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
  85. .rofixup : {
  86. __ROFIXUP_LIST__ = .;
  87. *(.rofixup)
  88. __ROFIXUP_END__ = .;
  89. }
  90. .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
  91. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  92. .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
  93. .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) }
  94. /* These sections are generated by the Sun/Oracle C++ compiler. */
  95. .exception_ranges : ONLY_IF_RO { *(.exception_ranges*) }
  96. /* Adjust the address for the data segment. We want to adjust up to
  97. the same address within the page on the next page up. */
  98. . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
  99. /* Exception handling */
  100. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  101. .gnu_extab : ONLY_IF_RW { *(.gnu_extab) }
  102. .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  103. .exception_ranges : ONLY_IF_RW { *(.exception_ranges*) }
  104. /* Thread Local Storage sections */
  105. .tdata :
  106. {
  107. PROVIDE_HIDDEN (__tdata_start = .);
  108. *(.tdata .tdata.* .gnu.linkonce.td.*)
  109. }
  110. .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  111. .preinit_array :
  112. {
  113. PROVIDE_HIDDEN (__preinit_array_start = .);
  114. KEEP (*(.preinit_array))
  115. PROVIDE_HIDDEN (__preinit_array_end = .);
  116. }
  117. .init_array :
  118. {
  119. PROVIDE_HIDDEN (__init_array_start = .);
  120. KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
  121. KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
  122. PROVIDE_HIDDEN (__init_array_end = .);
  123. }
  124. .fini_array :
  125. {
  126. PROVIDE_HIDDEN (__fini_array_start = .);
  127. KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
  128. KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
  129. PROVIDE_HIDDEN (__fini_array_end = .);
  130. }
  131. .ctors :
  132. {
  133. /* gcc uses crtbegin.o to find the start of
  134. the constructors, so we make sure it is
  135. first. Because this is a wildcard, it
  136. doesn't matter if the user does not
  137. actually link against crtbegin.o; the
  138. linker won't look for a file to match a
  139. wildcard. The wildcard also means that it
  140. doesn't matter which directory crtbegin.o
  141. is in. */
  142. KEEP (*crtbegin.o(.ctors))
  143. KEEP (*crtbegin?.o(.ctors))
  144. /* We don't want to include the .ctor section from
  145. the crtend.o file until after the sorted ctors.
  146. The .ctor section from the crtend file contains the
  147. end of ctors marker and it must be last */
  148. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  149. KEEP (*(SORT(.ctors.*)))
  150. KEEP (*(.ctors))
  151. }
  152. .dtors :
  153. {
  154. KEEP (*crtbegin.o(.dtors))
  155. KEEP (*crtbegin?.o(.dtors))
  156. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  157. KEEP (*(SORT(.dtors.*)))
  158. KEEP (*(.dtors))
  159. }
  160. .jcr : { KEEP (*(.jcr)) }
  161. .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
  162. .dynamic : { *(.dynamic) }
  163. . = DATA_SEGMENT_RELRO_END (0, .);
  164. .data :
  165. {
  166. PROVIDE (__data_start = .);
  167. *(.data .data.* .gnu.linkonce.d.*)
  168. SORT(CONSTRUCTORS)
  169. }
  170. .data1 : { *(.data1) }
  171. .note.ABI-tag : { *(.note.ABI-tag) }
  172. .got : { *(.got.funcdesc) *(.got.plt) *(.got) }
  173. /* We want the small data sections together, so single-instruction offsets
  174. can access them all, and initialized data all before uninitialized, so
  175. we can shorten the on-disk segment size. */
  176. .sdata :
  177. {
  178. *(.sdata .sdata.* .gnu.linkonce.s.*)
  179. }
  180. _edata = .; PROVIDE (edata = .);
  181. . = .;
  182. __bss_start = .;
  183. .sbss :
  184. {
  185. *(.dynsbss)
  186. *(.sbss .sbss.* .gnu.linkonce.sb.*)
  187. *(.scommon)
  188. }
  189. .bss :
  190. {
  191. *(.dynbss)
  192. *(.bss .bss.* .gnu.linkonce.b.*)
  193. *(COMMON)
  194. /* Align here to ensure that the .bss section occupies space up to
  195. _end. Align after .bss to ensure correct alignment even if the
  196. .bss section disappears because there are no input sections.
  197. FIXME: Why do we need it? When there is no .bss section, we do not
  198. pad the .data section. */
  199. . = ALIGN(. != 0 ? 32 / 8 : 1);
  200. }
  201. . = ALIGN(32 / 8);
  202. . = SEGMENT_START("ldata-segment", .);
  203. . = ALIGN(32 / 8);
  204. _end = .; PROVIDE (end = .);
  205. . = DATA_SEGMENT_END (.);
  206. /* Stabs debugging sections. */
  207. .stab 0 : { *(.stab) }
  208. .stabstr 0 : { *(.stabstr) }
  209. .stab.excl 0 : { *(.stab.excl) }
  210. .stab.exclstr 0 : { *(.stab.exclstr) }
  211. .stab.index 0 : { *(.stab.index) }
  212. .stab.indexstr 0 : { *(.stab.indexstr) }
  213. .comment 0 : { *(.comment) }
  214. .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
  215. /* DWARF debug sections.
  216. Symbols in the DWARF debugging sections are relative to the beginning
  217. of the section so we begin them at 0. */
  218. /* DWARF 1 */
  219. .debug 0 : { *(.debug) }
  220. .line 0 : { *(.line) }
  221. /* GNU DWARF 1 extensions */
  222. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  223. .debug_sfnames 0 : { *(.debug_sfnames) }
  224. /* DWARF 1.1 and DWARF 2 */
  225. .debug_aranges 0 : { *(.debug_aranges) }
  226. .debug_pubnames 0 : { *(.debug_pubnames) }
  227. /* DWARF 2 */
  228. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  229. .debug_abbrev 0 : { *(.debug_abbrev) }
  230. .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) }
  231. .debug_frame 0 : { *(.debug_frame) }
  232. .debug_str 0 : { *(.debug_str) }
  233. .debug_loc 0 : { *(.debug_loc) }
  234. .debug_macinfo 0 : { *(.debug_macinfo) }
  235. /* SGI/MIPS DWARF 2 extensions */
  236. .debug_weaknames 0 : { *(.debug_weaknames) }
  237. .debug_funcnames 0 : { *(.debug_funcnames) }
  238. .debug_typenames 0 : { *(.debug_typenames) }
  239. .debug_varnames 0 : { *(.debug_varnames) }
  240. /* DWARF 3 */
  241. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  242. .debug_ranges 0 : { *(.debug_ranges) }
  243. /* DWARF Extension. */
  244. .debug_macro 0 : { *(.debug_macro) }
  245. .debug_addr 0 : { *(.debug_addr) }
  246. .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  247. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  248. }