shlelf_fd.xc 8.7 KB

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