mips.sc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # Linker script for MIPS systems.
  2. # Ian Lance Taylor <ian@cygnus.com>.
  3. #
  4. # Copyright (C) 2014-2015 Free Software Foundation, Inc.
  5. #
  6. # Copying and distribution of this file, with or without modification,
  7. # are permitted in any medium without royalty provided the copyright
  8. # notice and this notice are preserved.
  9. #
  10. # These variables may be overridden by the emulation file. The
  11. # defaults are appropriate for a DECstation running Ultrix.
  12. test -z "$ENTRY" && ENTRY=__start
  13. if [ -z "$EMBEDDED" ]; then
  14. test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000 + SIZEOF_HEADERS"
  15. else
  16. test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x400000"
  17. fi
  18. if test "x$LD_FLAG" = "xn" -o "x$LD_FLAG" = "xN"; then
  19. DATA_ADDR=.
  20. else
  21. test -z "$DATA_ADDR" && DATA_ADDR=0x10000000
  22. fi
  23. cat <<EOF
  24. /* Copyright (C) 2014-2015 Free Software Foundation, Inc.
  25. Copying and distribution of this script, with or without modification,
  26. are permitted in any medium without royalty provided the copyright
  27. notice and this notice are preserved. */
  28. OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
  29. "${LITTLE_OUTPUT_FORMAT}")
  30. ${LIB_SEARCH_DIRS}
  31. ${RELOCATING+ENTRY (${ENTRY})}
  32. SECTIONS
  33. {
  34. ${RELOCATING+. = ${TEXT_START_ADDR};}
  35. .text : {
  36. ${RELOCATING+ _ftext = . };
  37. *(.init)
  38. ${RELOCATING+ eprol = .};
  39. *(.text)
  40. *(.fini)
  41. ${RELOCATING+ etext = .};
  42. ${RELOCATING+ _etext = .};
  43. }
  44. ${RELOCATING+. = ${DATA_ADDR};}
  45. .rdata : {
  46. *(.rdata)
  47. }
  48. ${RELOCATING+ _fdata = ALIGN(16);}
  49. .data : {
  50. *(.data)
  51. ${CONSTRUCTING+CONSTRUCTORS}
  52. }
  53. ${RELOCATING+ HIDDEN (_gp = ALIGN (16) + 0x8000);}
  54. .lit8 : {
  55. *(.lit8)
  56. }
  57. .lit4 : {
  58. *(.lit4)
  59. }
  60. .sdata : {
  61. *(.sdata)
  62. }
  63. ${RELOCATING+ edata = .;}
  64. ${RELOCATING+ _edata = .;}
  65. ${RELOCATING+ _fbss = .;}
  66. .sbss : {
  67. *(.sbss)
  68. *(.scommon)
  69. }
  70. .bss : {
  71. *(.bss)
  72. *(COMMON)
  73. }
  74. ${RELOCATING+ end = .;}
  75. ${RELOCATING+ _end = .;}
  76. }
  77. EOF