netbsd.h (TARGET_OS_CPP_BUILTINS): Add MIPS ABI CPP macros.
authorJason Thorpe <thorpej@wasabisystems.com>
Sun, 15 Sep 2002 19:15:28 +0000 (19:15 +0000)
committerJason Thorpe <thorpej@gcc.gnu.org>
Sun, 15 Sep 2002 19:15:28 +0000 (19:15 +0000)
* config/mips/netbsd.h (TARGET_OS_CPP_BUILTINS): Add
MIPS ABI CPP macros.
(TARGET_CPU_CPP_BUILTINS): Redefine.
(SUBTARGET_EXTRA_SPECS): Remove subtarget_endian_default.
(SUBTARGET_ENDIAN_DEFAULT_SPEC): Remove.

From-SVN: r57171

gcc/ChangeLog
gcc/config/mips/netbsd.h

index dbe92ef9cd6fbc575b4ccfbf77a237d77f275466..a379167e47e8451c4be8779fe58628472753fa4b 100644 (file)
@@ -1,3 +1,11 @@
+2002-09-15  Jason Thorpe  <thorpej@wasabisystems.com>
+
+       * config/mips/netbsd.h (TARGET_OS_CPP_BUILTINS): Add
+       MIPS ABI CPP macros.
+       (TARGET_CPU_CPP_BUILTINS): Redefine.
+       (SUBTARGET_EXTRA_SPECS): Remove subtarget_endian_default.
+       (SUBTARGET_ENDIAN_DEFAULT_SPEC): Remove.
+
 2002-09-15  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * ia64/aix.h (TARGET_OS_CPP_BUILTINS): Fix typo.
index 02ba41386e338f7b8c5e4535eebd925d983149ed..fa6291dd9eca87e6f1d53c643e0b956b99bd5c12 100644 (file)
@@ -38,9 +38,81 @@ Boston, MA 02111-1307, USA.  */
       builtin_assert ("machine=mips");                 \
       if (TARGET_LONG64)                               \
        builtin_define ("__LONG64");                    \
+                                                       \
+      if (mips_abi == ABI_EABI)                                \
+       builtin_define ("__mips_eabi");                 \
+      else if (mips_abi == ABI_N32)                    \
+       builtin_define ("__mips_n32");                  \
+      else if (mips_abi == ABI_64)                     \
+       builtin_define ("__mips_n64");                  \
+      else if (mips_abi == ABI_O64)                    \
+       builtin_define ("__mips_o64");                  \
     }                                                  \
   while (0)
 
+/* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD.
+   Specifically, they define too many namespace-invasive macros.  Override
+   them here.  Note this is structured for easy comparison to the version
+   in mips.h.
+
+   FIXME: This probably isn't the best solution.  But in the absense
+   of something better, it will have to do, for now.  */
+
+#undef TARGET_CPU_CPP_BUILTINS
+#define TARGET_CPU_CPP_BUILTINS()                              \
+  do                                                           \
+    {                                                          \
+      builtin_assert ("cpu=mips");                             \
+      builtin_define ("__mips__");                             \
+      builtin_define ("_mips");                                        \
+                                                               \
+      /* No _R3000 or _R4000.  */                              \
+      if (TARGET_64BIT)                                                \
+       builtin_define ("__mips64");                            \
+                                                               \
+      if (TARGET_FLOAT64)                                      \
+       builtin_define ("__mips_fpr=64");                       \
+      else                                                     \
+       builtin_define ("__mips_fpr=32");                       \
+                                                               \
+      if (TARGET_MIPS16)                                       \
+       builtin_define ("__mips16");                            \
+                                                               \
+      MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info);   \
+      MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info);   \
+                                                               \
+      if (ISA_MIPS1)                                           \
+       builtin_define ("__mips=1");                            \
+      else if (ISA_MIPS2)                                      \
+       builtin_define ("__mips=2");                            \
+      else if (ISA_MIPS3)                                      \
+       builtin_define ("__mips=3");                            \
+      else if (ISA_MIPS4)                                      \
+       builtin_define ("__mips=4");                            \
+      else if (ISA_MIPS32)                                     \
+       builtin_define ("__mips=32");                           \
+      else if (ISA_MIPS64)                                     \
+       builtin_define ("__mips=64");                           \
+                                                               \
+      if (TARGET_HARD_FLOAT)                                   \
+       builtin_define ("__mips_hard_float");                   \
+      else if (TARGET_SOFT_FLOAT)                              \
+       builtin_define ("__mips_soft_float");                   \
+                                                               \
+      if (TARGET_SINGLE_FLOAT)                                 \
+       builtin_define ("__mips_single_float");                 \
+                                                               \
+      if (TARGET_BIG_ENDIAN)                                   \
+       builtin_define ("__MIPSEB__");                          \
+      else                                                     \
+       builtin_define ("__MIPSEL__");                          \
+                                                               \
+      /* No language dialect defines.  */                      \
+                                                               \
+      /* ABIs handled in TARGET_OS_CPP_BUILTINS.  */           \
+    }                                                          \
+  while (0)
+
 
 /* Include the generic MIPS ELF configuration.  */
 #include <mips/elf.h>
@@ -60,17 +132,10 @@ Boston, MA 02111-1307, USA.  */
 /* Extra specs we need.  */
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS                                          \
-  { "subtarget_endian_default",        SUBTARGET_ENDIAN_DEFAULT_SPEC },        \
   { "netbsd_cpp_spec",         NETBSD_CPP_SPEC },                      \
   { "netbsd_link_spec",                NETBSD_LINK_SPEC_ELF },                 \
   { "netbsd_entry_point",      NETBSD_ENTRY_POINT },
 
-#if TARGET_ENDIAN_DEFAULT != 0
-#define SUBTARGET_ENDIAN_DEFAULT_SPEC "-D__MIPSEB__"
-#else
-#define SUBTARGET_ENDIAN_DEFAULT_SPEC "-D__MIPSEL__"
-#endif
-
 /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD.  */
 
 #undef SUBTARGET_CPP_SPEC