elf32btsmip.xc 10 KB

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