elfd30v.sc 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. # Copyright (C) 2014-2022 Free Software Foundation, Inc.
  2. #
  3. # Copying and distribution of this file, with or without modification,
  4. # are permitted in any medium without royalty provided the copyright
  5. # notice and this notice are preserved.
  6. CTOR=".ctors ${CONSTRUCTING-0} :
  7. {
  8. ${CONSTRUCTING+ __CTOR_LIST__ = .; }
  9. /* gcc uses crtbegin.o to find the start of
  10. the constructors, so we make sure it is
  11. first. Because this is a wildcard, it
  12. doesn't matter if the user does not
  13. actually link against crtbegin.o; the
  14. linker won't look for a file to match a
  15. wildcard. The wildcard also means that it
  16. doesn't matter which directory crtbegin.o
  17. is in. */
  18. KEEP (*crtbegin.o(.ctors))
  19. KEEP (*crtbegin?.o(.ctors))
  20. /* We don't want to include the .ctor section from
  21. the crtend.o file until after the sorted ctors.
  22. The .ctor section from the crtend file contains the
  23. end of ctors marker and it must be last */
  24. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))
  25. KEEP (*(SORT(.ctors.*)))
  26. KEEP (*(.ctors))
  27. ${CONSTRUCTING+ __CTOR_END__ = .; }
  28. } ${RELOCATING+ > ${DATA_MEMORY}}"
  29. DTOR=" .dtors ${CONSTRUCTING-0} :
  30. {
  31. ${CONSTRUCTING+ __DTOR_LIST__ = .; }
  32. KEEP (*crtbegin.o(.dtors))
  33. KEEP (*crtbegin?.o(.dtors))
  34. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))
  35. KEEP (*(SORT(.dtors.*)))
  36. KEEP (*(.dtors))
  37. ${CONSTRUCTING+ __DTOR_END__ = .; }
  38. } ${RELOCATING+ > ${DATA_MEMORY}}"
  39. cat <<EOF
  40. /* Copyright (C) 2014-2022 Free Software Foundation, Inc.
  41. Copying and distribution of this script, with or without modification,
  42. are permitted in any medium without royalty provided the copyright
  43. notice and this notice are preserved. */
  44. OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  45. OUTPUT_ARCH(${ARCH})
  46. EOF
  47. test -n "${RELOCATING}" && cat <<EOF
  48. MEMORY
  49. {
  50. text ${TEXT_DEF_SECTION} : ORIGIN = ${TEXT_START_ADDR}, LENGTH = ${TEXT_SIZE}
  51. data ${DATA_DEF_SECTION} : ORIGIN = ${DATA_START_ADDR}, LENGTH = ${DATA_SIZE}
  52. emem ${EMEM_DEF_SECTION} : ORIGIN = ${EMEM_START_ADDR}, LENGTH = ${EMEM_SIZE}
  53. eit : ORIGIN = ${EIT_START_ADDR}, LENGTH = ${EIT_SIZE}
  54. }
  55. EOF
  56. cat <<EOF
  57. SECTIONS
  58. {
  59. /* Read-only sections, merged into text segment: */
  60. ${TEXT_DYNAMIC+${DYNAMIC}}
  61. .hash ${RELOCATING-0} : { *(.hash) }
  62. .dynsym ${RELOCATING-0} : { *(.dynsym) }
  63. .dynstr ${RELOCATING-0} : { *(.dynstr) }
  64. .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
  65. .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
  66. .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
  67. .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.gnu.linkonce.t*}) }
  68. .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.gnu.linkonce.t*}) }
  69. .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.gnu.linkonce.d*}) }
  70. .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.gnu.linkonce.d*}) }
  71. .rel.rodata ${RELOCATING-0} : { *(.rel.rodata${RELOCATING+ .rel.gnu.linkonce.r*}) }
  72. .rela.rodata ${RELOCATING-0} : { *(.rela.rodata${RELOCATING+ .rela.gnu.linkonce.r*}) }
  73. .rel.stext ${RELOCATING-0} : { *(.rel.stest) }
  74. .rela.stext ${RELOCATING-0} : { *(.rela.stest) }
  75. .rel.etext ${RELOCATING-0} : { *(.rel.etest) }
  76. .rela.etext ${RELOCATING-0} : { *(.rela.etest) }
  77. .rel.sdata ${RELOCATING-0} : { *(.rel.sdata) }
  78. .rela.sdata ${RELOCATING-0} : { *(.rela.sdata) }
  79. .rel.edata ${RELOCATING-0} : { *(.rel.edata) }
  80. .rela.edata ${RELOCATING-0} : { *(.rela.edata) }
  81. .rel.eit_v ${RELOCATING-0} : { *(.rel.eit_v) }
  82. .rela.eit_v ${RELOCATING-0} : { *(.rela.eit_v) }
  83. .rel.sbss ${RELOCATING-0} : { *(.rel.sbss) }
  84. .rela.sbss ${RELOCATING-0} : { *(.rela.sbss) }
  85. .rel.ebss ${RELOCATING-0} : { *(.rel.ebss) }
  86. .rela.ebss ${RELOCATING-0} : { *(.rela.ebss) }
  87. .rel.srodata ${RELOCATING-0} : { *(.rel.srodata) }
  88. .rela.srodata ${RELOCATING-0} : { *(.rela.srodata) }
  89. .rel.erodata ${RELOCATING-0} : { *(.rel.erodata) }
  90. .rela.erodata ${RELOCATING-0} : { *(.rela.erodata) }
  91. .rel.got ${RELOCATING-0} : { *(.rel.got) }
  92. .rela.got ${RELOCATING-0} : { *(.rela.got) }
  93. .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
  94. .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
  95. .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
  96. .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
  97. .rel.init ${RELOCATING-0} : { *(.rel.init) }
  98. .rela.init ${RELOCATING-0} : { *(.rela.init) }
  99. .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
  100. .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
  101. .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
  102. .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
  103. .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
  104. .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
  105. .init ${RELOCATING-0} : { KEEP (*(SORT_NONE(.init))) } =${NOP-0}
  106. ${DATA_PLT-${PLT}}
  107. /* Internal text space */
  108. .stext ${RELOCATING-0} : { *(.stext) } ${RELOCATING+ > text}
  109. /* Internal text space or external memory */
  110. .text :
  111. {
  112. *(.text)
  113. ${RELOCATING+*(.gnu.linkonce.t*)
  114. KEEP (*(SORT_NONE(.fini)))
  115. _etext = . ;}
  116. } ${RELOCATING+ > ${TEXT_MEMORY}}
  117. /* Internal data space */
  118. .srodata ${RELOCATING-0} : { *(.srodata) } ${RELOCATING+ > data}
  119. .sdata ${RELOCATING-0} : { *(.sdata) } ${RELOCATING+ > data}
  120. /* Internal data space or external memory */
  121. .rodata ${RELOCATING-0} : { *(.rodata) } ${RELOCATING+ > ${DATA_MEMORY}}
  122. /* C++ exception support. */
  123. .eh_frame ${RELOCATING-0} : { KEEP (*(.eh_frame)) } ${RELOCATING+ > ${DATA_MEMORY}}
  124. .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } ${RELOCATING+ > ${DATA_MEMORY}}
  125. /* Java class registration support. */
  126. .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } ${RELOCATING+ >${DATA_MEMORY}}
  127. ${RELOCATING+${CTOR}}
  128. ${RELOCATING+${DTOR}}
  129. .data ${RELOCATING-0} :
  130. {
  131. *(.data)
  132. ${RELOCATING+*(.gnu.linkonce.d*)}
  133. ${CONSTRUCTING+CONSTRUCTORS}
  134. ${RELOCATING+ _edata = . ; }
  135. } ${RELOCATING+ > ${DATA_MEMORY}}
  136. /* External memory */
  137. .etext ${RELOCATING-0} :
  138. {
  139. ${RELOCATING+ PROVIDE (__etext_start = .) ; }
  140. *(.etext)
  141. ${RELOCATING+ PROVIDE (__etext_end = .) ; }
  142. } ${RELOCATING+ > emem}
  143. .erodata ${RELOCATING-0} : { *(.erodata) } ${RELOCATING+ > emem}
  144. .edata ${RELOCATING-0} : { *(.edata) } ${RELOCATING+ > emem}
  145. .sbss ${RELOCATING-0} :
  146. {
  147. ${RELOCATING+ PROVIDE (__sbss_start = .) ; }
  148. *(.sbss)
  149. ${RELOCATING+ PROVIDE (__sbss_end = .) ; }
  150. } ${RELOCATING+ > data}
  151. .ebss ${RELOCATING-0} :
  152. {
  153. ${RELOCATING+ PROVIDE (__ebss_start = .) ; }
  154. *(.ebss)
  155. ${RELOCATING+ PROVIDE (__ebss_end = .) ; }
  156. } ${RELOCATING+ > data}
  157. .bss ${RELOCATING-0} :
  158. {
  159. ${RELOCATING+ PROVIDE (__bss_start = .) ; }
  160. *(.bss)
  161. ${RELOCATING+*(COMMON)}
  162. ${RELOCATING+ PROVIDE (__bss_end = .) ; }
  163. ${RELOCATING+ _end = . ; }
  164. } ${RELOCATING+ > ${DATA_MEMORY}}
  165. .eit_v ${RELOCATING-0} :
  166. {
  167. ${RELOCATING+ PROVIDE (__eit_start = .) ; }
  168. *(.eit_v)
  169. ${RELOCATING+ PROVIDE (__eit_end = .) ; }
  170. } ${RELOCATING+ > eit}
  171. /* Stabs debugging sections. */
  172. .stab 0 : { *(.stab) }
  173. .stabstr 0 : { *(.stabstr) }
  174. .stab.excl 0 : { *(.stab.excl) }
  175. .stab.exclstr 0 : { *(.stab.exclstr) }
  176. .stab.index 0 : { *(.stab.index) }
  177. .stab.indexstr 0 : { *(.stab.indexstr) }
  178. .comment 0 : { *(.comment) }
  179. EOF
  180. . $srcdir/scripttempl/DWARF.sc
  181. cat <<EOF
  182. ${RELOCATING+PROVIDE (__stack = ${STACK_START_ADDR});}
  183. }
  184. EOF