elf64ltsmip.xd 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. /* Script for ld -pie: link position independent executable */
  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("elf64-tradlittlemips", "elf64-tradbigmips",
  7. "elf64-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/lib64"); SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64"); 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", 0)); . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
  15. .MIPS.abiflags : { *(.MIPS.abiflags) }
  16. .MIPS.options : { *(.MIPS.options) }
  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.init : { *(.rel.init) }
  27. .rela.init : { *(.rela.init) }
  28. .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
  29. .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
  30. .rel.fini : { *(.rel.fini) }
  31. .rela.fini : { *(.rela.fini) }
  32. .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
  33. .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
  34. .rel.data.rel.ro : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) }
  35. .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
  36. .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
  37. .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
  38. .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
  39. .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
  40. .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
  41. .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
  42. .rel.ctors : { *(.rel.ctors) }
  43. .rela.ctors : { *(.rela.ctors) }
  44. .rel.dtors : { *(.rel.dtors) }
  45. .rela.dtors : { *(.rela.dtors) }
  46. .rel.got : { *(.rel.got) }
  47. .rela.got : { *(.rela.got) }
  48. .rel.dyn : { *(.rel.dyn) }
  49. .rel.sdata : { *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) }
  50. .rela.sdata : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
  51. .rel.sbss : { *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) }
  52. .rela.sbss : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
  53. .rel.sdata2 : { *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) }
  54. .rela.sdata2 : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
  55. .rel.sbss2 : { *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) }
  56. .rela.sbss2 : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
  57. .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
  58. .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
  59. .rel.iplt :
  60. {
  61. PROVIDE_HIDDEN (__rel_iplt_start = .);
  62. *(.rel.iplt)
  63. PROVIDE_HIDDEN (__rel_iplt_end = .);
  64. }
  65. .rela.iplt :
  66. {
  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. .plt : { *(.plt) }
  84. .iplt : { *(.iplt) }
  85. .text :
  86. {
  87. _ftext = . ;
  88. *(.text.unlikely .text.*_unlikely .text.unlikely.*)
  89. *(.text.exit .text.exit.*)
  90. *(.text.startup .text.startup.*)
  91. *(.text.hot .text.hot.*)
  92. *(.text .stub .text.* .gnu.linkonce.t.*)
  93. /* .gnu.warning sections are handled specially by elf32.em. */
  94. *(.gnu.warning)
  95. *(.mips16.fn.*) *(.mips16.call.*)
  96. }
  97. .fini :
  98. {
  99. KEEP (*(SORT_NONE(.fini)))
  100. }
  101. PROVIDE (__etext = .);
  102. PROVIDE (_etext = .);
  103. PROVIDE (etext = .);
  104. .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  105. .rodata1 : { *(.rodata1) }
  106. .sdata2 :
  107. {
  108. *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
  109. }
  110. .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
  111. .eh_frame_hdr : { *(.eh_frame_hdr) }
  112. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  113. .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
  114. .gcc_except_table.*) }
  115. /* These sections are generated by the Sun/Oracle C++ compiler. */
  116. .exception_ranges : ONLY_IF_RO { *(.exception_ranges
  117. .exception_ranges*) }
  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. .data :
  181. {
  182. _fdata = . ;
  183. *(.data .data.* .gnu.linkonce.d.*)
  184. SORT(CONSTRUCTORS)
  185. }
  186. .data1 : { *(.data1) }
  187. .got.plt : { *(.got.plt) }
  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. .srdata : { *(.srdata) }
  202. _edata = .; PROVIDE (edata = .);
  203. . = .;
  204. __bss_start = .;
  205. _fbss = .;
  206. .sbss :
  207. {
  208. *(.dynsbss)
  209. *(.sbss .sbss.* .gnu.linkonce.sb.*)
  210. *(.scommon)
  211. }
  212. .bss :
  213. {
  214. *(.dynbss)
  215. *(.bss .bss.* .gnu.linkonce.b.*)
  216. *(COMMON)
  217. /* Align here to ensure that the .bss section occupies space up to
  218. _end. Align after .bss to ensure correct alignment even if the
  219. .bss section disappears because there are no input sections.
  220. FIXME: Why do we need it? When there is no .bss section, we don't
  221. pad the .data section. */
  222. . = ALIGN(. != 0 ? 64 / 8 : 1);
  223. }
  224. . = ALIGN(64 / 8);
  225. . = SEGMENT_START("ldata-segment", .);
  226. . = ALIGN(64 / 8);
  227. _end = .; PROVIDE (end = .);
  228. . = DATA_SEGMENT_END (.);
  229. /* Stabs debugging sections. */
  230. .stab 0 : { *(.stab) }
  231. .stabstr 0 : { *(.stabstr) }
  232. .stab.excl 0 : { *(.stab.excl) }
  233. .stab.exclstr 0 : { *(.stab.exclstr) }
  234. .stab.index 0 : { *(.stab.index) }
  235. .stab.indexstr 0 : { *(.stab.indexstr) }
  236. .comment 0 : { *(.comment) }
  237. /* DWARF debug sections.
  238. Symbols in the DWARF debugging sections are relative to the beginning
  239. of the section so we begin them at 0. */
  240. /* DWARF 1 */
  241. .debug 0 : { *(.debug) }
  242. .line 0 : { *(.line) }
  243. /* GNU DWARF 1 extensions */
  244. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  245. .debug_sfnames 0 : { *(.debug_sfnames) }
  246. /* DWARF 1.1 and DWARF 2 */
  247. .debug_aranges 0 : { *(.debug_aranges) }
  248. .debug_pubnames 0 : { *(.debug_pubnames) }
  249. /* DWARF 2 */
  250. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  251. .debug_abbrev 0 : { *(.debug_abbrev) }
  252. .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
  253. .debug_frame 0 : { *(.debug_frame) }
  254. .debug_str 0 : { *(.debug_str) }
  255. .debug_loc 0 : { *(.debug_loc) }
  256. .debug_macinfo 0 : { *(.debug_macinfo) }
  257. /* SGI/MIPS DWARF 2 extensions */
  258. .debug_weaknames 0 : { *(.debug_weaknames) }
  259. .debug_funcnames 0 : { *(.debug_funcnames) }
  260. .debug_typenames 0 : { *(.debug_typenames) }
  261. .debug_varnames 0 : { *(.debug_varnames) }
  262. /* DWARF 3 */
  263. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  264. .debug_ranges 0 : { *(.debug_ranges) }
  265. /* DWARF Extension. */
  266. .debug_macro 0 : { *(.debug_macro) }
  267. .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  268. .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  269. .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
  270. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  271. }