tic80coff.sc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # Linker script for TI TMS320C80 (tic80) COFF.
  2. #
  3. # Copyright (C) 2014-2015 Free Software Foundation, Inc.
  4. #
  5. # Copying and distribution of this file, with or without modification,
  6. # are permitted in any medium without royalty provided the copyright
  7. # notice and this notice are preserved.
  8. #
  9. # Besides the shell variables set by the emulparams script, and the LD_FLAG
  10. # variable, the genscripts.sh script will set the following variables for each
  11. # time this script is run to generate one of the linker scripts for ldscripts:
  12. #
  13. # RELOCATING: Set to a non-empty string when the linker is going to be doing
  14. # a final relocation.
  15. #
  16. # CONSTRUCTING: Set to a non-empty string when the linker is going to be
  17. # building global constructor and destructor tables.
  18. #
  19. # DATA_ALIGNMENT: Set to an ALIGN expression when the output should be page
  20. # aligned, or to "." when generating the -N script.
  21. #
  22. # CREATE_SHLIB: Set to a non-empty string when generating a script for
  23. # the -shared linker arg.
  24. test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x80000 + SIZEOF_HEADERS"
  25. test -z "$ENTRY" && ENTRY=__start
  26. cat <<EOF
  27. /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
  28. Copying and distribution of this script, with or without modification,
  29. are permitted in any medium without royalty provided the copyright
  30. notice and this notice are preserved. */
  31. OUTPUT_FORMAT("${OUTPUT_FORMAT}")
  32. ${LIB_SEARCH_DIRS}
  33. ${RELOCATING+ENTRY (${ENTRY})}
  34. SECTIONS
  35. {
  36. .text ${RELOCATING+ $TEXT_START_ADDR} : {
  37. *(.init)
  38. *(.fini)
  39. *(.text)
  40. }
  41. .const ALIGN(4) : {
  42. *(.const)
  43. }
  44. .ctors ALIGN(4) : {
  45. ${CONSTRUCTING+ . = ALIGN(4);}
  46. ${CONSTRUCTING+ ___CTOR_LIST__ = .;}
  47. ${CONSTRUCTING+ LONG(-1)}
  48. *(.ctors)
  49. ${CONSTRUCTING+ ___CTOR_END__ = .;}
  50. ${CONSTRUCTING+ LONG(0)}
  51. }
  52. .dtors ALIGN(4) : {
  53. ${CONSTRUCTING+ ___DTOR_LIST__ = .;}
  54. ${CONSTRUCTING+ LONG(-1)}
  55. ${CONSTRUCTING+ *(.dtors)}
  56. ${CONSTRUCTING+ ___DTOR_END__ = .;}
  57. ${CONSTRUCTING+ LONG(0)}
  58. }
  59. ${RELOCATING+ etext = .;}
  60. .data : {
  61. *(.data)
  62. ${RELOCATING+ __edata = .};
  63. }
  64. .bss : {
  65. ${RELOCATING+ __bss_start = .};
  66. *(.bss)
  67. *(COMMON)
  68. ${RELOCATING+ _end = ALIGN(0x8)};
  69. ${RELOCATING+ __end = ALIGN(0x8)};
  70. }
  71. .stab 0 ${RELOCATING+(NOLOAD)} :
  72. {
  73. [ .stab ]
  74. }
  75. .stabstr 0 ${RELOCATING+(NOLOAD)} :
  76. {
  77. [ .stabstr ]
  78. }
  79. }
  80. EOF