elf32msp430_3.sc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. # Copyright (C) 2014-2015 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. cat <<EOF
  7. /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
  8. Copying and distribution of this script, with or without modification,
  9. are permitted in any medium without royalty provided the copyright
  10. notice and this notice are preserved. */
  11. OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
  12. OUTPUT_ARCH(${ARCH})
  13. MEMORY
  14. {
  15. text (rx) : ORIGIN = $ROM_START, LENGTH = $ROM_SIZE
  16. data (rwx) : ORIGIN = $RAM_START, LENGTH = $RAM_SIZE
  17. vectors (rw) : ORIGIN = 0xffe0, LENGTH = 0x20
  18. }
  19. SECTIONS
  20. {
  21. /* Read-only sections, merged into text segment. */
  22. ${TEXT_DYNAMIC+${DYNAMIC}}
  23. .hash ${RELOCATING-0} : { *(.hash) }
  24. .dynsym ${RELOCATING-0} : { *(.dynsym) }
  25. .dynstr ${RELOCATING-0} : { *(.dynstr) }
  26. .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
  27. .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
  28. .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
  29. .rel.init ${RELOCATING-0} : { *(.rel.init) }
  30. .rela.init ${RELOCATING-0} : { *(.rela.init) }
  31. .rel.text ${RELOCATING-0} :
  32. {
  33. *(.rel.text)
  34. ${RELOCATING+*(.rel.text.*)}
  35. ${RELOCATING+*(.rel.gnu.linkonce.t*)}
  36. }
  37. .rela.text ${RELOCATING-0} :
  38. {
  39. *(.rela.text)
  40. ${RELOCATING+*(.rela.text.*)}
  41. ${RELOCATING+*(.rela.gnu.linkonce.t*)}
  42. }
  43. .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
  44. .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
  45. .rel.rodata ${RELOCATING-0} :
  46. {
  47. *(.rel.rodata)
  48. ${RELOCATING+*(.rel.rodata.*)}
  49. ${RELOCATING+*(.rel.gnu.linkonce.r*)}
  50. }
  51. .rela.rodata ${RELOCATING-0} :
  52. {
  53. *(.rela.rodata)
  54. ${RELOCATING+*(.rela.rodata.*)}
  55. ${RELOCATING+*(.rela.gnu.linkonce.r*)}
  56. }
  57. .rel.data ${RELOCATING-0} :
  58. {
  59. *(.rel.data)
  60. ${RELOCATING+*(.rel.data.*)}
  61. ${RELOCATING+*(.rel.gnu.linkonce.d*)}
  62. }
  63. .rela.data ${RELOCATING-0} :
  64. {
  65. *(.rela.data)
  66. ${RELOCATING+*(.rela.data.*)}
  67. ${RELOCATING+*(.rela.gnu.linkonce.d*)}
  68. }
  69. .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
  70. .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
  71. .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
  72. .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
  73. .rel.got ${RELOCATING-0} : { *(.rel.got) }
  74. .rela.got ${RELOCATING-0} : { *(.rela.got) }
  75. .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
  76. .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
  77. .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
  78. .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
  79. /* Internal text space. */
  80. .text :
  81. {
  82. ${RELOCATING+. = ALIGN(2);}
  83. *(SORT_NONE(.init))
  84. *(SORT_NONE(.init0)) /* Start here after reset. */
  85. *(SORT_NONE(.init1))
  86. *(SORT_NONE(.init2))
  87. *(SORT_NONE(.init3))
  88. *(SORT_NONE(.init4))
  89. *(SORT_NONE(.init5))
  90. *(SORT_NONE(.init6)) /* C++ constructors. */
  91. *(SORT_NONE(.init7))
  92. *(SORT_NONE(.init8))
  93. *(SORT_NONE(.init9)) /* Call main(). */
  94. ${CONSTRUCTING+ __ctors_start = . ; }
  95. ${CONSTRUCTING+ *(.ctors) }
  96. ${CONSTRUCTING+ __ctors_end = . ; }
  97. ${CONSTRUCTING+ __dtors_start = . ; }
  98. ${CONSTRUCTING+ *(.dtors) }
  99. ${CONSTRUCTING+ __dtors_end = . ; }
  100. ${RELOCATING+. = ALIGN(2);}
  101. *(.text)
  102. ${RELOCATING+. = ALIGN(2);}
  103. *(.text.*)
  104. ${RELOCATING+. = ALIGN(2);}
  105. *(.text:*)
  106. ${RELOCATING+. = ALIGN(2);}
  107. *(SORT_NONE(.fini9))
  108. *(SORT_NONE(.fini8))
  109. *(SORT_NONE(.fini7))
  110. *(SORT_NONE(.fini6)) /* C++ destructors. */
  111. *(SORT_NONE(.fini5))
  112. *(SORT_NONE(.fini4))
  113. *(SORT_NONE(.fini3))
  114. *(SORT_NONE(.fini2))
  115. *(SORT_NONE(.fini1))
  116. *(SORT_NONE(.fini0)) /* Infinite loop after program termination. */
  117. *(SORT_NONE(.fini))
  118. ${RELOCATING+ _etext = . ; }
  119. } ${RELOCATING+ > text}
  120. .rodata :
  121. {
  122. *(.rodata .rodata.* .gnu.linkonce.r.*)
  123. *(.const)
  124. *(.const:*)
  125. } ${RELOCATING+ > text}
  126. .data ${RELOCATING-0} :
  127. {
  128. ${RELOCATING+ PROVIDE (__data_start = .) ; }
  129. ${RELOCATING+. = ALIGN(2);}
  130. *(.data)
  131. *(.data.*)
  132. *(.gnu.linkonce.d*)
  133. ${RELOCATING+. = ALIGN(2);}
  134. ${RELOCATING+ _edata = . ; }
  135. } ${RELOCATING+ > data ${RELOCATING+AT> text}}
  136. .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
  137. {
  138. ${RELOCATING+. = ALIGN(2);}
  139. ${RELOCATING+ PROVIDE (__bss_start = .) ; }
  140. *(.bss)
  141. *(COMMON)
  142. ${RELOCATING+ PROVIDE (__bss_end = .) ; }
  143. } ${RELOCATING+ > data}
  144. .noinit ${RELOCATING+ SIZEOF(.bss) + ADDR(.bss)} :
  145. {
  146. ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
  147. *(.noinit)
  148. *(COMMON)
  149. ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
  150. } ${RELOCATING+ > data}
  151. .persistent ${RELOCATING+ SIZEOF(.noinit) + ADDR(.noinit)} :
  152. {
  153. ${RELOCATING+ PROVIDE (__persistent_start = .) ; }
  154. *(.persistent)
  155. ${RELOCATING+ PROVIDE (__persistent_end = .) ; }
  156. } ${RELOCATING+ > data}
  157. ${RELOCATING+ _end = . ;}
  158. .vectors ${RELOCATING-0}:
  159. {
  160. ${RELOCATING+ PROVIDE (__vectors_start = .) ; }
  161. *(.vectors*)
  162. ${RELOCATING+ _vectors_end = . ; }
  163. } ${RELOCATING+ > vectors}
  164. .MP430.attributes 0 :
  165. {
  166. KEEP (*(.MSP430.attributes))
  167. KEEP (*(.gnu.attributes))
  168. KEEP (*(__TI_build_attributes))
  169. }
  170. /* Stabs debugging sections. */
  171. .stab 0 : { *(.stab) }
  172. .stabstr 0 : { *(.stabstr) }
  173. .stab.excl 0 : { *(.stab.excl) }
  174. .stab.exclstr 0 : { *(.stab.exclstr) }
  175. .stab.index 0 : { *(.stab.index) }
  176. .stab.indexstr 0 : { *(.stab.indexstr) }
  177. .comment 0 : { *(.comment) }
  178. EOF
  179. . $srcdir/scripttempl/DWARF.sc
  180. cat <<EOF
  181. PROVIDE (__stack = ${STACK}) ;
  182. PROVIDE (__data_start_rom = _etext) ;
  183. PROVIDE (__data_end_rom = _etext + SIZEOF (.data)) ;
  184. PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ;
  185. PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ;
  186. }
  187. EOF