shlelf_linux.xdc 8.7 KB

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