[patch] MIPS/Linux: Let one select the default ABI for 64-bit
Maciej W. Rozycki
macro@ds2.pg.gda.pl
Tue May 20 21:03:00 GMT 2003
Hello,
There is currently no way to select the (n)64 ABI as the default for the
64-bit binutils for MIPS/Linux. Using (n)64 universally is a viable
option for a system, where maximum flexibility is desired and a moderate
code size growth or speed decrease is not of concern.
I propose to add another CPU configuration name, specifically "mipsn32"
to select the n32 ABI and let "mips64" mean (n)64. This way, for a given
system configuration, a proper canonical triplet exists and for 64-bit
MIPS/Linux native configurations config.guess could select between the
o32, n32 and (n)64 ABIs, based on what installed tools produce by default.
bfd/ChangeLog:
2003-05-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* config.bfd: Use n64 default vectors for mips64*-*-linux* and
mips64*el-*-linux*. Use n32 default vectors for mipsn32*-*-linux*
and mipsn32*el-*-linux*.
* configure.host: Recognize mipsn32*-*-linux*.
ld/ChangeLog:
2003-05-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* configure.tgt: Use n64 default emulations for
mips64*-*-linux-gnu* and mips64*el-*-linux-gnu*. Use n32 default
emulations for mipsn32*-*-linux-gnu* and mipsn32*el-*-linux-gnu*.
This patch works for both the trunk and 2.14. For the trunk, an
additional change to gas/configure.in is needed to set mips_default_abi
appropriately. For 2.14, a small change can be made to
gas/config/tc-mips.c.
What do you think?
At the tail, there is a config.sub patch as well, which is needed to use
the proposed changes, but isn't part of binutils.
Maciej
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
binutils-2.13.91-20030515-mips-64n32.patch
diff -up --recursive --new-file binutils.macro/bfd/config.bfd binutils/bfd/config.bfd
--- binutils.macro/bfd/config.bfd 2003-05-14 12:09:25.000000000 +0000
+++ binutils/bfd/config.bfd 2003-05-20 06:45:52.000000000 +0000
@@ -791,12 +791,20 @@ case "${targ}" in
;;
#ifdef BFD64
mips64*el-*-linux*)
- targ_defvec=bfd_elf32_ntradlittlemips_vec
- targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec"
+ targ_defvec=bfd_elf64_tradlittlemips_vec
+ targ_selvecs="bfd_elf64_tradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec"
;;
mips64*-*-linux*)
+ targ_defvec=bfd_elf64_tradbigmips_vec
+ targ_selvecs="bfd_elf64_tradlittlemips_vec bfd_elf32_ntradbigmips_vec bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec"
+ ;;
+ mipsn32*el-*-linux*)
+ targ_defvec=bfd_elf32_ntradlittlemips_vec
+ targ_selvecs="bfd_elf32_ntradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf32_tradbigmips_vec"
+ ;;
+ mipsn32*-*-linux*)
targ_defvec=bfd_elf32_ntradbigmips_vec
- targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec"
+ targ_selvecs="bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec bfd_elf32_tradbigmips_vec bfd_elf32_tradlittlemips_vec"
;;
#endif
mips*el-*-linux*)
diff -up --recursive --new-file binutils.macro/bfd/configure.host binutils/bfd/configure.host
--- binutils.macro/bfd/configure.host 2003-05-14 12:09:25.000000000 +0000
+++ binutils/bfd/configure.host 2003-05-20 06:49:29.000000000 +0000
@@ -50,7 +50,8 @@ mips*-sgi-irix6*) host64=true
HOST_64BIT_TYPE="long long";
HOST_U_64BIT_TYPE="unsigned long long";
;;
-mips64*-*-linux*) host64=true
+mips64*-*-linux*|mipsn32*-*-linux*)
+ host64=true
HOST_64BIT_TYPE="long long";
HOST_U_64BIT_TYPE="unsigned long long";
;;
diff -up --recursive --new-file binutils.macro/gas/configure.in binutils/gas/configure.in
--- binutils.macro/gas/configure.in 2003-05-14 12:10:13.000000000 +0000
+++ binutils/gas/configure.in 2003-05-20 06:54:22.000000000 +0000
@@ -527,7 +527,7 @@ changequote([,])dnl
mips)
# Set mips_cpu to the name of the default CPU.
case ${target_cpu} in
- mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el)
+ mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el | mipsn32| mipsn32el)
mips_cpu=from-abi
;;
mipsisa32 | mipsisa32el)
diff -up --recursive --new-file binutils.macro/ld/configure.tgt binutils/ld/configure.tgt
--- binutils.macro/ld/configure.tgt 2003-05-14 12:11:08.000000000 +0000
+++ binutils/ld/configure.tgt 2003-05-20 06:44:24.000000000 +0000
@@ -409,11 +409,18 @@ mips*el-*-rtems*) targ_emul=elf32elmip ;
mips*-*-rtems*) targ_emul=elf32ebmip ;;
mips*el-*-vxworks*) targ_emul=elf32elmip ;;
mips*-*-vxworks*) targ_emul=elf32ebmip ;;
-mips64*el-*-linux-gnu*) targ_emul=elf32ltsmipn32
- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
+mips64*el-*-linux-gnu*) targ_emul=elf64ltsmip
+ targ_extra_emuls="elf64btsmip elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip"
;;
-mips64*-*-linux-gnu*) targ_emul=elf32btsmipn32
- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
+mips64*-*-linux-gnu*) targ_emul=elf64btsmip
+ targ_extra_emuls="elf64ltsmip elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip"
+ ;;
+mipsn32*el-*-linux-gnu*)
+ targ_emul=elf32ltsmipn32
+ targ_extra_emuls="elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip elf32btsmip"
+ ;;
+mipsn32*-*-linux-gnu*) targ_emul=elf32btsmipn32
+ targ_extra_emuls="elf32ltsmipn32 elf64btsmip elf64ltsmip elf32btsmip elf32ltsmip"
;;
mips*el-*-linux-gnu*) targ_emul=elf32ltsmip
targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
binutils-2.13.91-20030515-mips-64n32-sub.patch
diff -up --recursive --new-file binutils.macro/config.sub binutils/config.sub
--- binutils.macro/config.sub 2003-05-14 12:12:16.000000000 +0000
+++ binutils/config.sub 2003-05-20 11:52:33.000000000 +0000
@@ -249,6 +249,7 @@ case $basic_machine in
| mipsisa64 | mipsisa64el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsn32 | mipsn32el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| msp430 \
@@ -321,6 +322,7 @@ case $basic_machine in
| mipsisa64-* | mipsisa64el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsn32 | mipsn32el \
| mipstx39-* | mipstx39el-* \
| msp430-* \
| none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
@@ -633,10 +635,10 @@ case $basic_machine in
os=-mint
;;
mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mipsn32/'`
;;
mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mipsn32/'`-unknown
;;
mmix*)
basic_machine=mmix-knuth
More information about the Binutils
mailing list