armelf.xce 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /* Script for -z combreloc -z separate-code */
  2. /* Copyright (C) 2014-2024 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-littlearm", "elf32-bigarm",
  7. "elf32-littlearm")
  8. OUTPUT_ARCH(arm)
  9. ENTRY(_start)
  10. SEARCH_DIR("=//arm-none-eabi/lib"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
  11. SECTIONS
  12. {
  13. PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x8000)); . = SEGMENT_START("text-segment", 0x8000);
  14. .interp : { *(.interp) }
  15. .note.gnu.build-id : { *(.note.gnu.build-id) }
  16. .hash : { *(.hash) }
  17. .gnu.hash : { *(.gnu.hash) }
  18. .dynsym : { *(.dynsym) }
  19. .dynstr : { *(.dynstr) }
  20. .gnu.version : { *(.gnu.version) }
  21. .gnu.version_d : { *(.gnu.version_d) }
  22. .gnu.version_r : { *(.gnu.version_r) }
  23. .rel.dyn :
  24. {
  25. *(.rel.init)
  26. *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
  27. *(.rel.fini)
  28. *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
  29. *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*)
  30. *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
  31. *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
  32. *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
  33. *(.rel.ctors)
  34. *(.rel.dtors)
  35. *(.rel.got)
  36. *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
  37. PROVIDE_HIDDEN (__rel_iplt_start = .);
  38. *(.rel.iplt)
  39. PROVIDE_HIDDEN (__rel_iplt_end = .);
  40. }
  41. .rela.dyn :
  42. {
  43. *(.rela.init)
  44. *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
  45. *(.rela.fini)
  46. *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
  47. *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
  48. *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
  49. *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
  50. *(.rela.ctors)
  51. *(.rela.dtors)
  52. *(.rela.got)
  53. *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
  54. PROVIDE_HIDDEN (__rela_iplt_start = .);
  55. *(.rela.iplt)
  56. PROVIDE_HIDDEN (__rela_iplt_end = .);
  57. }
  58. .rel.plt :
  59. {
  60. *(.rel.plt)
  61. }
  62. .rela.plt :
  63. {
  64. *(.rela.plt)
  65. }
  66. . = ALIGN(CONSTANT (MAXPAGESIZE));
  67. .init :
  68. {
  69. KEEP (*(SORT_NONE(.init)))
  70. }
  71. .plt : { *(.plt) }
  72. .iplt : { *(.iplt) }
  73. .gnu.sgstubs : { *(.gnu.sgstubs*) }
  74. .text :
  75. {
  76. *(.text.unlikely .text.*_unlikely .text.unlikely.*)
  77. *(.text.exit .text.exit.*)
  78. *(.text.startup .text.startup.*)
  79. *(.text.hot .text.hot.*)
  80. *(SORT(.text.sorted.*))
  81. *(.text .stub .text.* .gnu.linkonce.t.*)
  82. /* .gnu.warning sections are handled specially by elf.em. */
  83. *(.gnu.warning)
  84. *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
  85. }
  86. .fini :
  87. {
  88. KEEP (*(SORT_NONE(.fini)))
  89. }
  90. PROVIDE (__etext = .);
  91. PROVIDE (_etext = .);
  92. PROVIDE (etext = .);
  93. . = ALIGN(CONSTANT (MAXPAGESIZE));
  94. /* Adjust the address for the rodata segment. We want to adjust up to
  95. the same address within the page on the next page up. */
  96. . = SEGMENT_START("rodata-segment", ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)));
  97. .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  98. .rodata1 : { *(.rodata1) }
  99. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) }
  100. .ARM.exidx :
  101. {
  102. PROVIDE_HIDDEN (__exidx_start = .);
  103. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  104. PROVIDE_HIDDEN (__exidx_end = .);
  105. }
  106. .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
  107. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  108. .sframe : ONLY_IF_RO { *(.sframe) *(.sframe.*) }
  109. .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
  110. .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) }
  111. /* These sections are generated by the Sun/Oracle C++ compiler. */
  112. .exception_ranges : ONLY_IF_RO { *(.exception_ranges*) }
  113. /* Adjust the address for the data segment. We want to adjust up to
  114. the same address within the page on the next page up. */
  115. . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));
  116. /* Exception handling */
  117. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  118. .sframe : ONLY_IF_RW { *(.sframe) *(.sframe.*) }
  119. .gnu_extab : ONLY_IF_RW { *(.gnu_extab) }
  120. .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  121. .exception_ranges : ONLY_IF_RW { *(.exception_ranges*) }
  122. /* Thread Local Storage sections */
  123. .tdata :
  124. {
  125. PROVIDE_HIDDEN (__tdata_start = .);
  126. *(.tdata .tdata.* .gnu.linkonce.td.*)
  127. }
  128. .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  129. .preinit_array :
  130. {
  131. PROVIDE_HIDDEN (__preinit_array_start = .);
  132. KEEP (*(.preinit_array))
  133. PROVIDE_HIDDEN (__preinit_array_end = .);
  134. }
  135. .init_array :
  136. {
  137. PROVIDE_HIDDEN (__init_array_start = .);
  138. KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
  139. KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
  140. PROVIDE_HIDDEN (__init_array_end = .);
  141. }
  142. .fini_array :
  143. {
  144. PROVIDE_HIDDEN (__fini_array_start = .);
  145. KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
  146. KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
  147. PROVIDE_HIDDEN (__fini_array_end = .);
  148. }
  149. .ctors :
  150. {
  151. /* gcc uses crtbegin.o to find the start of
  152. the constructors, so we make sure it is
  153. first. Because this is a wildcard, it
  154. doesn't matter if the user does not
  155. actually link against crtbegin.o; the
  156. linker won't look for a file to match a
  157. wildcard. The wildcard also means that it
  158. doesn't matter which directory crtbegin.o
  159. is in. */
  160. KEEP (*crtbegin.o(.ctors))
  161. KEEP (*crtbegin?.o(.ctors))
  162. /* We don't want to include the .ctor section from
  163. the crtend.o file until after the sorted ctors.
  164. The .ctor section from the crtend file contains the
  165. end of ctors marker and it must be last */
  166. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  167. KEEP (*(SORT(.ctors.*)))
  168. KEEP (*(.ctors))
  169. }
  170. .dtors :
  171. {
  172. KEEP (*crtbegin.o(.dtors))
  173. KEEP (*crtbegin?.o(.dtors))
  174. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  175. KEEP (*(SORT(.dtors.*)))
  176. KEEP (*(.dtors))
  177. }
  178. .jcr : { KEEP (*(.jcr)) }
  179. .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
  180. .dynamic : { *(.dynamic) }
  181. .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
  182. .data :
  183. {
  184. __data_start = .;
  185. *(.data .data.* .gnu.linkonce.d.*)
  186. SORT(CONSTRUCTORS)
  187. }
  188. .data1 : { *(.data1) }
  189. _edata = .; PROVIDE (edata = .);
  190. /* This section contains data that is initialized during load,
  191. but not during the application's initialization sequence. */
  192. .persistent : ALIGN(32 / 8)
  193. {
  194. PROVIDE (__persistent_start = .);
  195. *(.persistent .persistent.* .gnu.linkonce.p.*)
  196. . = ALIGN(32 / 8);
  197. PROVIDE (__persistent_end = .);
  198. }
  199. . = ALIGN(ALIGNOF(NEXT_SECTION));
  200. __bss_start = .;
  201. __bss_start__ = .;
  202. .bss :
  203. {
  204. *(.dynbss)
  205. *(.bss .bss.* .gnu.linkonce.b.*)
  206. *(COMMON)
  207. /* Align here to ensure that the .bss section occupies space up to
  208. _end. Align after .bss to ensure correct alignment even if the
  209. .bss section disappears because there are no input sections.
  210. FIXME: Why do we need it? When there is no .bss section, we do not
  211. pad the .data section. */
  212. . = ALIGN(. != 0 ? 32 / 8 : 1);
  213. }
  214. _bss_end__ = .; __bss_end__ = .;
  215. /* This section contains data that is not initialized during load,
  216. or during the application's initialization sequence. */
  217. .noinit (NOLOAD) : ALIGN(32 / 8)
  218. {
  219. PROVIDE (__noinit_start = .);
  220. *(.noinit .noinit.* .gnu.linkonce.n.*)
  221. . = ALIGN(32 / 8);
  222. PROVIDE (__noinit_end = .);
  223. }
  224. . = ALIGN(32 / 8);
  225. . = SEGMENT_START("ldata-segment", .);
  226. . = ALIGN(32 / 8);
  227. __end__ = .;
  228. _end = .; PROVIDE (end = .);
  229. .stack 0x80000 :
  230. {
  231. _stack = .;
  232. *(.stack)
  233. }
  234. /* Stabs debugging sections. */
  235. .stab 0 : { *(.stab) }
  236. .stabstr 0 : { *(.stabstr) }
  237. .stab.excl 0 : { *(.stab.excl) }
  238. .stab.exclstr 0 : { *(.stab.exclstr) }
  239. .stab.index 0 : { *(.stab.index) }
  240. .stab.indexstr 0 : { *(.stab.indexstr) }
  241. .comment 0 (INFO) : { *(.comment); LINKER_VERSION; }
  242. .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
  243. /* DWARF debug sections.
  244. Symbols in the DWARF debugging sections are relative to the beginning
  245. of the section so we begin them at 0. */
  246. /* DWARF 1. */
  247. .debug 0 : { *(.debug) }
  248. .line 0 : { *(.line) }
  249. /* GNU DWARF 1 extensions. */
  250. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  251. .debug_sfnames 0 : { *(.debug_sfnames) }
  252. /* DWARF 1.1 and DWARF 2. */
  253. .debug_aranges 0 : { *(.debug_aranges) }
  254. .debug_pubnames 0 : { *(.debug_pubnames) }
  255. /* DWARF 2. */
  256. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  257. .debug_abbrev 0 : { *(.debug_abbrev) }
  258. .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) }
  259. .debug_frame 0 : { *(.debug_frame) }
  260. .debug_str 0 : { *(.debug_str) }
  261. .debug_loc 0 : { *(.debug_loc) }
  262. .debug_macinfo 0 : { *(.debug_macinfo) }
  263. /* SGI/MIPS DWARF 2 extensions. */
  264. .debug_weaknames 0 : { *(.debug_weaknames) }
  265. .debug_funcnames 0 : { *(.debug_funcnames) }
  266. .debug_typenames 0 : { *(.debug_typenames) }
  267. .debug_varnames 0 : { *(.debug_varnames) }
  268. /* DWARF 3. */
  269. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  270. .debug_ranges 0 : { *(.debug_ranges) }
  271. /* DWARF 5. */
  272. .debug_addr 0 : { *(.debug_addr) }
  273. .debug_line_str 0 : { *(.debug_line_str) }
  274. .debug_loclists 0 : { *(.debug_loclists) }
  275. .debug_macro 0 : { *(.debug_macro) }
  276. .debug_names 0 : { *(.debug_names) }
  277. .debug_rnglists 0 : { *(.debug_rnglists) }
  278. .debug_str_offsets 0 : { *(.debug_str_offsets) }
  279. .debug_sup 0 : { *(.debug_sup) }
  280. .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
  281. .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
  282. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  283. }