visium.sc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. # 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. /* Start and end of main stack. Assumes 256K of RAM. */
  36. ${RELOCATING+ _estack = 0xe0040000 - 4;}
  37. ${RELOCATING+ _sstack = 0xe0040000 - 64K;}
  38. /* End of heap. */
  39. ${RELOCATING+ _eheap = _sstack - 4;}
  40. MEMORY
  41. {
  42. init : ORIGIN = 0x00000000, LENGTH = 0x0003fffc
  43. scr : ORIGIN = 0x0003fffc, LENGTH = 0x00000004
  44. rom : ORIGIN = 0x00044000, LENGTH = 0x1ffbc000
  45. ram : ORIGIN = 0xe0000000, LENGTH = 0x10000000
  46. saferam : ORIGIN = 0xf0000000, LENGTH = 0x10000000
  47. }
  48. SECTIONS
  49. {
  50. .init ${RELOCATING-0} : {
  51. KEEP (*(.init))
  52. KEEP (*(.fini))
  53. ${RELOCATING+ _einit = .;}
  54. } ${RELOCATING+ > init}
  55. .text ${RELOCATING-0} : {
  56. ${RELOCATING+ _ftext = .;}
  57. *(.text)
  58. ${RELOCATING+*(.text.*)}
  59. ${RELOCATING+*(.gnu.linkonce.t.*)}
  60. ${RELOCATING+ _etext = .;}
  61. } ${RELOCATING+ > rom}
  62. .ctors ${RELOCATING-0} : {
  63. ${CONSTRUCTING+ . = ALIGN(4);}
  64. ${CONSTRUCTING+ __CTOR_LIST__ = .;}
  65. /* gcc uses crtbegin.o to find the start of
  66. the constructors, so we make sure it is
  67. first. Because this is a wildcard, it
  68. doesn't matter if the user does not
  69. actually link against crtbegin.o; the
  70. linker won't look for a file to match a
  71. wildcard. The wildcard also means that it
  72. doesn't matter which directory crtbegin.o
  73. is in. */
  74. KEEP (*crtbegin*.o(.ctors))
  75. /* We don't want to include the .ctor section from
  76. from the crtend.o file until after the sorted ctors.
  77. The .ctor section from the crtend file contains the
  78. end of ctors marker and it must be last. */
  79. KEEP (*(EXCLUDE_FILE (*crtend*.o) .ctors))
  80. KEEP (*(SORT(.ctors.*)))
  81. KEEP (*(.ctors))
  82. ${CONSTRUCTING+ __CTOR_END__ = .;}
  83. } ${RELOCATING+ > rom}
  84. .dtors ${RELOCATING-0} : {
  85. ${CONSTRUCTING+ __DTOR_LIST__ = .;}
  86. KEEP (*crtbegin*.o(.dtors))
  87. KEEP (*(EXCLUDE_FILE (*crtend*.o) .dtors))
  88. KEEP (*(SORT(.dtors.*)))
  89. KEEP (*(.dtors))
  90. ${CONSTRUCTING+ __DTOR_END__ = .;}
  91. } ${RELOCATING+ > rom}
  92. .rodata ${RELOCATING-0} : {
  93. ${RELOCATING+ . = ALIGN(4);}
  94. ${RELOCATING+ _srdata = .;}
  95. *(.rdata)
  96. *(.rodata)
  97. ${RELOCATING+*(.rodata.*)}
  98. ${RELOCATING+*(.gnu.linkonce.r.*)}
  99. ${RELOCATING+ . = ALIGN(4);}
  100. ${RELOCATING+ _erdata = .;}
  101. } ${RELOCATING+ > rom}
  102. .eh_frame ${RELOCATING-0} :
  103. {
  104. ${RELOCATING+PROVIDE (__eh_frame_begin = .);}
  105. *(.eh_frame)
  106. ${RELOCATING+ LONG (0);}
  107. ${RELOCATING+PROVIDE (__eh_frame_end = .);}
  108. } ${RELOCATING+ > rom}
  109. .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) } ${RELOCATING+ > rom}
  110. .jcr ${RELOCATING-0} : { *(.jcr) } ${RELOCATING+ > rom}
  111. .data ${RELOCATING-0} : {
  112. ${RELOCATING+ . = ALIGN(4);}
  113. ${RELOCATING+ _sdata = .;}
  114. *(.data)
  115. ${RELOCATING+*(.data.*)}
  116. ${RELOCATING+*(.gnu.linkonce.d.*)}
  117. ${RELOCATING+ . = ALIGN(4);}
  118. ${RELOCATING+ _edata = .;}
  119. } ${RELOCATING+ > ram}
  120. .bss ${RELOCATING-0} : {
  121. ${RELOCATING+ . = ALIGN(4);}
  122. ${RELOCATING+ __bss_start = .;}
  123. *(.bss)
  124. ${RELOCATING+*(.bss.*)}
  125. ${RELOCATING+*(.gnu.linkonce.b.*)}
  126. *(COMMON)
  127. ${RELOCATING+ . = ALIGN(4);}
  128. ${RELOCATING+ __bss_end = .;}
  129. ${RELOCATING+ _sheap = .;}
  130. } ${RELOCATING+ > ram}
  131. saferam ${RELOCATING-0} : {
  132. *(saferam)
  133. ${RELOCATING+ . = ALIGN(4);}
  134. ${RELOCATING+ unitidentry = .;}
  135. } ${RELOCATING+ > saferam}
  136. /* Stabs debugging sections. */
  137. .stab 0 : { *(.stab) }
  138. .stabstr 0 : { *(.stabstr) }
  139. .stab.excl 0 : { *(.stab.excl) }
  140. .stab.exclstr 0 : { *(.stab.exclstr) }
  141. .stab.index 0 : { *(.stab.index) }
  142. .stab.indexstr 0 : { *(.stab.indexstr) }
  143. .comment 0 : { *(.comment) }
  144. EOF
  145. . $srcdir/scripttempl/DWARF.sc
  146. cat <<EOF
  147. }
  148. /* Provide a default address for the simulated file-I/O device. */
  149. PROVIDE (_sim_fileio_register = 0x2fff0000);
  150. /* Provide a default address for the simulated command line device. */
  151. PROVIDE (_sim_cmdline_header = 0x2ffe0000);
  152. /* Provide a default address for the simulated 1 MHz clock. */
  153. PROVIDE (_sim_clock = 0x20002100);
  154. EOF