From 133479bde689a76b5dbedd7c5efa4ea95fab01f9 Mon Sep 17 00:00:00 2001 From: amylaar Date: Fri, 7 Nov 2003 17:44:57 +0000 Subject: [PATCH] Fix libstdc++-v3 build failure on sh64-elf: * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73338 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 ++++++ gcc/config/sh/sh-protos.h | 1 + gcc/config/sh/sh.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++ gcc/config/sh/sh.h | 3 +- 4 files changed, 102 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b990bc5..0e70f63 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2003-11-07 J"orn Rennecke + + * 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. + 2003-11-07 Jan Hubicka * i386.c (x86_64_sign_extended_value): Return false from tls variables. diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h index eb2f201..008d4bc 100644 --- a/gcc/config/sh/sh-protos.h +++ b/gcc/config/sh/sh-protos.h @@ -138,5 +138,6 @@ extern rtx sh_get_pr_initial_val (void); 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 */ diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index d84a36f..52f9500 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -48,6 +48,7 @@ Boston, MA 02111-1307, USA. */ #include "basic-block.h" #include "ra.h" #include "cfglayout.h" +#include "intl.h" int code_for_indirect_jump_scratch = CODE_FOR_indirect_jump_scratch; @@ -349,6 +350,9 @@ static tree sh_build_builtin_va_list (void); #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. */ @@ -6837,6 +6841,90 @@ sh_cfun_interrupt_handler_p (void) 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. */ diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 907e765..581f7ef 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -3242,7 +3242,8 @@ extern int rtx_equal_function_value_matters; : FP_MODE_NONE) #define MODE_AFTER(MODE, INSN) \ - (recog_memoized (INSN) >= 0 \ + (TARGET_HITACHI \ + && recog_memoized (INSN) >= 0 \ && get_attr_fp_set (INSN) != FP_SET_NONE \ ? get_attr_fp_set (INSN) \ : (MODE)) -- 2.7.4