elf32btsmipn32.xsc 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /* Script for --shared -z combreloc: shared library, combine & sort relocs */
  2. /* Copyright (C) 2014 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-ntradbigmips", "elf32-ntradbigmips",
  7. "elf32-ntradlittlemips")
  8. OUTPUT_ARCH(mips)
  9. ENTRY(__start)
  10. SEARCH_DIR("=/srv/openwrt/ar71xx/build/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/mips-openwrt-linux-musl/lib32"); SEARCH_DIR("=/usr/local/lib32"); SEARCH_DIR("=/lib32"); SEARCH_DIR("=/usr/lib32"); SEARCH_DIR("=/srv/openwrt/ar71xx/build/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/mips-openwrt-linux-musl/lib"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
  11. SECTIONS
  12. {
  13. /* Read-only sections, merged into text segment: */
  14. . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
  15. .MIPS.abiflags : { *(.MIPS.abiflags) }
  16. .reginfo : { *(.reginfo) }
  17. .note.gnu.build-id : { *(.note.gnu.build-id) }
  18. .dynamic : { *(.dynamic) }
  19. .hash : { *(.hash) }
  20. .gnu.hash : { *(.gnu.hash) }
  21. .dynsym : { *(.dynsym) }
  22. .dynstr : { *(.dynstr) }
  23. .gnu.version : { *(.gnu.version) }
  24. .gnu.version_d : { *(.gnu.version_d) }
  25. .gnu.version_r : { *(.gnu.version_r) }
  26. .rel.dyn :
  27. {
  28. *(.rel.init)
  29. *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
  30. *(.rel.fini)
  31. *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
  32. *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
  33. *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
  34. *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
  35. *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
  36. *(.rel.ctors)
  37. *(.rel.dtors)
  38. *(.rel.got)
  39. *(.rel.dyn)
  40. *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
  41. *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
  42. *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
  43. *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
  44. *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
  45. *(.rel.iplt)
  46. }
  47. .rela.dyn :
  48. {
  49. *(.rela.init)
  50. *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
  51. *(.rela.fini)
  52. *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
  53. *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
  54. *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
  55. *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
  56. *(.rela.ctors)
  57. *(.rela.dtors)
  58. *(.rela.got)
  59. *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
  60. *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
  61. *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
  62. *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
  63. *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
  64. *(.rela.iplt)
  65. }
  66. .rel.plt :
  67. {
  68. *(.rel.plt)
  69. }
  70. .rela.plt :
  71. {
  72. *(.rela.plt)
  73. }
  74. .init :
  75. {
  76. KEEP (*(SORT_NONE(.init)))
  77. }
  78. .plt : { *(.plt) }
  79. .iplt : { *(.iplt) }
  80. .text :
  81. {
  82. _ftext = . ;
  83. *(.text.unlikely .text.*_unlikely .text.unlikely.*)
  84. *(.text.exit .text.exit.*)
  85. *(.text.startup .text.startup.*)
  86. *(.text.hot .text.hot.*)
  87. *(.text .stub .text.* .gnu.linkonce.t.*)
  88. /* .gnu.warning sections are handled specially by elf32.em. */
  89. *(.gnu.warning)
  90. *(.mips16.fn.*) *(.mips16.call.*)
  91. }
  92. .fini :
  93. {
  94. KEEP (*(SORT_NONE(.fini)))
  95. }
  96. PROVIDE (__etext = .);
  97. PROVIDE (_etext = .);
  98. PROVIDE (etext = .);
  99. .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  100. .rodata1 : { *(.rodata1) }
  101. .eh_frame_hdr : { *(.eh_frame_hdr) }
  102. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  103. .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
  104. .gcc_except_table.*) }
  105. /* These sections are generated by the Sun/Oracle C++ compiler. */
  106. .exception_ranges : ONLY_IF_RO { *(.exception_ranges
  107. .exception_ranges*) }
  108. /* Adjust the address for the data segment. We want to adjust up to
  109. the same address within the page on the next page up. */
  110. . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
  111. /* Exception handling */
  112. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  113. .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  114. .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
  115. /* Thread Local Storage sections */
  116. .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
  117. .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  118. .preinit_array :
  119. {
  120. KEEP (*(.preinit_array))
  121. }
  122. .init_array :
  123. {
  124. KEEP (*(SORT(.init_array.*)))
  125. KEEP (*(.init_array ))
  126. }
  127. .fini_array :
  128. {
  129. KEEP (*(SORT(.fini_array.*)))
  130. KEEP (*(.fini_array ))
  131. }
  132. .ctors :
  133. {
  134. /* gcc uses crtbegin.o to find the start of
  135. the constructors, so we make sure it is
  136. first. Because this is a wildcard, it
  137. doesn't matter if the user does not
  138. actually link against crtbegin.o; the
  139. linker won't look for a file to match a
  140. wildcard. The wildcard also means that it
  141. doesn't matter which directory crtbegin.o
  142. is in. */
  143. KEEP (*crtbegin.o(.ctors))
  144. KEEP (*crtbegin?.o(.ctors))
  145. /* We don't want to include the .ctor section from
  146. the crtend.o file until after the sorted ctors.
  147. The .ctor section from the crtend file contains the
  148. end of ctors marker and it must be last */
  149. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  150. KEEP (*(SORT(.ctors.*)))
  151. KEEP (*(.ctors))
  152. }
  153. .dtors :
  154. {
  155. KEEP (*crtbegin.o(.dtors))
  156. KEEP (*crtbegin?.o(.dtors))
  157. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  158. KEEP (*(SORT(.dtors.*)))
  159. KEEP (*(.dtors))
  160. }
  161. .jcr : { KEEP (*(.jcr)) }
  162. .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
  163. . = DATA_SEGMENT_RELRO_END (0, .);
  164. .data :
  165. {
  166. _fdata = . ;
  167. *(.data .data.* .gnu.linkonce.d.*)
  168. SORT(CONSTRUCTORS)
  169. }
  170. .data1 : { *(.data1) }
  171. .got.plt : { *(.got.plt) }
  172. . = .;
  173. . = .;
  174. HIDDEN (_gp = ALIGN (16) + 0x7ff0);
  175. .got : { *(.got) }
  176. /* We want the small data sections together, so single-instruction offsets
  177. can access them all, and initialized data all before uninitialized, so
  178. we can shorten the on-disk segment size. */
  179. .sdata :
  180. {
  181. *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
  182. *(.sdata .sdata.* .gnu.linkonce.s.*)
  183. }
  184. .lit8 : { *(.lit8) }
  185. .lit4 : { *(.lit4) }
  186. .srdata : { *(.srdata) }
  187. _edata = .; PROVIDE (edata = .);
  188. . = .;
  189. __bss_start = .;
  190. _fbss = .;
  191. .sbss :
  192. {
  193. *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
  194. *(.dynsbss)
  195. *(.sbss .sbss.* .gnu.linkonce.sb.*)
  196. *(.scommon)
  197. }
  198. .bss :
  199. {
  200. *(.dynbss)
  201. *(.bss .bss.* .gnu.linkonce.b.*)
  202. *(COMMON)
  203. /* Align here to ensure that the .bss section occupies space up to
  204. _end. Align after .bss to ensure correct alignment even if the
  205. .bss section disappears because there are no input sections.
  206. FIXME: Why do we need it? When there is no .bss section, we don't
  207. pad the .data section. */
  208. . = ALIGN(. != 0 ? 32 / 8 : 1);
  209. }
  210. . = ALIGN(32 / 8);
  211. . = SEGMENT_START("ldata-segment", .);
  212. . = ALIGN(32 / 8);
  213. _end = .; PROVIDE (end = .);
  214. . = DATA_SEGMENT_END (.);
  215. /* Stabs debugging sections. */
  216. .stab 0 : { *(.stab) }
  217. .stabstr 0 : { *(.stabstr) }
  218. .stab.excl 0 : { *(.stab.excl) }
  219. .stab.exclstr 0 : { *(.stab.exclstr) }
  220. .stab.index 0 : { *(.stab.index) }
  221. .stab.indexstr 0 : { *(.stab.indexstr) }
  222. .comment 0 : { *(.comment) }
  223. /* DWARF debug sections.
  224. Symbols in the DWARF debugging sections are relative to the beginning
  225. of the section so we begin them at 0. */
  226. /* DWARF 1 */
  227. .debug 0 : { *(.debug) }
  228. .line 0 : { *(.line) }
  229. /* GNU DWARF 1 extensions */
  230. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  231. .debug_sfnames 0 : { *(.debug_sfnames) }
  232. /* DWARF 1.1 and DWARF 2 */
  233. .debug_aranges 0 : { *(.debug_aranges) }
  234. .debug_pubnames 0 : { *(.debug_pubnames) }
  235. /* DWARF 2 */
  236. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  237. .debug_abbrev 0 : { *(.debug_abbrev) }
  238. .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
  239. .debug_frame 0 : { *(.debug_frame) }
  240. .debug_str 0 : { *(.debug_str) }
  241. .debug_loc 0 : { *(.debug_loc) }
  242. .debug_macinfo 0 : { *(.debug_macinfo) }
  243. /* SGI/MIPS DWARF 2 extensions */
  244. .debug_weaknames 0 : { *(.debug_weaknames) }
  245. .debug_funcnames 0 : { *(.debug_funcnames) }
  246. .debug_typenames 0 : { *(.debug_typenames) }
  247. .debug_varnames 0 : { *(.debug_varnames) }
  248. /* DWARF 3 */
  249. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  250. .debug_ranges 0 : { *(.debug_ranges) }
  251. /* DWARF Extension. */
  252. .debug_macro 0 : { *(.debug_macro) }
  253. .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  254. .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  255. .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
  256. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  257. }