elf32ppcsim.xdwe 9.2 KB

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