visium.sc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. # Many sections come in three flavours. There is the 'real' section,
  7. # like ".data". Then there are the per-procedure or per-variable
  8. # sections, generated by -ffunction-sections and -fdata-sections in GCC,
  9. # and useful for --gc-sections, which for a variable "foo" might be
  10. # ".data.foo". Then there are the linkonce sections, for which the linker
  11. # eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
  12. # The exact correspondences are:
  13. #
  14. # Section Linkonce section
  15. # .text .gnu.linkonce.t.foo
  16. # .rodata .gnu.linkonce.r.foo
  17. # .data .gnu.linkonce.d.foo
  18. # .bss .gnu.linkonce.b.foo
  19. # .sdata .gnu.linkonce.s.foo
  20. # .sbss .gnu.linkonce.sb.foo
  21. # .sdata2 .gnu.linkonce.s2.foo
  22. # .sbss2 .gnu.linkonce.sb2.foo
  23. # .debug_info .gnu.linkonce.wi.foo
  24. # .tdata .gnu.linkonce.td.foo
  25. # .tbss .gnu.linkonce.tb.foo
  26. # .lrodata .gnu.linkonce.lr.foo
  27. # .ldata .gnu.linkonce.l.foo
  28. # .lbss .gnu.linkonce.lb.foo
  29. #
  30. # Each of these can also have corresponding .rel.* and .rela.* sections.
  31. test -z "$ENTRY" && ENTRY=__start
  32. cat <<EOF
  33. OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  34. ENTRY(${ENTRY})
  35. EOF
  36. test -n "${RELOCATING}" && cat <<EOF
  37. /* Start and end of main stack. Assumes 256K of RAM. */
  38. _estack = 0xe0040000 - 4;
  39. _sstack = 0xe0040000 - 64K;
  40. /* End of heap. */
  41. _eheap = _sstack - 4;
  42. MEMORY
  43. {
  44. init : ORIGIN = 0x00000000, LENGTH = 0x0003fffc
  45. scr : ORIGIN = 0x0003fffc, LENGTH = 0x00000004
  46. rom : ORIGIN = 0x00044000, LENGTH = 0x1ffbc000
  47. ram : ORIGIN = 0xe0000000, LENGTH = 0x10000000
  48. saferam : ORIGIN = 0xf0000000, LENGTH = 0x10000000
  49. }
  50. EOF
  51. cat <<EOF
  52. SECTIONS
  53. {
  54. .init ${RELOCATING-0} : {
  55. KEEP (*(SORT_NONE(.init)))
  56. ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
  57. ${RELOCATING+ _einit = .;}
  58. } ${RELOCATING+ > init}
  59. .text ${RELOCATING-0} : {
  60. ${RELOCATING+ _ftext = .;}
  61. *(.text)
  62. ${RELOCATING+*(.text.*)}
  63. ${RELOCATING+*(.gnu.linkonce.t.*)}
  64. ${RELOCATING+ _etext = .;}
  65. } ${RELOCATING+ > rom}
  66. .ctors ${RELOCATING-0} : {
  67. ${CONSTRUCTING+ . = ALIGN(4);}
  68. ${CONSTRUCTING+ __CTOR_LIST__ = .;}
  69. /* gcc uses crtbegin.o to find the start of
  70. the constructors, so we make sure it is
  71. first. Because this is a wildcard, it
  72. doesn't matter if the user does not
  73. actually link against crtbegin.o; the
  74. linker won't look for a file to match a
  75. wildcard. The wildcard also means that it
  76. doesn't matter which directory crtbegin.o
  77. is in. */
  78. KEEP (*crtbegin*.o(.ctors))
  79. /* We don't want to include the .ctor section from
  80. from the crtend.o file until after the sorted ctors.
  81. The .ctor section from the crtend file contains the
  82. end of ctors marker and it must be last. */
  83. KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors))
  84. ${RELOCATING+KEEP (*(SORT(.ctors.*)))}
  85. KEEP (*(.ctors))
  86. ${CONSTRUCTING+ __CTOR_END__ = .;}
  87. } ${RELOCATING+ > rom}
  88. .dtors ${RELOCATING-0} : {
  89. ${CONSTRUCTING+ __DTOR_LIST__ = .;}
  90. KEEP (*crtbegin*.o(.dtors))
  91. KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors))
  92. ${RELOCATING+KEEP (*(SORT(.dtors.*)))}
  93. KEEP (*(.dtors))
  94. ${CONSTRUCTING+ __DTOR_END__ = .;}
  95. } ${RELOCATING+ > rom}
  96. .rodata ${RELOCATING-0} : {
  97. ${RELOCATING+ . = ALIGN(4);}
  98. ${RELOCATING+ _srdata = .;}
  99. ${RELOCATING+*(.rdata)}
  100. *(.rodata)
  101. ${RELOCATING+*(.rodata.*)}
  102. ${RELOCATING+*(.gnu.linkonce.r.*)}
  103. ${RELOCATING+ . = ALIGN(4);}
  104. ${RELOCATING+ _erdata = .;}
  105. } ${RELOCATING+ > rom}
  106. .eh_frame ${RELOCATING-0} :
  107. {
  108. ${RELOCATING+PROVIDE (__eh_frame_begin = .);}
  109. *(.eh_frame)
  110. ${RELOCATING+ LONG (0);}
  111. ${RELOCATING+PROVIDE (__eh_frame_end = .);}
  112. } ${RELOCATING+ > rom}
  113. .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } ${RELOCATING+ > rom}
  114. .jcr ${RELOCATING-0} : { *(.jcr) } ${RELOCATING+ > rom}
  115. .data ${RELOCATING-0} : {
  116. ${RELOCATING+ . = ALIGN(4);}
  117. ${RELOCATING+ _sdata = .;}
  118. *(.data)
  119. ${RELOCATING+*(.data.*)}
  120. ${RELOCATING+*(.gnu.linkonce.d.*)}
  121. ${RELOCATING+ . = ALIGN(4);}
  122. ${RELOCATING+ _edata = .;}
  123. } ${RELOCATING+ > ram}
  124. .bss ${RELOCATING-0} : {
  125. ${RELOCATING+ . = ALIGN(4);}
  126. ${RELOCATING+ __bss_start = .;}
  127. *(.bss)
  128. ${RELOCATING+*(.bss.*)}
  129. ${RELOCATING+*(.gnu.linkonce.b.*)}
  130. ${RELOCATING+*(COMMON)}
  131. ${RELOCATING+ . = ALIGN(4);}
  132. ${RELOCATING+ __bss_end = .;}
  133. ${RELOCATING+ _sheap = .;}
  134. } ${RELOCATING+ > ram}
  135. saferam ${RELOCATING-0} : {
  136. *(saferam)
  137. ${RELOCATING+ . = ALIGN(4);}
  138. ${RELOCATING+ unitidentry = .;}
  139. } ${RELOCATING+ > saferam}
  140. /* Stabs debugging sections. */
  141. .stab 0 : { *(.stab) }
  142. .stabstr 0 : { *(.stabstr) }
  143. .stab.excl 0 : { *(.stab.excl) }
  144. .stab.exclstr 0 : { *(.stab.exclstr) }
  145. .stab.index 0 : { *(.stab.index) }
  146. .stab.indexstr 0 : { *(.stab.indexstr) }
  147. .comment 0 : { *(.comment) }
  148. EOF
  149. . $srcdir/scripttempl/DWARF.sc
  150. cat <<EOF
  151. }
  152. ${RELOCATING+
  153. /* Provide a default address for the simulated file-I/O device. */
  154. PROVIDE (_sim_fileio_register = 0x2fff0000);
  155. /* Provide a default address for the simulated command line device. */
  156. PROVIDE (_sim_cmdline_header = 0x2ffe0000);
  157. /* Provide a default address for the simulated 1 MHz clock. */
  158. PROVIDE (_sim_clock = 0x20002100);}
  159. EOF