armelf.xc 9.1 KB

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