ldscript.mips 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. /*-
  2. * Copyright (c) 2001, 2004, 2008, Juniper Networks, Inc.
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of the Juniper Networks, Inc. nor the names of its
  14. * contributors may be used to endorse or promote products derived from
  15. * this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY JUNIPER NETWORKS AND CONTRIBUTORS ``AS IS'' AND
  18. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. * ARE DISCLAIMED. IN NO EVENT SHALL JUNIPER NETWORKS OR CONTRIBUTORS BE LIABLE
  21. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27. * SUCH DAMAGE.
  28. *
  29. * JNPR: ldscript.mips,v 1.3 2006/10/11 06:12:04
  30. * $FreeBSD$
  31. */
  32. OUTPUT_ARCH(mips)
  33. ENTRY(_start)
  34. SEARCH_DIR(/usr/lib);
  35. SECTIONS
  36. {
  37. /* Read-only sections, merged into text segment: */
  38. . = KERNLOADADDR + SIZEOF_HEADERS;
  39. .text :
  40. {
  41. *(.trap)
  42. *(.text)
  43. *(.text.*)
  44. *(.stub)
  45. /* .gnu.warning sections are handled specially by elf32.em. */
  46. *(.gnu.warning)
  47. *(.gnu.linkonce.t.*)
  48. } =0x1000000
  49. .fini :
  50. {
  51. KEEP (*(.fini))
  52. } =0x1000000
  53. PROVIDE (__etext = .);
  54. PROVIDE (_etext = .);
  55. PROVIDE (etext = .);
  56. .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) }
  57. .rodata1 : { *(.rodata1) }
  58. .interp : { *(.interp) }
  59. .hash : { *(.hash) }
  60. .dynsym : { *(.dynsym) }
  61. .dynstr : { *(.dynstr) }
  62. .gnu.version : { *(.gnu.version) }
  63. .gnu.version_d : { *(.gnu.version_d) }
  64. .gnu.version_r : { *(.gnu.version_r) }
  65. .note.gnu.build-id : {
  66. PROVIDE (__build_id_start = .);
  67. *(.note.gnu.build-id)
  68. PROVIDE (__build_id_end = .);
  69. }
  70. .rel.init : { *(.rel.init) }
  71. .rela.init : { *(.rela.init) }
  72. .rel.text :
  73. {
  74. *(.rel.text)
  75. *(.rel.text.*)
  76. *(.rel.gnu.linkonce.t.*)
  77. }
  78. .rela.text :
  79. {
  80. *(.rela.text)
  81. *(.rela.text.*)
  82. *(.rela.gnu.linkonce.t.*)
  83. }
  84. .rel.fini : { *(.rel.fini) }
  85. .rela.fini : { *(.rela.fini) }
  86. .rel.rodata :
  87. {
  88. *(.rel.rodata)
  89. *(.rel.rodata.*)
  90. *(.rel.gnu.linkonce.r.*)
  91. }
  92. .rela.rodata :
  93. {
  94. *(.rela.rodata)
  95. *(.rela.rodata.*)
  96. *(.rela.gnu.linkonce.r.*)
  97. }
  98. .rel.data :
  99. {
  100. *(.rel.data)
  101. *(.rel.data.*)
  102. *(.rel.gnu.linkonce.d.*)
  103. }
  104. .rela.data :
  105. {
  106. *(.rela.data)
  107. *(.rela.data.*)
  108. *(.rela.gnu.linkonce.d.*)
  109. }
  110. .rel.ctors : { *(.rel.ctors) }
  111. .rela.ctors : { *(.rela.ctors) }
  112. .rel.dtors : { *(.rel.dtors) }
  113. .rela.dtors : { *(.rela.dtors) }
  114. .rel.got : { *(.rel.got) }
  115. .rela.got : { *(.rela.got) }
  116. .rel.sdata :
  117. {
  118. *(.rel.sdata)
  119. *(.rel.sdata.*)
  120. *(.rel.gnu.linkonce.s.*)
  121. }
  122. .rela.sdata :
  123. {
  124. *(.rela.sdata)
  125. *(.rela.sdata.*)
  126. *(.rela.gnu.linkonce.s.*)
  127. }
  128. .rel.sbss :
  129. {
  130. *(.rel.sbss)
  131. *(.rel.sbss.*)
  132. *(.rel.gnu.linkonce.sb.*)
  133. }
  134. .rela.sbss :
  135. {
  136. *(.rela.sbss)
  137. *(.rela.sbss.*)
  138. *(.rel.gnu.linkonce.sb.*)
  139. }
  140. .rel.sdata2 :
  141. {
  142. *(.rel.sdata2)
  143. *(.rel.sdata2.*)
  144. *(.rel.gnu.linkonce.s2.*)
  145. }
  146. .rela.sdata2 :
  147. {
  148. *(.rela.sdata2)
  149. *(.rela.sdata2.*)
  150. *(.rela.gnu.linkonce.s2.*)
  151. }
  152. .rel.sbss2 :
  153. {
  154. *(.rel.sbss2)
  155. *(.rel.sbss2.*)
  156. *(.rel.gnu.linkonce.sb2.*)
  157. }
  158. .rela.sbss2 :
  159. {
  160. *(.rela.sbss2)
  161. *(.rela.sbss2.*)
  162. *(.rela.gnu.linkonce.sb2.*)
  163. }
  164. .rel.bss :
  165. {
  166. *(.rel.bss)
  167. *(.rel.bss.*)
  168. *(.rel.gnu.linkonce.b.*)
  169. }
  170. .rela.bss :
  171. {
  172. *(.rela.bss)
  173. *(.rela.bss.*)
  174. *(.rela.gnu.linkonce.b.*)
  175. }
  176. .rel.plt : { *(.rel.plt) }
  177. .rela.plt : { *(.rela.plt) }
  178. .init :
  179. {
  180. KEEP (*(.init))
  181. } =0x1000000
  182. .reginfo : { *(.reginfo) }
  183. .sdata2 : { *(.sdata2) *(.sdata2.*) *(.gnu.linkonce.s2.*) }
  184. .sbss2 : { *(.sbss2) *(.sbss2.*) *(.gnu.linkonce.sb2.*) }
  185. . = ALIGN(0x2000) + (. & (0x2000 - 1));
  186. .data :
  187. {
  188. *(.data)
  189. *(.data.*)
  190. *(.gnu.linkonce.d.*)
  191. }
  192. .data1 : { *(.data1) }
  193. .eh_frame : { KEEP (*(.eh_frame)) }
  194. .gcc_except_table : { *(.gcc_except_table) }
  195. .ctors :
  196. {
  197. /* gcc uses crtbegin.o to find the start of
  198. the constructors, so we make sure it is
  199. first. Because this is a wildcard, it
  200. doesn't matter if the user does not
  201. actually link against crtbegin.o; the
  202. linker won't look for a file to match a
  203. wildcard. The wildcard also means that it
  204. doesn't matter which directory crtbegin.o
  205. is in. */
  206. KEEP (*crtbegin.o(.ctors))
  207. /* We don't want to include the .ctor section from
  208. from the crtend.o file until after the sorted ctors.
  209. The .ctor section from the crtend file contains the
  210. end of ctors marker and it must be last */
  211. KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
  212. KEEP (*(SORT(.ctors.*)))
  213. KEEP (*(.ctors))
  214. }
  215. .dtors :
  216. {
  217. KEEP (*crtbegin.o(.dtors))
  218. KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
  219. KEEP (*(SORT(.dtors.*)))
  220. KEEP (*(.dtors))
  221. }
  222. .plt : { *(.plt) }
  223. _gp = ALIGN(16) + 0x7ff0;
  224. .got : { *(.got.plt) *(.got) }
  225. .dynamic : { *(.dynamic) }
  226. /* We want the small data sections together, so single-instruction offsets
  227. can access them all, and initialized data all before uninitialized, so
  228. we can shorten the on-disk segment size. */
  229. .sdata :
  230. {
  231. *(.sdata)
  232. *(.sdata.*)
  233. *(.gnu.linkonce.s.*)
  234. }
  235. _edata = .;
  236. PROVIDE (edata = .);
  237. __bss_start = .;
  238. .sbss :
  239. {
  240. PROVIDE (__sbss_start = .);
  241. PROVIDE (___sbss_start = .);
  242. *(.dynsbss)
  243. *(.sbss)
  244. *(.sbss.*)
  245. *(.gnu.linkonce.sb.*)
  246. *(.scommon)
  247. PROVIDE (__sbss_end = .);
  248. PROVIDE (___sbss_end = .);
  249. }
  250. .bss :
  251. {
  252. *(.dynbss)
  253. *(.bss)
  254. *(.bss.*)
  255. *(.gnu.linkonce.b.*)
  256. *(COMMON)
  257. /* Align here to ensure that the .bss section occupies space up to
  258. _end. Align after .bss to ensure correct alignment even if the
  259. .bss section disappears because there are no input sections. */
  260. . = ALIGN(64 / 8);
  261. }
  262. . = ALIGN(64 / 8);
  263. _end = .;
  264. PROVIDE (end = .);
  265. /* Stabs debugging sections. */
  266. .stab 0 : { *(.stab) }
  267. .stabstr 0 : { *(.stabstr) }
  268. .stab.excl 0 : { *(.stab.excl) }
  269. .stab.exclstr 0 : { *(.stab.exclstr) }
  270. .stab.index 0 : { *(.stab.index) }
  271. .stab.indexstr 0 : { *(.stab.indexstr) }
  272. .comment 0 : { *(.comment) }
  273. /* DWARF debug sections.
  274. Symbols in the DWARF debugging sections are relative to the beginning
  275. of the section so we begin them at 0. */
  276. /* DWARF 1 */
  277. .debug 0 : { *(.debug) }
  278. .line 0 : { *(.line) }
  279. /* GNU DWARF 1 extensions */
  280. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  281. .debug_sfnames 0 : { *(.debug_sfnames) }
  282. /* DWARF 1.1 and DWARF 2 */
  283. .debug_aranges 0 : { *(.debug_aranges) }
  284. .debug_pubnames 0 : { *(.debug_pubnames) }
  285. /* DWARF 2 */
  286. .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
  287. .debug_abbrev 0 : { *(.debug_abbrev) }
  288. .debug_line 0 : { *(.debug_line) }
  289. .debug_frame 0 : { *(.debug_frame) }
  290. .debug_str 0 : { *(.debug_str) }
  291. .debug_loc 0 : { *(.debug_loc) }
  292. .debug_macinfo 0 : { *(.debug_macinfo) }
  293. /* SGI/MIPS DWARF 2 extensions */
  294. .debug_weaknames 0 : { *(.debug_weaknames) }
  295. .debug_funcnames 0 : { *(.debug_funcnames) }
  296. .debug_typenames 0 : { *(.debug_typenames) }
  297. .debug_varnames 0 : { *(.debug_varnames) }
  298. /* These must appear regardless of . */
  299. }