linux.h: Sanity-check TARGET_CPU_DEFAULT for presence and contents.
authorHans-Peter Nilsson <hp@gcc.gnu.org>
Sat, 15 Dec 2007 21:37:37 +0000 (21:37 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Sat, 15 Dec 2007 21:37:37 +0000 (21:37 +0000)
* config/cris/linux.h: Sanity-check TARGET_CPU_DEFAULT for
presence and contents.
(CRIS_SUBTARGET_DEFAULT_ARCH): New macro, MASK_AVOID_GOTPLT for
v32, 0 otherwise.
(CRIS_CPP_SUBTARGET_SPEC, CRIS_CC1_SUBTARGET_SPEC,
CRIS_ASM_SUBTARGET_SPEC): Adjust for different
TARGET_CPU_DEFAULT.
(CRIS_SUBTARGET_DEFAULT): Add CRIS_SUBTARGET_DEFAULT_ARCH.

From-SVN: r130969

gcc/config/cris/linux.h

index becbac8405de72d268bfaaf93fa6f11826f3e306..0d0b7f4a7e7d578f2d54ff18cb8e1afca1f7586d 100644 (file)
@@ -35,6 +35,13 @@ along with GCC; see the file COPYING3.  If not see
 /* This file defines the macros for cris-axis-linux-gnu that are not
    covered by cris.h, elfos.h and (config/)linux.h.  */
 
+/* Make sure we have a valid TARGET_CPU_DEFAULT, so we can assume it
+   and take shortcuts below.  */
+#ifndef TARGET_CPU_DEFAULT
+#error "TARGET_CPU_DEFAULT not defined"
+#elif (TARGET_CPU_DEFAULT+0) != 10 && (TARGET_CPU_DEFAULT+0) != 32
+#error "TARGET_CPU_DEFAULT must be 10 or 32, or this file be updated"
+#endif
 
 /* Node: Instruction Output */
 
@@ -45,19 +52,41 @@ along with GCC; see the file COPYING3.  If not see
 /* These macros are CRIS-specific, but used in target driver macros.  */
 
 #undef CRIS_CPP_SUBTARGET_SPEC
-#define CRIS_CPP_SUBTARGET_SPEC \
+#if TARGET_CPU_DEFAULT == 32
+# define CRIS_CPP_SUBTARGET_SPEC \
+  "%{pthread:-D_REENTRANT}\
+   %{!march=*:%{!cpu=*:-D__arch_v32 -D__CRIS_arch_version=32}}"
+#else
+# define CRIS_CPP_SUBTARGET_SPEC \
   "%{pthread:-D_REENTRANT}\
    %{!march=*:%{!cpu=*:-D__arch_v10 -D__CRIS_arch_version=10}}"
+#endif
 
 #undef CRIS_CC1_SUBTARGET_SPEC
-#define CRIS_CC1_SUBTARGET_SPEC \
+#if TARGET_CPU_DEFAULT == 32
+# define CRIS_CC1_SUBTARGET_SPEC \
+ "%{!march=*:%{!cpu=*:-march=v32}}"
+#define CRIS_SUBTARGET_DEFAULT_ARCH MASK_AVOID_GOTPLT
+#else
+# define CRIS_CC1_SUBTARGET_SPEC \
  "%{!march=*:%{!cpu=*:-march=v10}}"
+#define CRIS_SUBTARGET_DEFAULT_ARCH 0
+#endif
 
 #undef CRIS_ASM_SUBTARGET_SPEC
-#define CRIS_ASM_SUBTARGET_SPEC \
- "--em=criself\
+#if TARGET_CPU_DEFAULT == 32
+# define CRIS_ASM_SUBTARGET_SPEC \
+ "--em=criself \
+  %{!march=*:%{!cpu=*:--march=v32}} \
+  %{!fleading-underscore:--no-underscore}\
+  %{fPIC|fpic|fPIE|fpie: --pic}"
+#else
+# define CRIS_ASM_SUBTARGET_SPEC \
+ "--em=criself \
+  %{!march=*:%{!cpu=*:--march=v10}} \
   %{!fleading-underscore:--no-underscore}\
   %{fPIC|fpic|fPIE|fpie: --pic}"
+#endif
 
 /* Previously controlled by target_flags.  */
 #undef TARGET_LINUX
@@ -67,7 +96,8 @@ along with GCC; see the file COPYING3.  If not see
 #define CRIS_SUBTARGET_DEFAULT                 \
   (MASK_SVINTO                                 \
    + MASK_ETRAX4_ADD                           \
-   + MASK_ALIGN_BY_32)
+   + MASK_ALIGN_BY_32                          \
+   + CRIS_SUBTARGET_DEFAULT_ARCH)
 
 #undef CRIS_DEFAULT_CPU_VERSION
 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG