netbsd.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /* Definitions of target machine for GNU compiler, for MIPS NetBSD systems.
  2. Copyright (C) 1993-2015 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC 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. GCC 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. /* Define default target values. */
  16. #define TARGET_OS_CPP_BUILTINS() \
  17. do \
  18. { \
  19. NETBSD_OS_CPP_BUILTINS_ELF(); \
  20. builtin_define ("__NO_LEADING_UNDERSCORES__"); \
  21. builtin_define ("__GP_SUPPORT__"); \
  22. if (TARGET_LONG64) \
  23. builtin_define ("__LONG64"); \
  24. \
  25. if (TARGET_ABICALLS) \
  26. builtin_define ("__ABICALLS__"); \
  27. \
  28. if (mips_abi == ABI_32) \
  29. builtin_define ("__mips_o32"); \
  30. else if (mips_abi == ABI_EABI) \
  31. builtin_define ("__mips_eabi"); \
  32. else if (mips_abi == ABI_N32) \
  33. builtin_define ("__mips_n32"); \
  34. else if (mips_abi == ABI_64) \
  35. builtin_define ("__mips_n64"); \
  36. else if (mips_abi == ABI_O64) \
  37. builtin_define ("__mips_o64"); \
  38. } \
  39. while (0)
  40. /* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD.
  41. Specifically, they define too many namespace-invasive macros. Override
  42. them here. Note this is structured for easy comparison to the version
  43. in mips.h.
  44. FIXME: This probably isn't the best solution. But in the absence
  45. of something better, it will have to do, for now. */
  46. #undef TARGET_CPU_CPP_BUILTINS
  47. #define TARGET_CPU_CPP_BUILTINS() \
  48. do \
  49. { \
  50. builtin_assert ("cpu=mips"); \
  51. builtin_define ("__mips__"); \
  52. builtin_define ("_mips"); \
  53. \
  54. /* No _R3000 or _R4000. */ \
  55. if (TARGET_64BIT) \
  56. builtin_define ("__mips64"); \
  57. \
  58. if (TARGET_FLOAT64) \
  59. builtin_define ("__mips_fpr=64"); \
  60. else \
  61. builtin_define ("__mips_fpr=32"); \
  62. \
  63. if (TARGET_MIPS16) \
  64. builtin_define ("__mips16"); \
  65. \
  66. MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \
  67. MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \
  68. \
  69. if (ISA_MIPS1) \
  70. builtin_define ("__mips=1"); \
  71. else if (ISA_MIPS2) \
  72. builtin_define ("__mips=2"); \
  73. else if (ISA_MIPS3) \
  74. builtin_define ("__mips=3"); \
  75. else if (ISA_MIPS4) \
  76. builtin_define ("__mips=4"); \
  77. else if (mips_isa >= 32 && mips_isa < 64) \
  78. builtin_define ("__mips=32"); \
  79. else if (mips_isa >= 64) \
  80. builtin_define ("__mips=64"); \
  81. if (mips_isa_rev > 0) \
  82. builtin_define_with_int_value ("__mips_isa_rev", \
  83. mips_isa_rev); \
  84. \
  85. if (TARGET_HARD_FLOAT) \
  86. builtin_define ("__mips_hard_float"); \
  87. else if (TARGET_SOFT_FLOAT) \
  88. builtin_define ("__mips_soft_float"); \
  89. \
  90. if (TARGET_SINGLE_FLOAT) \
  91. builtin_define ("__mips_single_float"); \
  92. \
  93. if (TARGET_BIG_ENDIAN) \
  94. builtin_define ("__MIPSEB__"); \
  95. else \
  96. builtin_define ("__MIPSEL__"); \
  97. \
  98. /* No language dialect defines. */ \
  99. \
  100. /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \
  101. } \
  102. while (0)
  103. /* Extra specs we need. */
  104. #undef SUBTARGET_EXTRA_SPECS
  105. #define SUBTARGET_EXTRA_SPECS \
  106. { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
  107. { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
  108. { "netbsd_entry_point", NETBSD_ENTRY_POINT },
  109. /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */
  110. #undef SUBTARGET_CPP_SPEC
  111. #define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)"
  112. /* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
  113. This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
  114. the MIPS target. */
  115. #undef LINK_SPEC
  116. #define LINK_SPEC \
  117. "%{EL:-m elf32lmip} \
  118. %{EB:-m elf32bmip} \
  119. %(endian_spec) \
  120. %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} \
  121. %{mips32r6} %{mips64} %{mips64r6} \
  122. %(netbsd_link_spec)"
  123. #define NETBSD_ENTRY_POINT "__start"
  124. #undef SUBTARGET_ASM_SPEC
  125. #define SUBTARGET_ASM_SPEC \
  126. "%{!mno-abicalls: \
  127. %{!fno-PIC:%{!fno-pic:-KPIC}}}"
  128. /* -G is incompatible with -KPIC which is the default, so only allow objects
  129. in the small data section if the user explicitly asks for it. */
  130. #undef MIPS_DEFAULT_GVALUE
  131. #define MIPS_DEFAULT_GVALUE 0
  132. #undef ASM_FINAL_SPEC
  133. #undef SET_ASM_OP
  134. /* NetBSD hasn't historically provided _flush_cache(), but rather
  135. _cacheflush(), which takes the same arguments as the former. */
  136. #undef CACHE_FLUSH_FUNC
  137. #define CACHE_FLUSH_FUNC "_cacheflush"
  138. /* Make gcc agree with <machine/ansi.h> */
  139. #undef WCHAR_TYPE
  140. #define WCHAR_TYPE "int"
  141. #undef WCHAR_TYPE_SIZE
  142. #define WCHAR_TYPE_SIZE 32
  143. #undef WINT_TYPE
  144. #define WINT_TYPE "int"