This patch addresses the problem of building GCC for mips with the
'--with-synci' configure option.  If you do that and then compile a
program with GCC and specify an architecture that does not support synci
(such as the -mips32 option), GCC will issue a warning that synci
is not supported.  This results in many problems including an inability
to build a multilib version of GCC that includes -mips32.  This
patch changes the gcc driver to pass --msynci-if-supported to cc1
instead of -msynci so that cc1 will only turn on synci if it is
supported on the architecture being compiled for and will leave it off
(and not generate a warning) if it is not supported on that architecture.
If the user specifically uses -msynci, they still get the warning.

Tested on mips-linux-gnu, OK for checkin?

Steve Ellcey
sell...@mips.com


2012-06-20  Steve Ellcey  <sell...@mips.com>

        * config.gcc: Set with_synci to synci-if-supported instead if synci.
        * config/mips/mips.c (mips_option_override): Check
        TARGET_SYNCI_IF_SUPPORTED and update target_flags.
        * config/mips/mips.opt (msynci-if-supported): New.


diff --git a/gcc/config.gcc b/gcc/config.gcc
index f2b0936..58ee3e9 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3281,7 +3281,7 @@ case "${target}" in
 
                case ${with_synci} in
                yes)
-                       with_synci=synci
+                       with_synci=synci-if-supported
                        ;;
                "" | no)
                        # No is the default.
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 5bcb7a8..f17d39b 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -16172,6 +16172,9 @@ mips_option_override (void)
           : !TARGET_BRANCHLIKELY))
     sorry ("%qs requires branch-likely instructions", "-mfix-r10000");
 
+  if (TARGET_SYNCI_IF_SUPPORTED && !TARGET_SYNCI && ISA_HAS_SYNCI)
+    target_flags |= MASK_SYNCI;
+
   if (TARGET_SYNCI && !ISA_HAS_SYNCI)
     {
       warning (0, "the %qs architecture does not support the synci "
diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt
index e3294a7..1dbce65 100644
--- a/gcc/config/mips/mips.opt
+++ b/gcc/config/mips/mips.opt
@@ -338,6 +338,9 @@ msynci
 Target Report Mask(SYNCI)
 Use synci instruction to invalidate i-cache
 
+msynci-if-supported
+Target Mask(SYNCI_IF_SUPPORTED) RejectNegative Undocumented
+
 mtune=
 Target RejectNegative Joined Var(mips_tune_option) ToLower 
Enum(mips_arch_opt_value)
 -mtune=PROCESSOR       Optimize the output for PROCESSOR

Reply via email to