superh.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* Definitions of target machine for gcc for Super-H using sh-superh-elf.
  2. Copyright (C) 2001-2015 Free Software Foundation, Inc.
  3. This file is part of GNU CC.
  4. GNU CC is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GNU CC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. /* This header file is used when the vendor name is set to 'superh'.
  16. config.gcc already configured the compiler for SH4 only and switched
  17. the default endianess to little (although big endian is still available).
  18. This file configures the spec file to the default board configuration
  19. but in such a way that it can be overridden by a boardspecs file
  20. (using the -specs= option). This file is expected to disable the
  21. defaults and provide options --defsym _start and --defsym _stack
  22. which are required by the SuperH configuration of GNU ld.
  23. This file is intended to override sh.h. */
  24. #ifndef _SUPERH_H
  25. #define _SUPERH_H
  26. #endif
  27. /* Override the linker spec strings to use the new emulation
  28. The specstrings are concatenated as follows
  29. LINK_EMUL_PREFIX.(''|'32'|'64'|LINK_DEFAULT_CPU_EMUL).SUBTARGET_LINK_EMUL_SUFFIX
  30. */
  31. #undef LINK_EMUL_PREFIX
  32. #undef SUBTARGET_LINK_EMUL_SUFFIX
  33. #define LINK_EMUL_PREFIX "superh"
  34. #define SUBTARGET_LINK_EMUL_SUFFIX ""
  35. /* Add the SUBTARGET_LINK_SPEC to add the board and runtime support and
  36. change the endianness */
  37. #undef SUBTARGET_LINK_SPEC
  38. #if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
  39. #define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml|!mb:-EL}%{mb:-EB}"
  40. #else
  41. #define SUBTARGET_LINK_SPEC "%(board_link) %(ldruntime) %{ml:-EL}%{mb|!ml:-EB}"
  42. #endif
  43. /* This is used by the link spec if the boardspecs file is not used
  44. (for whatever reason).
  45. If the boardspecs file overrides this then an alternative can be used. */
  46. #undef SUBTARGET_EXTRA_SPECS
  47. #define SUBTARGET_EXTRA_SPECS \
  48. { "board_link", "--defsym _start=0x1000 --defsym _stack=0x30000" }, \
  49. { "asruntime", "" }, \
  50. { "cppruntime", "-D__GDB_SIM__" }, \
  51. { "cc1runtime", "" }, \
  52. { "ldruntime", "" }, \
  53. { "libruntime", "-lc -lgloss" }
  54. /* Set the SUBTARGET_CPP_SPEC to define __EMBEDDED_CROSS__ which has an effect
  55. on newlib and provide the runtime support */
  56. #undef SUBTARGET_CPP_SPEC
  57. #define SUBTARGET_CPP_SPEC \
  58. "-D__EMBEDDED_CROSS__ %{m4-100*:-D__SH4_100__} %{m4-200*:-D__SH4_200__} %{m4-300*:-D__SH4_300__} %{m4-340:-D__SH4_340__} %{m4-400:-D__SH4_400__} %{m4-500:-D__SH4_500__} \
  59. %(cppruntime)"
  60. /* Override the SUBTARGET_ASM_SPEC to add the runtime support */
  61. #undef SUBTARGET_ASM_SPEC
  62. #define SUBTARGET_ASM_SPEC "%{m4-100*|m4-200*:-isa=sh4} %{m4-400|m4-340:-isa=sh4-nommu-nofpu} %{m4-500:-isa=sh4-nofpu} %(asruntime)"
  63. /* Override the SUBTARGET_ASM_RELAX_SPEC so it doesn't interfere with the
  64. runtime support by adding -isa=sh4 in the wrong place. */
  65. #undef SUBTARGET_ASM_RELAX_SPEC
  66. #define SUBTARGET_ASM_RELAX_SPEC "%{!m4-100*:%{!m4-200*:%{!m4-300*:%{!m4-340:%{!m4-400:%{!m4-500:-isa=sh4}}}}}}"
  67. /* Create the CC1_SPEC to add the runtime support */
  68. #undef CC1_SPEC
  69. #define CC1_SPEC "%(cc1runtime)"
  70. #undef CC1PLUS_SPEC
  71. #define CC1PLUS_SPEC "%(cc1runtime)"
  72. /* Override the LIB_SPEC to add the runtime support */
  73. #undef LIB_SPEC
  74. #define LIB_SPEC "%{!shared:%{!symbolic:%(libruntime) -lc}} %{pg:-lprofile -lc}"
  75. /* Override STARTFILE_SPEC to add profiling and MMU support. */
  76. #undef STARTFILE_SPEC
  77. #define STARTFILE_SPEC \
  78. "%{!shared: %{!m4-400*:%{!m4-340*: %{pg:gcrt1-mmu.o%s}%{!pg:crt1-mmu.o%s}}}} \
  79. %{!shared: %{m4-340*|m4-400*: %{pg:gcrt1.o%s}%{!pg:crt1.o%s}}} \
  80. crti.o%s \
  81. %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"