RE: [Patch] MIPS configuration patch to enable --with-[arch,endian,abi]

2014-11-06 Thread Steve Ellcey
On Fri, 2014-10-31 at 15:12 -0700, Matthew Fortune wrote:

 I'm not keen on adding support for --with-endian to mips. I believe that
 various build systems have become quite dependent on 'mips' meaning big
 endian and 'mipsel' being little endian. I'd prefer to remove that part
 unless you (or anyone else) can identify a reason why we should support
 it.

OK, I will remove the --with-endian part of the patch, that will also
take care of the issues Joseph had with the patch.

 This is OK if --with-endian support is removed, otherwise if you see a
 need for it then I'd like to see what Catherine thinks.
 
 Thanks,
 Matthew

Here is the patch with the endian support removed, I will go ahead and
check it in.

2014-11-06  Steve Ellcey  sell...@imgtec.com

* config.gcc (mips*-mti-linux*): Remove gnu_ld and gas assignments.
Set default_mips_arch and default_mips_abi instead of tm_defines.
(mips*-*-linux*): Set default_mips_arch and default_mips_abi instead
of tm_defines.
(mips*-*-*): Check with_arch and with_abi.  Set tm_defines.
* config/mips/mips.h (STANDARD_STARTFILE_PREFIX_1): Set default
based on MIPS_ABI_DEFAULT.
(STANDARD_STARTFILE_PREFIX_2): Ditto.


diff --git a/gcc/config.gcc b/gcc/config.gcc
index 10b0a6e..f1bfb65 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1952,30 +1952,30 @@ mips*-*-linux*) # Linux MIPS, 
either endian.
extra_options=${extra_options} linux-android.opt
case ${target} in
mipsisa32r2*)
-   tm_defines=${tm_defines} MIPS_ISA_DEFAULT=33
+   default_mips_arch=mips32r2
;;
mipsisa32*)
-   tm_defines=${tm_defines} MIPS_ISA_DEFAULT=32
+   default_mips_arch=mips32
;;
mips64el-st-linux-gnu)
-   tm_defines=${tm_defines} MIPS_ABI_DEFAULT=ABI_N32
+   default_mips_abi=n32
tm_file=${tm_file} mips/st.h
tmake_file=${tmake_file} mips/t-st
enable_mips_multilibs=yes
;;
mips64octeon*-*-linux*)
-   tm_defines=${tm_defines} MIPS_ABI_DEFAULT=ABI_N32
+   default_mips_abi=n32
tm_defines=${tm_defines} 
MIPS_CPU_STRING_DEFAULT=\\\octeon\\\
target_cpu_default=MASK_SOFT_FLOAT_ABI
enable_mips_multilibs=yes
;;
mipsisa64r2*-*-linux*)
-   tm_defines=${tm_defines} MIPS_ABI_DEFAULT=ABI_N32
-   tm_defines=${tm_defines} MIPS_ISA_DEFAULT=65
+   default_mips_abi=n32
+   default_mips_arch=mips64r2
enable_mips_multilibs=yes
;;
mips64*-*-linux* | mipsisa64*-*-linux*)
-   tm_defines=${tm_defines} MIPS_ABI_DEFAULT=ABI_N32
+   default_mips_abi=n32
enable_mips_multilibs=yes
;;
esac
@@ -4120,6 +4120,29 @@ case ${target} in
tm_defines=TARGET_ENDIAN_DEFAULT=0 $tm_defines
;;
esac
+   if test x$with_arch != x; then
+   default_mips_arch=$with_arch
+   fi
+   if test x$with_abi != x; then
+   default_mips_abi=$with_abi
+   fi
+   case ${default_mips_arch} in
+   mips1)tm_defines=$tm_defines MIPS_ISA_DEFAULT=1 ;;
+   mips2)tm_defines=$tm_defines MIPS_ISA_DEFAULT=2 ;;
+   mips3)tm_defines=$tm_defines MIPS_ISA_DEFAULT=3 ;;
+   mips4)tm_defines=$tm_defines MIPS_ISA_DEFAULT=4 ;;
+   mips32)   tm_defines=$tm_defines MIPS_ISA_DEFAULT=32 ;;
+   mips32r2) tm_defines=$tm_defines MIPS_ISA_DEFAULT=33 ;;
+   mips64)   tm_defines=$tm_defines MIPS_ISA_DEFAULT=64 ;;
+   mips64r2) tm_defines=$tm_defines MIPS_ISA_DEFAULT=65 ;;
+   esac
+   case ${default_mips_abi} in
+   32)   tm_defines=$tm_defines MIPS_ABI_DEFAULT=ABI_32 ;;
+   o64)  tm_defines=$tm_defines MIPS_ABI_DEFAULT=ABI_O64 ;;
+   n32)  tm_defines=$tm_defines MIPS_ABI_DEFAULT=ABI_N32 ;;
+   64)   tm_defines=$tm_defines MIPS_ABI_DEFAULT=ABI_64 ;;
+   eabi) tm_defines=$tm_defines MIPS_ABI_DEFAULT=ABI_EABI ;;
+   esac
tmake_file=mips/t-mips $tmake_file
;;
 
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index c7b998b..3b8469f 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -3009,3 

