diff mbox

[MIPS] Re-enable ABI->ISA inference

Message ID 6D39441BF12EF246A7ABCE6654B0235320F95F07@LEMAIL01.le.imgtec.org
State New
Headers show

Commit Message

Matthew Fortune Jan. 5, 2015, 11:09 p.m. UTC
The R6 patch introduced MIPS_ISA_LEVEL_SPEC into DRIVER_SELF_SPECS
for all configurations. One part of MIPS_ISA_LEVEL_SPEC is however
incompatible with those configurations which infer an ISA from an
ABI without specifically setting the default ISAs using
--with-arch-[32|64].

I.e. a generic mips-linux (--enable-targets=all) and
mips64-linux would fail to build the n32/n64 multilibs as -mips1
would be introduced by DRIVER_SELF_SPECS.

I have therefore split MIPS_ISA_LEVEL_SPEC into two. One part is
suitable for all confgurations and one part is only suitable for
configurations that infer an ABI from an ISA (these tend to be
cross-compiler vendor configurations)

I have built and checked the driver generated options for all
relevant configurations and everything appears to work.

Let me know if you can see any problems with this?

Thanks,
Matthew

gcc/

     * config/mips/mips.h (MIPS_ISA_LEVEL_SPEC): Only infer an ISA
     level from an ARCH; do not inject the default.
     (MIPS_DEFAULT_ISA_LEVEL_SPEC): New macro split out from
     MIPS_ISA_LEVEL_SPEC.
     (MIPS_ISA_NAN2008_SPEC): Update comment.
     (BASE_DRIVER_SELF_SPECS): Likewise.
     * config/mips/elfoabi.h (DRIVER_SELF_SPECS): Add
     MIPS_DEFAULT_ISA_LEVEL_SPEC.
     * config/mips/mti-elf.h (DRIVER_SELF_SPECS): Likewise.
     * config/mips/mti-linux.h (DRIVER_SELF_SPECS): Likewise.
     * config/mips/sde.h (DRIVER_SELF_SPECS): Likewise.
---
gcc/config/mips/elfoabi.h   |  3 +++
gcc/config/mips/mips.h      | 16 ++++++++++++----
gcc/config/mips/mti-elf.h   |  3 +++
gcc/config/mips/mti-linux.h |  3 +++
gcc/config/mips/sde.h       |  3 +++
5 files changed, 24 insertions(+), 4 deletions(-)

Comments

Moore, Catherine Jan. 13, 2015, 11:47 p.m. UTC | #1
> -----Original Message-----
> From: Matthew Fortune [mailto:Matthew.Fortune@imgtec.com]
> Sent: Monday, January 05, 2015 6:09 PM
> To: Moore, Catherine
> Cc: 'gcc-patches@gcc.gnu.org' (gcc-patches@gcc.gnu.org)
> Subject: [MIPS] Re-enable ABI->ISA inference
> 
> The R6 patch introduced MIPS_ISA_LEVEL_SPEC into DRIVER_SELF_SPECS for
> all configurations. One part of MIPS_ISA_LEVEL_SPEC is however
> incompatible with those configurations which infer an ISA from an ABI
> without specifically setting the default ISAs using --with-arch-[32|64].
> 
> I.e. a generic mips-linux (--enable-targets=all) and mips64-linux would fail to
> build the n32/n64 multilibs as -mips1 would be introduced by
> DRIVER_SELF_SPECS.
> 
> I have therefore split MIPS_ISA_LEVEL_SPEC into two. One part is suitable
> for all confgurations and one part is only suitable for configurations that infer
> an ABI from an ISA (these tend to be cross-compiler vendor configurations)
> 
> I have built and checked the driver generated options for all relevant
> configurations and everything appears to work.
> 
> Let me know if you can see any problems with this?
> 
> Thanks,
> Matthew
> 
> gcc/
> 
>      * config/mips/mips.h (MIPS_ISA_LEVEL_SPEC): Only infer an ISA
>      level from an ARCH; do not inject the default.
>      (MIPS_DEFAULT_ISA_LEVEL_SPEC): New macro split out from
>      MIPS_ISA_LEVEL_SPEC.
>      (MIPS_ISA_NAN2008_SPEC): Update comment.
>      (BASE_DRIVER_SELF_SPECS): Likewise.
>      * config/mips/elfoabi.h (DRIVER_SELF_SPECS): Add
>      MIPS_DEFAULT_ISA_LEVEL_SPEC.
>      * config/mips/mti-elf.h (DRIVER_SELF_SPECS): Likewise.
>      * config/mips/mti-linux.h (DRIVER_SELF_SPECS): Likewise.
>      * config/mips/sde.h (DRIVER_SELF_SPECS): Likewise.
> ---

This looks OK.
Matthew Fortune Jan. 14, 2015, 8:37 a.m. UTC | #2
Moore, Catherine <Catherine_Moore@mentor.com> writes:
> > gcc/
> >
> >      * config/mips/mips.h (MIPS_ISA_LEVEL_SPEC): Only infer an ISA
> >      level from an ARCH; do not inject the default.
> >      (MIPS_DEFAULT_ISA_LEVEL_SPEC): New macro split out from
> >      MIPS_ISA_LEVEL_SPEC.
> >      (MIPS_ISA_NAN2008_SPEC): Update comment.
> >      (BASE_DRIVER_SELF_SPECS): Likewise.
> >      * config/mips/elfoabi.h (DRIVER_SELF_SPECS): Add
> >      MIPS_DEFAULT_ISA_LEVEL_SPEC.
> >      * config/mips/mti-elf.h (DRIVER_SELF_SPECS): Likewise.
> >      * config/mips/mti-linux.h (DRIVER_SELF_SPECS): Likewise.
> >      * config/mips/sde.h (DRIVER_SELF_SPECS): Likewise.
> > ---
> 
> This looks OK.
Thanks, committed as r219580.

