This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [Patch] MIPS configuration patch to enable --with-[arch,endian,abi]
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: Matthew Fortune <Matthew dot Fortune at imgtec dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "clm at codesourcery dot com" <clm at codesourcery dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Date: Thu, 6 Nov 2014 11:05:06 -0800
- Subject: RE: [Patch] MIPS configuration patch to enable --with-[arch,endian,abi]
- Authentication-results: sourceware.org; auth=none
- References: <d5481be0-9d52-49f4-8b8f-cd43aee29611 at BAMAIL02 dot ba dot imgtec dot org> <6D39441BF12EF246A7ABCE6654B0235320F65183 at LEMAIL01 dot le dot imgtec dot org>
- Reply-to: <sellcey at imgtec dot com>
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 <sellcey@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 +3009,13 @@ extern GTY(()) struct target_globals *mips16_globals;
with arguments ARGS. */
#define PMODE_INSN(NAME, ARGS) \
(Pmode == SImode ? NAME ## _si ARGS : NAME ## _di ARGS)
+
+/* If we are *not* using multilibs and the default ABI is not ABI_32 we
+ need to change these from /lib and /usr/lib. */
+#if MIPS_ABI_DEFAULT == ABI_N32
+#define STANDARD_STARTFILE_PREFIX_1 "/lib32/"
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/"
+#elif MIPS_ABI_DEFAULT == ABI_64
+#define STANDARD_STARTFILE_PREFIX_1 "/lib64/"
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/"
+#endif