crisaout.sc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. cat <<EOF
  7. /* Copyright (C) 2014-2022 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("a.out-cris")
  12. OUTPUT_ARCH(cris)
  13. ${RELOCATING+ENTRY (__start)}
  14. SECTIONS
  15. {
  16. .text ${RELOCATING+ ${TEXT_START_ADDR}}:
  17. {
  18. CREATE_OBJECT_SYMBOLS;
  19. ${CONSTRUCTING+ __Stext = .;}
  20. ${RELOCATING+*(.startup)}
  21. *(.text)
  22. ${CONSTRUCTING+__start = DEFINED(__start) ? __start :
  23. DEFINED(_start) ? _start :
  24. DEFINED(start) ? start :
  25. DEFINED(.startup) ? .startup + 2 : 2;}
  26. ${RELOCATING+*(.text.*)}
  27. ${RELOCATING+*(.gnu.linkonce.t*)}
  28. ${RELOCATING+*(.rodata)}
  29. ${RELOCATING+*(.rodata.*)}
  30. ${RELOCATING+*(.gnu.linkonce.r*)}
  31. /* Do not "provide" init-start and fini-start symbols; they might be
  32. referred to weakly, so the linker would not override the zero
  33. default.
  34. FIXME: It's somewhat unexpected to have code emitted by the linker
  35. script. Some other mechanism could probably do better. */
  36. ${CONSTRUCTING+ . = ALIGN (2);}
  37. ${CONSTRUCTING+ ___init__start = .;}
  38. ${CONSTRUCTING+ PROVIDE (___do_global_ctors = .);}
  39. ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */}
  40. ${CONSTRUCTING+ SHORT (0xbe7e);}
  41. ${CONSTRUCTING+ KEEP (*(SORT_NONE(.init)))}
  42. ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */}
  43. ${CONSTRUCTING+ PROVIDE (__init__end = .);}
  44. ${CONSTRUCTING+ PROVIDE (___init__end = .);}
  45. ${CONSTRUCTING+ . = ALIGN (2);}
  46. ${CONSTRUCTING+ ___fini__start = .;}
  47. ${CONSTRUCTING+ PROVIDE (___do_global_dtors = .);}
  48. ${CONSTRUCTING+ SHORT (0xe1fc); /* push srp */}
  49. ${CONSTRUCTING+ SHORT (0xbe7e);}
  50. ${CONSTRUCTING+ KEEP (*(SORT_NONE(.fini)))}
  51. ${CONSTRUCTING+ SHORT (0x0d3e); /* jump [sp+] */}
  52. ${CONSTRUCTING+ PROVIDE (__fini__end = .);}
  53. ${CONSTRUCTING+ ___fini__end = .;}
  54. /* Cater to linking from ELF. */
  55. ${CONSTRUCTING+ PROVIDE(___ctors = .);}
  56. ${CONSTRUCTING+ ___elf_ctors_dtors_begin = .;}
  57. ${CONSTRUCTING+ KEEP (*crtbegin.o(.ctors))}
  58. ${CONSTRUCTING+ KEEP (*crtbegin?.o(.ctors))}
  59. ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))}
  60. ${CONSTRUCTING+ KEEP (*(SORT(.ctors.*)))}
  61. ${CONSTRUCTING+ KEEP (*(.ctors))}
  62. ${CONSTRUCTING+ PROVIDE(___ctors_end = .);}
  63. ${CONSTRUCTING+ PROVIDE(___dtors = .);}
  64. ${CONSTRUCTING+ KEEP (*crtbegin.o(.dtors))}
  65. ${CONSTRUCTING+ KEEP (*crtbegin?.o(.dtors))}
  66. ${CONSTRUCTING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))}
  67. ${CONSTRUCTING+ KEEP (*(SORT(.dtors.*)))}
  68. ${CONSTRUCTING+ KEEP (*(.dtors))}
  69. ${CONSTRUCTING+ PROVIDE(___dtors_end = .);}
  70. ${CONSTRUCTING+ ___elf_ctors_dtors_end = .;}
  71. /* We include objects that force alignment of the data segment.
  72. Unfortunately that sometimes causes a gap between .text and .data,
  73. which is not detectable since .data does not have a start address
  74. of itself in the a.out header. This should only matter for
  75. testing; for production use, .data is at a "known" location.
  76. We assume .data does not get an alignment larger than 32 bytes. */
  77. ${CONSTRUCTING+. = ALIGN (32);}
  78. ${CONSTRUCTING+ __Etext = .;}
  79. /* Deprecated, use __Etext. */
  80. ${CONSTRUCTING+ PROVIDE(_etext = .);}
  81. }
  82. /* Any dot-relative start-expression (such as "ALIGN(2)", also including
  83. the "default" .data alignment expression) will use the initial, raw
  84. size of .text and will be incorrect if the alignment used is less
  85. than the alignment for .text (which might depend on input and obj
  86. format). FIXME: Seems like a bug in ld. Seems hard to fix. Seems
  87. unimportant. */
  88. .data :
  89. {
  90. ${CONSTRUCTING+ __Sdata = .;}
  91. *(.data);
  92. ${RELOCATING+*(.data.*)}
  93. ${RELOCATING+*(.gnu.linkonce.d*)}
  94. ${RELOCATING+*(.eh_frame) /* FIXME: Make .text */}
  95. ${RELOCATING+*(.gcc_except_table)}
  96. /* See comment at ALIGN before __Etext. */
  97. ${CONSTRUCTING+. = ALIGN (32);}
  98. ${CONSTRUCTING+ __Edata = .;}
  99. /* Deprecated, use __Edata. */
  100. ${CONSTRUCTING+ PROVIDE(_edata = .);}
  101. }
  102. .bss :
  103. {
  104. /* Deprecated, use __Sbss. */
  105. ${CONSTRUCTING+ PROVIDE(_bss_start = .);}
  106. ${CONSTRUCTING+ __Sbss = .;}
  107. *(.bss)
  108. ${RELOCATING+*(.bss.*)}
  109. *(COMMON)
  110. ${CONSTRUCTING+ __Ebss = .;}
  111. /* Deprecated, use __Ebss or __Eall as appropriate. */
  112. ${CONSTRUCTING+ PROVIDE(_end = .);}
  113. ${CONSTRUCTING+ PROVIDE(__end = .);}
  114. }
  115. ${CONSTRUCTING+ __Eall = .;}
  116. /* Unfortunately, stabs are not mappable from ELF to a.out.
  117. It can probably be fixed with some amount of work. */
  118. /DISCARD/ :
  119. { *(.stab) *(.stab*) *(.debug) *(.debug*) *(.comment) *(.gnu.warning.*) }
  120. /* For the rsim and xsim simulators. */
  121. ${CONSTRUCTING+ PROVIDE(__Endmem = 0x10000000);}
  122. /* For elinux. */
  123. ${CONSTRUCTING+ PROVIDE(__Stacksize = 0);}
  124. }
  125. EOF