elf_iamcu.xswe 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /* Script for -shared -z combreloc -z separate-code -z relro -z now */
  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-iamcu", "elf32-iamcu",
  7. "elf32-iamcu")
  8. OUTPUT_ARCH(iamcu)
  9. ENTRY(_start)
  10. SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); SEARCH_DIR("=/mnt/f/gnu/x64-linux/out/x86_64-linux-gnu/lib");
  11. SECTIONS
  12. {
  13. . = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
  14. .note.gnu.build-id : { *(.note.gnu.build-id) }
  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.bss .rel.bss.* .rel.gnu.linkonce.b.*)
  36. *(.rel.ifunc)
  37. }
  38. .rel.plt :
  39. {
  40. *(.rel.plt)
  41. *(.rel.iplt)
  42. }
  43. . = ALIGN(CONSTANT (MAXPAGESIZE));
  44. .init :
  45. {
  46. KEEP (*(SORT_NONE(.init)))
  47. }
  48. .plt : { *(.plt) *(.iplt) }
  49. .plt.got : { *(.plt.got) }
  50. .text :
  51. {
  52. *(.text.unlikely .text.*_unlikely .text.unlikely.*)
  53. *(.text.exit .text.exit.*)
  54. *(.text.startup .text.startup.*)
  55. *(.text.hot .text.hot.*)
  56. *(SORT(.text.sorted.*))
  57. *(.text .stub .text.* .gnu.linkonce.t.*)
  58. /* .gnu.warning sections are handled specially by elf.em. */
  59. *(.gnu.warning)
  60. }
  61. .fini :
  62. {
  63. KEEP (*(SORT_NONE(.fini)))
  64. }
  65. PROVIDE (__etext = .);
  66. PROVIDE (_etext = .);
  67. PROVIDE (etext = .);
  68. . = ALIGN(CONSTANT (MAXPAGESIZE));
  69. /* Adjust the address for the rodata segment. We want to adjust up to
  70. the same address within the page on the next page up. */
  71. . = SEGMENT_START("rodata-segment", ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)));
  72. .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
  73. .rodata1 : { *(.rodata1) }
  74. .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) }
  75. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  76. .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
  77. .gnu_extab : ONLY_IF_RO { *(.gnu_extab*) }
  78. /* These sections are generated by the Sun/Oracle C++ compiler. */
  79. .exception_ranges : ONLY_IF_RO { *(.exception_ranges*) }
  80. /* Adjust the address for the data segment. We want to adjust up to
  81. the same address within the page on the next page up. */
  82. . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
  83. /* Exception handling */
  84. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) *(.eh_frame.*) }
  85. .gnu_extab : ONLY_IF_RW { *(.gnu_extab) }
  86. .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  87. .exception_ranges : ONLY_IF_RW { *(.exception_ranges*) }
  88. /* Thread Local Storage sections */
  89. .tdata :
  90. {
  91. *(.tdata .tdata.* .gnu.linkonce.td.*)
  92. }
  93. .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
  94. .preinit_array :
  95. {
  96. KEEP (*(.preinit_array))
  97. }
  98. .init_array :
  99. {
  100. KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
  101. KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
  102. }
  103. .fini_array :
  104. {
  105. KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
  106. KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
  107. }
  108. .ctors :
  109. {
  110. /* gcc uses crtbegin.o to find the start of
  111. the constructors, so we make sure it is
  112. first. Because this is a wildcard, it
  113. doesn't matter if the user does not
  114. actually link against crtbegin.o; the
  115. linker won't look for a file to match a
  116. wildcard. The wildcard also means that it
  117. doesn't matter which directory crtbegin.o
  118. is in. */
  119. KEEP (*crtbegin.o(.ctors))
  120. KEEP (*crtbegin?.o(.ctors))
  121. /* We don't want to include the .ctor section from
  122. the crtend.o file until after the sorted ctors.
  123. The .ctor section from the crtend file contains the
  124. end of ctors marker and it must be last */
  125. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  126. KEEP (*(SORT(.ctors.*)))
  127. KEEP (*(.ctors))
  128. }
  129. .dtors :
  130. {
  131. KEEP (*crtbegin.o(.dtors))
  132. KEEP (*crtbegin?.o(.dtors))
  133. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  134. KEEP (*(SORT(.dtors.*)))
  135. KEEP (*(.dtors))
  136. }
  137. .jcr : { KEEP (*(.jcr)) }
  138. .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
  139. .dynamic : { *(.dynamic) }
  140. .got : { *(.got.plt) *(.igot.plt) *(.got) *(.igot) }
  141. . = DATA_SEGMENT_RELRO_END (0, .);
  142. .data :
  143. {
  144. *(.data .data.* .gnu.linkonce.d.*)
  145. SORT(CONSTRUCTORS)
  146. }
  147. .data1 : { *(.data1) }
  148. PROVIDE (_edata = .); PROVIDE (edata = .);
  149. . = .;
  150. PROVIDE (__bss_start = .);
  151. .bss :
  152. {
  153. *(.dynbss)
  154. *(.bss .bss.* .gnu.linkonce.b.*)
  155. *(COMMON)
  156. /* Align here to ensure that the .bss section occupies space up to
  157. _end. Align after .bss to ensure correct alignment even if the
  158. .bss section disappears because there are no input sections.
  159. FIXME: Why do we need it? When there is no .bss section, we do not
  160. pad the .data section. */
  161. . = ALIGN(. != 0 ? 32 / 8 : 1);
  162. }
  163. . = ALIGN(32 / 8);
  164. . = SEGMENT_START("ldata-segment", .);
  165. . = ALIGN(32 / 8);
  166. PROVIDE (_end = .); PROVIDE (end = .);
  167. . = DATA_SEGMENT_END (.);
  168. /* Stabs debugging sections. */
  169. .stab 0 : { *(.stab) }
  170. .stabstr 0 : { *(.stabstr) }
  171. .stab.excl 0 : { *(.stab.excl) }
  172. .stab.exclstr 0 : { *(.stab.exclstr) }
  173. .stab.index 0 : { *(.stab.index) }
  174. .stab.indexstr 0 : { *(.stab.indexstr) }
  175. .comment 0 : { *(.comment) }
  176. .gnu.build.attributes : { *(.gnu.build.attributes .gnu.build.attributes.*) }
  177. /* DWARF debug sections.
  178. Symbols in the DWARF debugging sections are relative to the beginning
  179. of the section so we begin them at 0. */
  180. /* DWARF 1 */
  181. .debug 0 : { *(.debug) }
  182. .line 0 : { *(.line) }
  183. /* GNU DWARF 1 extensions */
  184. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  185. .debug_sfnames 0 : { *(.debug_sfnames) }
  186. /* DWARF 1.1 and DWARF 2 */
  187. .debug_aranges 0 : { *(.debug_aranges) }
  188. .debug_pubnames 0 : { *(.debug_pubnames) }
  189. /* DWARF 2 */
  190. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  191. .debug_abbrev 0 : { *(.debug_abbrev) }
  192. .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) }
  193. .debug_frame 0 : { *(.debug_frame) }
  194. .debug_str 0 : { *(.debug_str) }
  195. .debug_loc 0 : { *(.debug_loc) }
  196. .debug_macinfo 0 : { *(.debug_macinfo) }
  197. /* SGI/MIPS DWARF 2 extensions */
  198. .debug_weaknames 0 : { *(.debug_weaknames) }
  199. .debug_funcnames 0 : { *(.debug_funcnames) }
  200. .debug_typenames 0 : { *(.debug_typenames) }
  201. .debug_varnames 0 : { *(.debug_varnames) }
  202. /* DWARF 3 */
  203. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  204. .debug_ranges 0 : { *(.debug_ranges) }
  205. /* DWARF Extension. */
  206. .debug_macro 0 : { *(.debug_macro) }
  207. .debug_addr 0 : { *(.debug_addr) }
  208. .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  209. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  210. }