umflink.ld.S 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. /* Script for -z combreloc: combine and sort reloc sections */
  2. OUTPUT_FORMAT("elf32-tradlittlemips", "elf32-tradbigmips",
  3. "elf32-tradlittlemips")
  4. OUTPUT_ARCH(mips)
  5. ENTRY(__start)
  6. SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
  7. SECTIONS
  8. {
  9. /* Read-only sections, merged into text segment: */
  10. PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x0400000)); . = SEGMENT_START("text-segment", 0x0400000) + SIZEOF_HEADERS;
  11. .interp : { *(.interp) }
  12. .reginfo : { *(.reginfo) }
  13. .note.gnu.build-id : { *(.note.gnu.build-id) }
  14. .dynamic : { *(.dynamic) }
  15. .hash : { *(.hash) }
  16. .gnu.hash : { *(.gnu.hash) }
  17. .dynsym : { *(.dynsym) }
  18. .dynstr : { *(.dynstr) }
  19. .gnu.version : { *(.gnu.version) }
  20. .gnu.version_d : { *(.gnu.version_d) }
  21. .gnu.version_r : { *(.gnu.version_r) }
  22. .rel.dyn :
  23. {
  24. *(.rel.init)
  25. *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
  26. *(.rel.fini)
  27. *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
  28. *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
  29. *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
  30. *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
  31. *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
  32. *(.rel.ctors)
  33. *(.rel.dtors)
  34. *(.rel.got)
  35. *(.rel.dyn)
  36. *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
  37. *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
  38. *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
  39. *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
  40. *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
  41. PROVIDE_HIDDEN (__rel_iplt_start = .);
  42. *(.rel.iplt)
  43. PROVIDE_HIDDEN (__rel_iplt_end = .);
  44. PROVIDE_HIDDEN (__rela_iplt_start = .);
  45. PROVIDE_HIDDEN (__rela_iplt_end = .);
  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. PROVIDE_HIDDEN (__rel_iplt_start = .);
  65. PROVIDE_HIDDEN (__rel_iplt_end = .);
  66. PROVIDE_HIDDEN (__rela_iplt_start = .);
  67. *(.rela.iplt)
  68. PROVIDE_HIDDEN (__rela_iplt_end = .);
  69. }
  70. .rel.plt :
  71. {
  72. *(.rel.plt)
  73. }
  74. .rela.plt :
  75. {
  76. *(.rela.plt)
  77. }
  78. .init :
  79. {
  80. KEEP (*(SORT_NONE(.init)))
  81. }
  82. .text :
  83. {
  84. _ftext = . ;
  85. *(.text.unlikely .text.*_unlikely .text.unlikely.*)
  86. *(.text.exit .text.exit.*)
  87. *(.text.startup .text.startup.*)
  88. *(.text.hot .text.hot.*)
  89. *(.text .stub .text.* .gnu.linkonce.t.*)
  90. /* .gnu.warning sections are handled specially by elf32.em. */
  91. *(.gnu.warning)
  92. *(.mips16.fn.*) *(.mips16.call.*)
  93. }
  94. .fini :
  95. {
  96. KEEP (*(SORT_NONE(.fini)))
  97. }
  98. PROVIDE (__etext = .);
  99. PROVIDE (_etext = .);
  100. PROVIDE (etext = .);
  101. .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  102. .rodata1 : { *(.rodata1) }
  103. .sdata2 :
  104. {
  105. *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
  106. }
  107. .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
  108. .eh_frame_hdr : { *(.eh_frame_hdr) }
  109. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  110. .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
  111. .gcc_except_table.*) }
  112. /* These sections are generated by the Sun/Oracle C++ compiler. */
  113. .exception_ranges : ONLY_IF_RO { *(.exception_ranges
  114. .exception_ranges*) }
  115. .plt : { *(.plt) }
  116. .iplt : { *(.iplt) }
  117. /* Adjust the address for the data segment. We want to adjust up to
  118. the same address within the page on the next page up. */
  119. . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
  120. /* Exception handling */
  121. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  122. .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  123. .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
  124. /* Thread Local Storage sections */
  125. .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
  126. .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  127. .preinit_array :
  128. {
  129. PROVIDE_HIDDEN (__preinit_array_start = .);
  130. KEEP (*(.preinit_array))
  131. PROVIDE_HIDDEN (__preinit_array_end = .);
  132. }
  133. .init_array :
  134. {
  135. PROVIDE_HIDDEN (__init_array_start = .);
  136. KEEP (*(SORT(.init_array.*)))
  137. KEEP (*(.init_array ))
  138. PROVIDE_HIDDEN (__init_array_end = .);
  139. }
  140. .fini_array :
  141. {
  142. PROVIDE_HIDDEN (__fini_array_start = .);
  143. KEEP (*(SORT(.fini_array.*)))
  144. KEEP (*(.fini_array ))
  145. PROVIDE_HIDDEN (__fini_array_end = .);
  146. }
  147. .ctors :
  148. {
  149. /* gcc uses crtbegin.o to find the start of
  150. the constructors, so we make sure it is
  151. first. Because this is a wildcard, it
  152. doesn't matter if the user does not
  153. actually link against crtbegin.o; the
  154. linker won't look for a file to match a
  155. wildcard. The wildcard also means that it
  156. doesn't matter which directory crtbegin.o
  157. is in. */
  158. KEEP (*crtbegin.o(.ctors))
  159. KEEP (*crtbegin?.o(.ctors))
  160. /* We don't want to include the .ctor section from
  161. the crtend.o file until after the sorted ctors.
  162. The .ctor section from the crtend file contains the
  163. end of ctors marker and it must be last */
  164. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  165. KEEP (*(SORT(.ctors.*)))
  166. KEEP (*(.ctors))
  167. }
  168. .dtors :
  169. {
  170. KEEP (*crtbegin.o(.dtors))
  171. KEEP (*crtbegin?.o(.dtors))
  172. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  173. KEEP (*(SORT(.dtors.*)))
  174. KEEP (*(.dtors))
  175. }
  176. .jcr : { KEEP (*(.jcr)) }
  177. .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
  178. . = DATA_SEGMENT_RELRO_END (0, .);
  179. .got.plt : { *(.got.plt) }
  180. .data :
  181. {
  182. _fdata = . ;
  183. *(.data .data.* .gnu.linkonce.d.*)
  184. SORT(CONSTRUCTORS)
  185. }
  186. .data1 : { *(.data1) }
  187. . = .;
  188. . = .;
  189. HIDDEN (_gp = ALIGN (16) + 0x7ff0);
  190. .got : { *(.got) }
  191. /* We want the small data sections together, so single-instruction offsets
  192. can access them all, and initialized data all before uninitialized, so
  193. we can shorten the on-disk segment size. */
  194. .sdata :
  195. {
  196. *(.sdata .sdata.* .gnu.linkonce.s.*)
  197. }
  198. .lit8 : { *(.lit8) }
  199. .lit4 : { *(.lit4) }
  200. _edata = .; PROVIDE (edata = .);
  201. . = .;
  202. __bss_start = .;
  203. _fbss = .;
  204. .sbss :
  205. {
  206. *(.dynsbss)
  207. *(.sbss .sbss.* .gnu.linkonce.sb.*)
  208. *(.scommon)
  209. }
  210. .bss :
  211. {
  212. *(.dynbss)
  213. *(.bss .bss.* .gnu.linkonce.b.*)
  214. *(COMMON)
  215. /* Align here to ensure that the .bss section occupies space up to
  216. _end. Align after .bss to ensure correct alignment even if the
  217. .bss section disappears because there are no input sections.
  218. FIXME: Why do we need it? When there is no .bss section, we don't
  219. pad the .data section. */
  220. . = ALIGN(. != 0 ? 32 / 8 : 1);
  221. }
  222. /* ##########User defined modules start ########## */
  223. /* The start address of following user defined modules must be set to
  224. 4K aligment, because umf use mmap() to insert module to umf VMA */
  225. . = 0x4000000;
  226. #include "./../../../../project.h"
  227. #if defined(CONFIG_MOD_PACK_MEDIA)
  228. .media :
  229. {
  230. *(.media.text) *(.media.text.*)
  231. *(.media.rodata) *(.media.rodata.*)
  232. . = ALIGN(4096);
  233. __mediadata_start = .;
  234. *(.media.data) *(.media.data.*)
  235. *(.media.bss) *(.media.bss.*)
  236. . = ALIGN(4096);
  237. __mediadata_end = .;
  238. }
  239. #endif
  240. #if defined(CONFIG_MOD_PACK_PICLIB)
  241. .picture :
  242. {
  243. *(.picture.text) *(.picture.text.*)
  244. *(.picture.rodata) *(.picture.rodata.*)
  245. . = ALIGN(4096);
  246. __picturedata_start = .;
  247. *(.picture.data) *(.picture.data.*)
  248. *(.picture.bss) *(.picture.bss.*)
  249. . = ALIGN(4096);
  250. __picturedata_end = .;
  251. }
  252. #endif
  253. #if defined(CONFIG_MOD_PACK_RUNAV)
  254. .ffmpeg :
  255. {
  256. *(.ffmpeg.text) *(.ffmpeg.text.*)
  257. *(.ffmpeg.rodata) *(.ffmpeg.rodata.*)
  258. . = ALIGN(4096);
  259. __ffmpegdata_start = .;
  260. *(.ffmpeg.data) *(.ffmpeg.data.*)
  261. *(.ffmpeg.bss) *(.ffmpeg.bss.*)
  262. . = ALIGN(4096);
  263. __ffmpegdata_end = .;
  264. }
  265. #endif
  266. #if defined(CONFIG_MOD_PACK_ATV)
  267. .atv :
  268. {
  269. *(.atv.text) *(.atv.text.*)
  270. *(.atv.rodata) *(.atv.rodata.*)
  271. . = ALIGN(4096);
  272. __atvdata_start = .;
  273. *(.atv.data) *(.atv.data.*)
  274. *(.atv.bss) *(.atv.bss.*)
  275. . = ALIGN(4096);
  276. __atvdata_end = .;
  277. }
  278. #endif
  279. #if defined(CONFIG_MOD_PACK_TT)
  280. .teletext :
  281. {
  282. *(.teletext.text) *(.teletext.text.*)
  283. *(.teletext.rodata) *(.teletext.rodata.*)
  284. . = ALIGN(4096);
  285. __teletextdata_start = .;
  286. *(.teletext.data) *(.teletext.data.*)
  287. *(.teletext.bss) *(.teletext.bss.*)
  288. . = ALIGN(4096);
  289. __teletextdata_end = .;
  290. }
  291. #endif
  292. #if defined(CONFIG_MOD_PACK_SUB)
  293. .subtitle :
  294. {
  295. *(.subtitle.text) *(.subtitle.text.*)
  296. *(.subtitle.rodata) *(.subtitle.rodata.*)
  297. . = ALIGN(4096);
  298. __subtitledata_start = .;
  299. *(.subtitle.data) *(.subtitle.data.*)
  300. *(.subtitle.bss) *(.subtitle.bss.*)
  301. . = ALIGN(4096);
  302. __subtitledata_end = .;
  303. }
  304. #endif
  305. #if defined(CONFIG_MOD_PACK_DTV)
  306. .dtv :
  307. {
  308. *(.dtv.text) *(.dtv.text.*)
  309. *(.dtv.rodata) *(.dtv.rodata.*)
  310. . = ALIGN(4096);
  311. __dtvdata_start = .;
  312. *(.dtv.data) *(.dtv.data.*)
  313. *(.dtv.bss) *(.dtv.bss.*)
  314. . = ALIGN(4096);
  315. __dtvdata_end = .;
  316. }
  317. #endif
  318. #if defined(CONFIG_ENABLE_UMF_LANGUAGE_MODULES)
  319. INCLUDE "umflang.ld"
  320. #endif
  321. #if defined(CONFIG_MOD_PACK_ATV)
  322. .atv :
  323. {
  324. *(.atv.text) *(.atv.text.*)
  325. *(.atv.rodata) *(.atv.rodata.*)
  326. . = ALIGN(4096);
  327. __atvdata_start = .;
  328. *(.atv.data) *(.atv.data.*)
  329. *(.atv.bss) *(.atv.bss.*)
  330. . = ALIGN(4096);
  331. __atvdata_end = .;
  332. }
  333. #endif
  334. #if defined(CONFIG_MOD_PACK_DTV)
  335. .dtv :
  336. {
  337. *(.dtv.text) *(.dtv.text.*)
  338. *(.dtv.rodata) *(.dtv.rodata.*)
  339. . = ALIGN(4096);
  340. __dtvdata_start = .;
  341. *(.dtv.data) *(.dtv.data.*)
  342. *(.dtv.bss) *(.dtv.bss.*)
  343. . = ALIGN(4096);
  344. __dtvdata_end = .;
  345. }
  346. #endif
  347. /* ##########User defined modules end ########### */
  348. . = ALIGN(32 / 8);
  349. . = SEGMENT_START("ldata-segment", .);
  350. . = ALIGN(32 / 8);
  351. _end = .; PROVIDE (end = .);
  352. . = DATA_SEGMENT_END (.);
  353. /* Stabs debugging sections. */
  354. .stab 0 : { *(.stab) }
  355. .stabstr 0 : { *(.stabstr) }
  356. .stab.excl 0 : { *(.stab.excl) }
  357. .stab.exclstr 0 : { *(.stab.exclstr) }
  358. .stab.index 0 : { *(.stab.index) }
  359. .stab.indexstr 0 : { *(.stab.indexstr) }
  360. .comment 0 : { *(.comment) }
  361. /* DWARF debug sections.
  362. Symbols in the DWARF debugging sections are relative to the beginning
  363. of the section so we begin them at 0. */
  364. /* DWARF 1 */
  365. .debug 0 : { *(.debug) }
  366. .line 0 : { *(.line) }
  367. /* GNU DWARF 1 extensions */
  368. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  369. .debug_sfnames 0 : { *(.debug_sfnames) }
  370. /* DWARF 1.1 and DWARF 2 */
  371. .debug_aranges 0 : { *(.debug_aranges) }
  372. .debug_pubnames 0 : { *(.debug_pubnames) }
  373. /* DWARF 2 */
  374. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  375. .debug_abbrev 0 : { *(.debug_abbrev) }
  376. .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
  377. .debug_frame 0 : { *(.debug_frame) }
  378. .debug_str 0 : { *(.debug_str) }
  379. .debug_loc 0 : { *(.debug_loc) }
  380. .debug_macinfo 0 : { *(.debug_macinfo) }
  381. /* SGI/MIPS DWARF 2 extensions */
  382. .debug_weaknames 0 : { *(.debug_weaknames) }
  383. .debug_funcnames 0 : { *(.debug_funcnames) }
  384. .debug_typenames 0 : { *(.debug_typenames) }
  385. .debug_varnames 0 : { *(.debug_varnames) }
  386. /* DWARF 3 */
  387. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  388. .debug_ranges 0 : { *(.debug_ranges) }
  389. /* DWARF Extension. */
  390. .debug_macro 0 : { *(.debug_macro) }
  391. .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  392. .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  393. .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
  394. .mdebug.abi32 0 : { KEEP(*(.mdebug.abi32)) }
  395. .mdebug.abiN32 0 : { KEEP(*(.mdebug.abiN32)) }
  396. .mdebug.abi64 0 : { KEEP(*(.mdebug.abi64)) }
  397. .mdebug.abiO64 0 : { KEEP(*(.mdebug.abiO64)) }
  398. .mdebug.eabi32 0 : { KEEP(*(.mdebug.eabi32)) }
  399. .mdebug.eabi64 0 : { KEEP(*(.mdebug.eabi64)) }
  400. .gcc_compiled_long32 0 : { KEEP(*(.gcc_compiled_long32)) }
  401. .gcc_compiled_long64 0 : { KEEP(*(.gcc_compiled_long64)) }
  402. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  403. }