Re: [Patch] MIPS configuration patch to enable --with-[arch,endian,abi]

2014-10-31 Thread Joseph S. Myers
On Fri, 31 Oct 2014, Steve Ellcey  wrote:

 So the question is: should /lib and /usr/lib always be for the default GCC
 ABI (whatever that may be) or should /lib and /usr/lib always be for the
 MIPS (old) 32 ABI (with /lib32 and /usr/lib32 always being for the MIPS N32
 ABI and /lib64 and /usr/lib64 always being for the 64 MIPS ABI.  I chose the
 latter as it seemed clearer and more consistent and that is why I also
 needed to change mips.h to add the overrides of STANDARD_STARTFILE_PREFIX_1
 and STANDARD_STARTFILE_PREFIX_2.  These overrides are not needed if building
 a multilib GCC because then MULTILIB_OSDIRNAMES in t-linux64 takes care
 of everything, but they are needed if building a non-multilib GCC with a
 default ABI other than the old 32 bit ABI.

/lib and /usr/lib should always be for o32.

 + if test x$with_endian != x; then
 + default_mips_endian=$with_endian
 + fi

install.texi currently says --with-endian is only for SH; you'll need to 
update the documentation to say what versions of this option are supported 
for MIPS.  Also, t-linux64 uses

MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target,el)

to determine endianness for Debian multiarch purposes, and I think this 
will need to change when you allow --with-endian to control the 
endianness.

-- 
Joseph S. Myers
jos...@codesourcery.com


RE: [Patch] MIPS configuration patch to enable --with-[arch,endian,abi]

2014-10-31 Thread Matthew Fortune
Steve Ellcey  sell...@imgtec.com writes:
 Here is another MIPS configuration patch, this one allows the mips
 configuration to handle the --with-endian, --with-arch, and --with-abi
 configure options.  Basically instead of having targets set
 MIPS_ABI_DEFAULT
 and MIPS_ISA_DEFAULT directly in tm_defines based on their triplet names
 I have them set default_mips_arch and default_mips_abi.  Then, later
 in config.gcc, these can be overridden using the values from --with-arch
 and --with-abi and after that they are used to set MIPS_ABI_DEFAULT and
 MIPS_ISA_DEFAULT in tm_defines.  --with-endian is also handled this way.

I'm not keen on adding support for --with-endian to mips. I believe that
various build systems have become quite dependent on 'mips' meaning big
endian and 'mipsel' being little endian. I'd prefer to remove that part
unless you (or anyone else) can identify a reason why we should support
it.
 
 So the question is: should /lib and /usr/lib always be for the default GCC
 ABI (whatever that may be) or should /lib and /usr/lib always be for the
 MIPS (old) 32 ABI (with /lib32 and /usr/lib32 always being for the MIPS N32
 ABI and /lib64 and /usr/lib64 always being for the 64 MIPS ABI.  I chose
 the
 latter as it seemed clearer and more consistent and that is why I also

Agreed, the OS directories need to have fixed purposes.

This is OK if --with-endian support is removed, otherwise if you see a
need for it then I'd like to see what Catherine thinks.

Thanks,
Matthew