armelf.xs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /* Script for -shared */
  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. . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
  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.init : { *(.rel.init) }
  24. .rela.init : { *(.rela.init) }
  25. .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
  26. .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
  27. .rel.fini : { *(.rel.fini) }
  28. .rela.fini : { *(.rela.fini) }
  29. .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
  30. .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
  31. .rel.data.rel.ro : { *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) }
  32. .rela.data.rel.ro : { *(.rela.data.rel.ro .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*) }
  33. .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
  34. .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
  35. .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
  36. .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
  37. .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
  38. .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
  39. .rel.ctors : { *(.rel.ctors) }
  40. .rela.ctors : { *(.rela.ctors) }
  41. .rel.dtors : { *(.rel.dtors) }
  42. .rela.dtors : { *(.rela.dtors) }
  43. .rel.got : { *(.rel.got) }
  44. .rela.got : { *(.rela.got) }
  45. .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
  46. .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
  47. .rel.iplt :
  48. {
  49. *(.rel.iplt)
  50. }
  51. .rela.iplt :
  52. {
  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. *(.tdata .tdata.* .gnu.linkonce.td.*)
  115. }
  116. .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  117. .preinit_array :
  118. {
  119. KEEP (*(.preinit_array))
  120. }
  121. .init_array :
  122. {
  123. KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
  124. KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
  125. }
  126. .fini_array :
  127. {
  128. KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
  129. KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
  130. }
  131. .ctors :
  132. {
  133. /* gcc uses crtbegin.o to find the start of
  134. the constructors, so we make sure it is
  135. first. Because this is a wildcard, it
  136. doesn't matter if the user does not
  137. actually link against crtbegin.o; the
  138. linker won't look for a file to match a
  139. wildcard. The wildcard also means that it
  140. doesn't matter which directory crtbegin.o
  141. is in. */
  142. KEEP (*crtbegin.o(.ctors))
  143. KEEP (*crtbegin?.o(.ctors))
  144. /* We don't want to include the .ctor section from
  145. the crtend.o file until after the sorted ctors.
  146. The .ctor section from the crtend file contains the
  147. end of ctors marker and it must be last */
  148. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  149. KEEP (*(SORT(.ctors.*)))
  150. KEEP (*(.ctors))
  151. }
  152. .dtors :
  153. {
  154. KEEP (*crtbegin.o(.dtors))
  155. KEEP (*crtbegin?.o(.dtors))
  156. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  157. KEEP (*(SORT(.dtors.*)))
  158. KEEP (*(.dtors))
  159. }
  160. .jcr : { KEEP (*(.jcr)) }
  161. .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
  162. .dynamic : { *(.dynamic) }
  163. .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
  164. .data :
  165. {
  166. PROVIDE (__data_start = .);
  167. *(.data .data.* .gnu.linkonce.d.*)
  168. SORT(CONSTRUCTORS)
  169. }
  170. .data1 : { *(.data1) }
  171. PROVIDE (_edata = .); PROVIDE (edata = .);
  172. . = .;
  173. PROVIDE (__bss_start = .);
  174. PROVIDE (__bss_start__ = .);
  175. .bss :
  176. {
  177. *(.dynbss)
  178. *(.bss .bss.* .gnu.linkonce.b.*)
  179. *(COMMON)
  180. /* Align here to ensure that the .bss section occupies space up to
  181. _end. Align after .bss to ensure correct alignment even if the
  182. .bss section disappears because there are no input sections.
  183. FIXME: Why do we need it? When there is no .bss section, we do not
  184. pad the .data section. */
  185. . = ALIGN(. != 0 ? 32 / 8 : 1);
  186. }
  187. PROVIDE (_bss_end__ = .); PROVIDE (__bss_end__ = .);
  188. . = ALIGN(32 / 8);
  189. . = SEGMENT_START("ldata-segment", .);
  190. . = ALIGN(32 / 8);
  191. PROVIDE (__end__ = .);
  192. PROVIDE (_end = .); PROVIDE (end = .);
  193. .stack 0x80000 :
  194. {
  195. _stack = .;
  196. *(.stack)
  197. }
  198. /* Stabs debugging sections. */
  199. .stab 0 : { *(.stab) }
  200. .stabstr 0 : { *(.stabstr) }
  201. .stab.excl 0 : { *(.stab.excl) }
  202. .stab.exclstr 0 : { *(.stab.exclstr) }
  203. .stab.index 0 : { *(.stab.index) }
  204. .stab.indexstr 0 : { *(.stab.indexstr) }
  205. .comment 0 : { *(.comment) }
  206. .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
  207. /* DWARF debug sections.
  208. Symbols in the DWARF debugging sections are relative to the beginning
  209. of the section so we begin them at 0. */
  210. /* DWARF 1 */
  211. .debug 0 : { *(.debug) }
  212. .line 0 : { *(.line) }
  213. /* GNU DWARF 1 extensions */
  214. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  215. .debug_sfnames 0 : { *(.debug_sfnames) }
  216. /* DWARF 1.1 and DWARF 2 */
  217. .debug_aranges 0 : { *(.debug_aranges) }
  218. .debug_pubnames 0 : { *(.debug_pubnames) }
  219. /* DWARF 2 */
  220. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  221. .debug_abbrev 0 : { *(.debug_abbrev) }
  222. .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) }
  223. .debug_frame 0 : { *(.debug_frame) }
  224. .debug_str 0 : { *(.debug_str) }
  225. .debug_loc 0 : { *(.debug_loc) }
  226. .debug_macinfo 0 : { *(.debug_macinfo) }
  227. /* SGI/MIPS DWARF 2 extensions */
  228. .debug_weaknames 0 : { *(.debug_weaknames) }
  229. .debug_funcnames 0 : { *(.debug_funcnames) }
  230. .debug_typenames 0 : { *(.debug_typenames) }
  231. .debug_varnames 0 : { *(.debug_varnames) }
  232. /* DWARF 3 */
  233. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  234. .debug_ranges 0 : { *(.debug_ranges) }
  235. /* DWARF Extension. */
  236. .debug_macro 0 : { *(.debug_macro) }
  237. .debug_addr 0 : { *(.debug_addr) }
  238. .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }
  239. .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
  240. /* This section contains data that is not initialised during load
  241. *or* application reset. */
  242. .noinit (NOLOAD) :
  243. {
  244. . = ALIGN(2);
  245. PROVIDE (__noinit_start = .);
  246. *(.noinit)
  247. . = ALIGN(2);
  248. PROVIDE (__noinit_end = .);
  249. }
  250. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  251. }