gnu-user.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /* Definitions for MIPS systems using GNU userspace.
  2. Copyright (C) 1998-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. #undef WCHAR_TYPE
  16. #define WCHAR_TYPE "int"
  17. #undef WCHAR_TYPE_SIZE
  18. #define WCHAR_TYPE_SIZE 32
  19. #undef ASM_DECLARE_OBJECT_NAME
  20. #define ASM_DECLARE_OBJECT_NAME mips_declare_object_name
  21. /* If we don't set MASK_ABICALLS, we can't default to PIC. */
  22. #undef TARGET_DEFAULT
  23. #define TARGET_DEFAULT MASK_ABICALLS
  24. #define TARGET_OS_CPP_BUILTINS() \
  25. do { \
  26. GNU_USER_TARGET_OS_CPP_BUILTINS(); \
  27. /* The GNU C++ standard library requires this. */ \
  28. if (c_dialect_cxx ()) \
  29. builtin_define ("_GNU_SOURCE"); \
  30. } while (0)
  31. #undef SUBTARGET_CPP_SPEC
  32. #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
  33. /* A standard GNU/Linux mapping. On most targets, it is included in
  34. CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC
  35. and provides this hook instead. */
  36. #undef SUBTARGET_CC1_SPEC
  37. #define SUBTARGET_CC1_SPEC GNU_USER_TARGET_CC1_SPEC
  38. /* -G is incompatible with -KPIC which is the default, so only allow objects
  39. in the small data section if the user explicitly asks for it. */
  40. #undef MIPS_DEFAULT_GVALUE
  41. #define MIPS_DEFAULT_GVALUE 0
  42. #undef GNU_USER_TARGET_LINK_SPEC
  43. #define GNU_USER_TARGET_LINK_SPEC "\
  44. %{G*} %{EB} %{EL} %{mips*} %{shared} \
  45. %{!shared: \
  46. %{!static: \
  47. %{rdynamic:-export-dynamic} \
  48. %{mabi=n32: -dynamic-linker " GNU_USER_DYNAMIC_LINKERN32 "} \
  49. %{mabi=64: -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
  50. %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
  51. %{static}} \
  52. %{mabi=n32:-m" GNU_USER_LINK_EMULATIONN32 "} \
  53. %{mabi=64:-m" GNU_USER_LINK_EMULATION64 "} \
  54. %{mabi=32:-m" GNU_USER_LINK_EMULATION32 "}"
  55. #undef LINK_SPEC
  56. #define LINK_SPEC GNU_USER_TARGET_LINK_SPEC
  57. #undef SUBTARGET_ASM_SPEC
  58. #define SUBTARGET_ASM_SPEC \
  59. "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}"
  60. /* The MIPS assembler has different syntax for .set. We set it to
  61. .dummy to trap any errors. */
  62. #undef SET_ASM_OP
  63. #define SET_ASM_OP "\t.dummy\t"
  64. #undef ASM_OUTPUT_DEF
  65. #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
  66. do { \
  67. fputc ( '\t', FILE); \
  68. assemble_name (FILE, LABEL1); \
  69. fputs ( " = ", FILE); \
  70. assemble_name (FILE, LABEL2); \
  71. fputc ( '\n', FILE); \
  72. } while (0)
  73. /* The glibc _mcount stub will save $v0 for us. Don't mess with saving
  74. it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
  75. presence of $gp-relative calls. */
  76. #undef ASM_OUTPUT_REG_PUSH
  77. #undef ASM_OUTPUT_REG_POP
  78. #undef LIB_SPEC
  79. #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
  80. #ifdef HAVE_AS_NO_SHARED
  81. /* Default to -mno-shared for non-PIC. */
  82. # define NO_SHARED_SPECS \
  83. " %{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}"
  84. #else
  85. # define NO_SHARED_SPECS ""
  86. #endif
  87. /* -march=native handling only makes sense with compiler running on
  88. a MIPS chip. */
  89. #if defined(__mips__)
  90. extern const char *host_detect_local_cpu (int argc, const char **argv);
  91. # define EXTRA_SPEC_FUNCTIONS \
  92. { "local_cpu_detect", host_detect_local_cpu },
  93. # define MARCH_MTUNE_NATIVE_SPECS \
  94. " %{march=native:%<march=native %:local_cpu_detect(arch)}" \
  95. " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
  96. #else
  97. # define MARCH_MTUNE_NATIVE_SPECS ""
  98. #endif
  99. #define LINUX_DRIVER_SELF_SPECS \
  100. NO_SHARED_SPECS \
  101. MARCH_MTUNE_NATIVE_SPECS, \
  102. /* -mplt has no effect without -mno-shared. Simplify later \
  103. specs handling by removing a redundant option. */ \
  104. "%{!mno-shared:%<mplt}", \
  105. /* -mplt likewise has no effect for -mabi=64 without -msym32. */ \
  106. "%{mabi=64:%{!msym32:%<mplt}}", \
  107. "%{!EB:%{!EL:%(endian_spec)}}", \
  108. "%{!mabi=*: -" MULTILIB_ABI_DEFAULT "}"
  109. #undef DRIVER_SELF_SPECS
  110. #define DRIVER_SELF_SPECS \
  111. MIPS_ISA_LEVEL_SPEC, \
  112. BASE_DRIVER_SELF_SPECS, \
  113. LINUX_DRIVER_SELF_SPECS
  114. /* Similar to standard Linux, but adding -ffast-math support. */
  115. #undef GNU_USER_TARGET_MATHFILE_SPEC
  116. #define GNU_USER_TARGET_MATHFILE_SPEC \
  117. "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
  118. #undef ENDFILE_SPEC
  119. #define ENDFILE_SPEC \
  120. GNU_USER_TARGET_MATHFILE_SPEC " " \
  121. GNU_USER_TARGET_ENDFILE_SPEC
  122. #undef LOCAL_LABEL_PREFIX
  123. #define LOCAL_LABEL_PREFIX (TARGET_OLDABI ? "$" : ".")