armelf.xdc 9.0 KB

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