Matthew
diff mbox

Patch

diff --git a/gcc/config/mips/elfoabi.h b/gcc/config/mips/elfoabi.h
index d88a79c..1e775c0 100644
--- a/gcc/config/mips/elfoabi.h
+++ b/gcc/config/mips/elfoabi.h
@@ -20,6 +20,9 @@  along with GCC; see the file COPYING3.  If not see

 #undef DRIVER_SELF_SPECS
#define DRIVER_SELF_SPECS                           \
+  /* Set the ISA for the default multilib.  */                 \
+  MIPS_DEFAULT_ISA_LEVEL_SPEC,                            \
+                                               \
   /* Make sure a -mips option is present.  This helps us to pick    \
      the right multilib, and also makes the later specs easier      \
      to write.  */                                  \
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 4da256d..9dad480 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -704,8 +704,7 @@  struct mips_cpu_info {
#define MIPS_ARCH_OPTION_SPEC \
   MIPS_ISA_LEVEL_OPTION_SPEC "|march=*"

-/* A spec that infers a -mips argument from an -march argument,
-   or injects the default if no architecture is specified.  */
+/* A spec that infers a -mips argument from an -march argument.  */

 #define MIPS_ISA_LEVEL_SPEC \
   "%{" MIPS_ISA_LEVEL_OPTION_SPEC ":;: \
@@ -725,7 +724,13 @@  struct mips_cpu_info {
      %{march=mips64r2|march=loongson3a|march=octeon|march=xlp: -mips64r2} \
      %{march=mips64r3: -mips64r3} \
      %{march=mips64r5: -mips64r5} \
-     %{march=mips64r6: -mips64r6} \
+     %{march=mips64r6: -mips64r6}}"
+
+/* A spec that injects the default multilib ISA if no architecture is
+   specified.  */
+
+#define MIPS_DEFAULT_ISA_LEVEL_SPEC \
+  "%{" MIPS_ISA_LEVEL_OPTION_SPEC ":;: \
      %{!march=*: -" MULTILIB_ISA_DEFAULT "}}"

 /* A spec that infers a -mhard-float or -msoft-float setting from an
@@ -757,6 +762,7 @@  struct mips_cpu_info {
   "%{msynci|mno-synci:;:%{mips32r2|mips32r3|mips32r5|mips32r6|mips64r2 \
                 |mips64r3|mips64r5|mips64r6:-msynci;:-mno-synci}}"

+/* Infer a -mnan=2008 setting from a -mips argument.  */
#define MIPS_ISA_NAN2008_SPEC \
   "%{mnan*:;mips32r6|mips64r6:-mnan=2008}"

@@ -806,7 +812,9 @@  struct mips_cpu_info {
   {"mips-plt", "%{!mplt:%{!mno-plt:-m%(VALUE)}}" }, \
   {"synci", "%{!msynci:%{!mno-synci:-m%(VALUE)}}" }

-/* A spec that infers the -mdsp setting from an -march argument.  */
+/* A spec that infers the:
+   -mnan=2008 setting from a -mips argument,
+   -mdsp setting from a -march argument.  */
#define BASE_DRIVER_SELF_SPECS \
   MIPS_ISA_NAN2008_SPEC,       \
   "%{!mno-dsp: \
diff --git a/gcc/config/mips/mti-elf.h b/gcc/config/mips/mti-elf.h
index d6dc1bb..45cffd5 100644
--- a/gcc/config/mips/mti-elf.h
+++ b/gcc/config/mips/mti-elf.h
@@ -19,6 +19,9 @@  along with GCC; see the file COPYING3.  If not see

 #undef DRIVER_SELF_SPECS
#define DRIVER_SELF_SPECS                           \
+  /* Set the ISA for the default multilib.  */                 \
+  MIPS_DEFAULT_ISA_LEVEL_SPEC,                            \
+                                               \
   /* Make sure a -mips option is present.  This helps us to pick    \
      the right multilib, and also makes the later specs easier      \
      to write.  */                                  \
diff --git a/gcc/config/mips/mti-linux.h b/gcc/config/mips/mti-linux.h
index 5761ab7..9ea9ce5 100644
--- a/gcc/config/mips/mti-linux.h
+++ b/gcc/config/mips/mti-linux.h
@@ -31,6 +31,9 @@  along with GCC; see the file COPYING3.  If not see

 #undef DRIVER_SELF_SPECS
#define DRIVER_SELF_SPECS                           \
+  /* Set the ISA for the default multilib.  */                 \
+  MIPS_DEFAULT_ISA_LEVEL_SPEC,                            \
+                                               \
   /* Make sure a -mips option is present.  This helps us to pick    \
      the right multilib, and also makes the later specs easier      \
      to write.  */                                  \
diff --git a/gcc/config/mips/sde.h b/gcc/config/mips/sde.h
index c138949..e6b36cf 100644
--- a/gcc/config/mips/sde.h
+++ b/gcc/config/mips/sde.h
@@ -20,6 +20,9 @@  along with GCC; see the file COPYING3.  If not see

 #undef DRIVER_SELF_SPECS
#define DRIVER_SELF_SPECS                           \
+  /* Set the ISA for the default multilib.  */                 \
+  MIPS_DEFAULT_ISA_LEVEL_SPEC,                            \
+                                               \
   /* Make sure a -mips option is present.  This helps us to pick    \
      the right multilib, and also makes the later specs easier      \
      to write.  */                                  \