patch applied: fix sh64-elf libstdc++-v3 build

Joern Rennecke joern.rennecke@superh.com
Fri Nov 7 17:51:00 GMT 2003


2003-11-07  J"orn Rennecke <joern.rennecke@superh.com>

	* sh-protos.h (sh_pch_valid_p): Declare.
	* sh.c ("intl.h"): Include.
	(TARGET_PCH_VALID_P): Override.
	(sh_target_switches): New variable.
	(target_switches): Define.
	(sh_pch_valid_p): New function.

	* sh.h (MODE_AFTER): Don't change mode unless TARGET_HITACHI.

Index: sh-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh-protos.h,v
retrieving revision 1.49
diff -p -r1.49 sh-protos.h
*** sh-protos.h	30 Oct 2003 02:02:47 -0000	1.49
--- sh-protos.h	7 Nov 2003 17:33:25 -0000
*************** extern rtx sh_get_pr_initial_val (void);
*** 138,142 ****
--- 138,143 ----
  extern rtx sh_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
  extern void sh_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
  extern int sh_pass_in_reg_p (CUMULATIVE_ARGS *, enum machine_mode, tree);
+ extern const char *sh_pch_valid_p (const void *data_p, size_t sz);
  
  #endif /* ! GCC_SH_PROTOS_H */
Index: sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.238
diff -p -r1.238 sh.c
*** sh.c	30 Oct 2003 02:02:47 -0000	1.238
--- sh.c	7 Nov 2003 17:33:26 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 48,53 ****
--- 48,54 ----
  #include "basic-block.h"
  #include "ra.h"
  #include "cfglayout.h"
+ #include "intl.h"
  
  int code_for_indirect_jump_scratch = CODE_FOR_indirect_jump_scratch;
  
*************** static tree sh_build_builtin_va_list (vo
*** 349,354 ****
--- 350,358 ----
  #undef TARGET_BUILD_BUILTIN_VA_LIST
  #define TARGET_BUILD_BUILTIN_VA_LIST sh_build_builtin_va_list
  
+ #undef TARGET_PCH_VALID_P
+ #define TARGET_PCH_VALID_P sh_pch_valid_p
+ 
  struct gcc_target targetm = TARGET_INITIALIZER;
  
  /* Print the operand address in x to the stream.  */
*************** sh_cfun_interrupt_handler_p (void)
*** 6836,6841 ****
--- 6840,6929 ----
    return (lookup_attribute ("interrupt_handler",
  			    DECL_ATTRIBUTES (current_function_decl))
  	  != NULL_TREE);
+ }
+ 
+ /* ??? target_switches in toplev.c is static, hence we have to duplicate it.  */
+ static const struct
+ {
+   const char *const name;
+   const int value;
+   const char *const description;
+ }
+ sh_target_switches[] = TARGET_SWITCHES;
+ #define target_switches sh_target_switches
+ 
+ /* Like default_pch_valid_p, but take flag_mask into account.  */
+ const char *
+ sh_pch_valid_p (const void *data_p, size_t len)
+ {
+   const char *data = (const char *)data_p;
+   const char *flag_that_differs = NULL;
+   size_t i;
+   int old_flags;
+   int flag_mask
+     = (SH1_BIT | SH2_BIT | SH3_BIT | SH_E_BIT | HARD_SH4_BIT | FPU_SINGLE_BIT
+        | SH4_BIT | HITACHI_BIT | LITTLE_ENDIAN_BIT);
+   
+   /* -fpic and -fpie also usually make a PCH invalid.  */
+   if (data[0] != flag_pic)
+     return _("created and used with different settings of -fpic");
+   if (data[1] != flag_pie)
+     return _("created and used with different settings of -fpie");
+   data += 2;
+ 
+   /* Check target_flags.  */
+   memcpy (&old_flags, data, sizeof (target_flags));
+   if (((old_flags ^ target_flags) & flag_mask) != 0)
+     {
+       for (i = 0; i < ARRAY_SIZE (target_switches); i++)
+ 	{
+ 	  int bits;
+ 
+ 	  bits = target_switches[i].value;
+ 	  if (bits < 0)
+ 	    bits = -bits;
+ 	  bits &= flag_mask;
+ 	  if ((target_flags & bits) != (old_flags & bits))
+ 	    {
+ 	      flag_that_differs = target_switches[i].name;
+ 	      goto make_message;
+ 	    }
+ 	}
+       abort ();
+     }
+   data += sizeof (target_flags);
+   len -= sizeof (target_flags);
+   
+   /* Check string options.  */
+ #ifdef TARGET_OPTIONS
+   for (i = 0; i < ARRAY_SIZE (target_options); i++)
+     {
+       const char *str = *target_options[i].variable;
+       size_t l;
+       if (! str)
+ 	str = "";
+       l = strlen (str) + 1;
+       if (len < l || memcmp (data, str, l) != 0)
+ 	{
+ 	  flag_that_differs = target_options[i].prefix;
+ 	  goto make_message;
+ 	}
+       data += l;
+       len -= l;
+     }
+ #endif
+ 
+   return NULL;
+   
+  make_message:
+   {
+     char *r;
+     asprintf (&r, _("created and used with differing settings of `-m%s'"),
+ 		  flag_that_differs);
+     if (r == NULL)
+       return _("out of memory");
+     return r;
+   }
  }
  
  /* Predicates used by the templates.  */
Index: sh.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.226
diff -p -r1.226 sh.h
*** sh.h	30 Oct 2003 02:02:48 -0000	1.226
--- sh.h	7 Nov 2003 17:33:26 -0000
*************** extern int rtx_equal_function_value_matt
*** 3242,3248 ****
     : FP_MODE_NONE)
  
  #define MODE_AFTER(MODE, INSN)                  \
!      (recog_memoized (INSN) >= 0                \
        && get_attr_fp_set (INSN) != FP_SET_NONE  \
        ? get_attr_fp_set (INSN)                  \
        : (MODE))
--- 3242,3249 ----
     : FP_MODE_NONE)
  
  #define MODE_AFTER(MODE, INSN)                  \
!      (TARGET_HITACHI				\
!       && recog_memoized (INSN) >= 0		\
        && get_attr_fp_set (INSN) != FP_SET_NONE  \
        ? get_attr_fp_set (INSN)                  \
        : (MODE))



More information about the Gcc-patches mailing list