elf32ltsmip.xsc 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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-tradlittlemips", "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. . = 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. .text :
  79. {
  80. _ftext = . ;
  81. *(.text.unlikely .text.*_unlikely .text.unlikely.*)
  82. *(.text.exit .text.exit.*)
  83. *(.text.startup .text.startup.*)
  84. *(.text.hot .text.hot.*)
  85. *(.text .stub .text.* .gnu.linkonce.t.*)
  86. /* .gnu.warning sections are handled specially by elf32.em. */
  87. *(.gnu.warning)
  88. *(.mips16.fn.*) *(.mips16.call.*)
  89. }
  90. .fini :
  91. {
  92. KEEP (*(SORT_NONE(.fini)))
  93. }
  94. PROVIDE (__etext = .);
  95. PROVIDE (_etext = .);
  96. PROVIDE (etext = .);
  97. .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  98. .rodata1 : { *(.rodata1) }
  99. .eh_frame_hdr : { *(.eh_frame_hdr) }
  100. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  101. .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
  102. .gcc_except_table.*) }
  103. /* These sections are generated by the Sun/Oracle C++ compiler. */
  104. .exception_ranges : ONLY_IF_RO { *(.exception_ranges
  105. .exception_ranges*) }
  106. .plt : { *(.plt) }
  107. .iplt : { *(.iplt) }
  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. .got.plt : { *(.got.plt) }
  165. .data :
  166. {
  167. _fdata = . ;
  168. *(.data .data.* .gnu.linkonce.d.*)
  169. SORT(CONSTRUCTORS)
  170. }
  171. .data1 : { *(.data1) }
  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. _edata = .; PROVIDE (edata = .);
  187. . = .;
  188. __bss_start = .;
  189. _fbss = .;
  190. .sbss :
  191. {
  192. *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
  193. *(.dynsbss)
  194. *(.sbss .sbss.* .gnu.linkonce.sb.*)
  195. *(.scommon)
  196. }
  197. .bss :
  198. {
  199. *(.dynbss)
  200. *(.bss .bss.* .gnu.linkonce.b.*)
  201. *(COMMON)
  202. /* Align here to ensure that the .bss section occupies space up to
  203. _end. Align after .bss to ensure correct alignment even if the
  204. .bss section disappears because there are no input sections.
  205. FIXME: Why do we need it? When there is no .bss section, we don't
  206. pad the .data section. */
  207. . = ALIGN(. != 0 ? 32 / 8 : 1);
  208. }
  209. . = ALIGN(32 / 8);
  210. . = SEGMENT_START("ldata-segment", .);
  211. . = ALIGN(32 / 8);
  212. _end = .; PROVIDE (end = .);
  213. . = DATA_SEGMENT_END (.);
  214. /* Stabs debugging sections. */
  215. .stab 0 : { *(.stab) }
  216. .stabstr 0 : { *(.stabstr) }
  217. .stab.excl 0 : { *(.stab.excl) }
  218. .stab.exclstr 0 : { *(.stab.exclstr) }
  219. .stab.index 0 : { *(.stab.index) }
  220. .stab.indexstr 0 : { *(.stab.indexstr) }
  221. .comment 0 : { *(.comment) }
  222. /* DWARF debug sections.
  223. Symbols in the DWARF debugging sections are relative to the beginning
  224. of the section so we begin them at 0. */
  225. /* DWARF 1 */
  226. .debug 0 : { *(.debug) }
  227. .line 0 : { *(.line) }
  228. /* GNU DWARF 1 extensions */
  229. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  230. .debug_sfnames 0 : { *(.debug_sfnames) }
  231. /* DWARF 1.1 and DWARF 2 */
  232. .debug_aranges 0 : { *(.debug_aranges) }
  233. .debug_pubnames 0 : { *(.debug_pubnames) }
  234. /* DWARF 2 */
  235. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  236. .debug_abbrev 0 : { *(.debug_abbrev) }
  237. .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
  238. .debug_frame 0 : { *(.debug_frame) }
  239. .debug_str 0 : { *(.debug_str) }
  240. .debug_loc 0 : { *(.debug_loc) }
  241. .debug_macinfo 0 : { *(.debug_macinfo) }
  242. /* SGI/MIPS DWARF 2 extensions */
  243. .debug_weaknames 0 : { *(.debug_weaknames) }
  244. .debug_funcnames 0 : { *(.debug_funcnames) }
  245. .debug_typenames 0 : { *(.debug_typenames) }
  246. .debug_varnames 0 : { *(.debug_varnames) }
  247. /* DWARF 3 */
  248. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  249. .debug_ranges 0 : { *(.debug_ranges) }
  250. /* DWARF Extension. */
  251. .debug_macro 0 : { *(.debug_macro) }
  252. .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  253. .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  254. .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
  255. .mdebug.abi32 0 : { KEEP(*(.mdebug.abi32)) }
  256. .mdebug.abiN32 0 : { KEEP(*(.mdebug.abiN32)) }
  257. .mdebug.abi64 0 : { KEEP(*(.mdebug.abi64)) }
  258. .mdebug.abiO64 0 : { KEEP(*(.mdebug.abiO64)) }
  259. .mdebug.eabi32 0 : { KEEP(*(.mdebug.eabi32)) }
  260. .mdebug.eabi64 0 : { KEEP(*(.mdebug.eabi64)) }
  261. .gcc_compiled_long32 0 : { KEEP(*(.gcc_compiled_long32)) }
  262. .gcc_compiled_long64 0 : { KEEP(*(.gcc_compiled_long64)) }
  263. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  264. }