public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] MIPS: Use 64-bit ABIs by default for `mipsisa64*-*-linux*' targets
@ 2023-08-20 14:58 YunQiang Su
  2023-08-20 14:58 ` [PATCH v2 2/4] Gold/MIPS: Use EM_MIPS instead of EM_MIPS_RS3_LE for little endian YunQiang Su
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: YunQiang Su @ 2023-08-20 14:58 UTC (permalink / raw)
  To: macro; +Cc: binutils, YunQiang Su

Following the arrangement in GCC select a 64-bit ABIs by default, either
n32 or n64, rather than o32 for `mipsisa64*-*-linux*' targets, just as
with the corresponding `mips64*-*-linux*' targets.
---
 bfd/config.bfd   |  8 ++++----
 gas/configure    |  6 +++---
 gas/configure.ac |  6 +++---
 ld/configure.tgt | 10 ++++++----
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/bfd/config.bfd b/bfd/config.bfd
index 29f1c77e11f..5ffbd30139a 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -957,21 +957,21 @@ case "${targ}" in
     targ_defvec=mips_elf32_be_vec
     targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
     ;;
-  mips64*el-*-linux*-gnuabi64)
+  mips64*el-*-linux*-gnuabi64 | mipsisa64*el-*-linux*-gnuabi64)
     targ_defvec=mips_elf64_trad_le_vec
     targ_selvecs="mips_elf64_trad_be_vec mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec"
     want64=true
     ;;
-  mips64*el-*-linux*)
+  mips64*el-*-linux* | mipsisa64*el-*-linux*)
     targ_defvec=mips_elf32_ntrad_le_vec
     targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec"
     ;;
-  mips64*-*-linux*-gnuabi64)
+  mips64*-*-linux*-gnuabi64 | mipsisa64*-*-linux*-gnuabi64)
     targ_defvec=mips_elf64_trad_be_vec
     targ_selvecs="mips_elf64_trad_le_vec mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec"
     want64=true
     ;;
-  mips64*-*-linux*)
+  mips64*-*-linux* | mipsisa64*-*-linux*)
     targ_defvec=mips_elf32_ntrad_be_vec
     targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
     ;;
diff --git a/gas/configure b/gas/configure
index 3c80fe5741a..1827e38690e 100755
--- a/gas/configure
+++ b/gas/configure
@@ -12256,11 +12256,11 @@ _ACEOF
 	esac
 	# Decide which ABI to target by default.
 	case ${target} in
-	  mips64*-openbsd* | mips64*-linux-gnuabi64)
+	  mips64*-openbsd* | mips64*-linux-gnuabi64 | mipsisa64*-linux-gnuabi64)
 	    mips_default_abi=N64_ABI
 	    ;;
-	  mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
-	  | mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
+	  mips64*-linux* | mipsisa64*-linux* | mips-sgi-irix6* \
+	  | mips64*-freebsd* | mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
 	    mips_default_abi=N32_ABI
 	    ;;
 	  mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu)
diff --git a/gas/configure.ac b/gas/configure.ac
index 3a04c39d344..ecfab6bf510 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -394,11 +394,11 @@ changequote([,])dnl
 	esac
 	# Decide which ABI to target by default.
 	case ${target} in
-	  mips64*-openbsd* | mips64*-linux-gnuabi64)
+	  mips64*-openbsd* | mips64*-linux-gnuabi64 | mipsisa64*-linux-gnuabi64)
 	    mips_default_abi=N64_ABI
 	    ;;
-	  mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
-	  | mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
+	  mips64*-linux* | mipsisa64*-linux* | mips-sgi-irix6* \
+	  | mips64*-freebsd* | mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
 	    mips_default_abi=N32_ABI
 	    ;;
 	  mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu)
diff --git a/ld/configure.tgt b/ld/configure.tgt
index f78ba07e5ca..92b1ac8f95a 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -585,21 +585,23 @@ mips*-*-vxworks*)	targ_emul=elf32ebmipvxworks
 			;;
 mips*-*-windiss)	targ_emul=elf32mipswindiss
 			;;
-mips64*el-*-linux-gnuabi64)
+mips64*el-*-linux-gnuabi64 | mipsisa64*el-*-linux-gnuabi64)
 			targ_emul=elf64ltsmip
 			targ_extra_emuls="elf64btsmip elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip"
 			targ_extra_libpath=$targ_extra_emuls
 			;;
-mips64*el-*-linux-*)	targ_emul=elf32ltsmipn32
+mips64*el-*-linux-* | mipsisa64*el-*-linux-*)
+			targ_emul=elf32ltsmipn32
 			targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
 			targ_extra_libpath=$targ_extra_emuls
 			;;
-mips64*-*-linux-gnuabi64)
+mips64*-*-linux-gnuabi64 | mipsisa64*-*-linux-gnuabi64)
 			targ_emul=elf64btsmip
 			targ_extra_emuls="elf64ltsmip elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip"
 			targ_extra_libpath=$targ_extra_emuls
 			;;
-mips64*-*-linux-*)	targ_emul=elf32btsmipn32
+mips64*-*-linux-* | mipsisa64*-*-linux-*)
+			targ_emul=elf32btsmipn32
 			targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
 			targ_extra_libpath=$targ_extra_emuls
 			;;
-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/4] Gold/MIPS: Use EM_MIPS instead of EM_MIPS_RS3_LE for little endian
  2023-08-20 14:58 [PATCH v2 1/4] MIPS: Use 64-bit ABIs by default for `mipsisa64*-*-linux*' targets YunQiang Su
@ 2023-08-20 14:58 ` YunQiang Su
  2023-08-20 14:58 ` [PATCH v2 3/4] Gold/MIPS: Drop mips*le triple pattern YunQiang Su
  2023-08-20 14:58 ` [PATCH v2 4/4] Gold/MIPS: Add MIPS64 support for --eanble-targets option YunQiang Su
  2 siblings, 0 replies; 4+ messages in thread
From: YunQiang Su @ 2023-08-20 14:58 UTC (permalink / raw)
  To: macro; +Cc: binutils, YunQiang Su

EM_MIPS_RS3_LE has been deprecated quite long ago, and in fact
most of current LE ELF files are using EM_MIPS.

This problem didn't make some trouble for us, is due to that
gold is a linker, and all of the inputs to it has right EM values.
---
 gold/configure.tgt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gold/configure.tgt b/gold/configure.tgt
index 4b54e08d27f..751c8fd06c6 100644
--- a/gold/configure.tgt
+++ b/gold/configure.tgt
@@ -155,7 +155,7 @@ aarch64*-*)
  ;;
 mips*el*-*-*|mips*le*-*-*)
  targ_obj=mips
- targ_machine=EM_MIPS_RS3_LE
+ targ_machine=EM_MIPS
  targ_size=32
  targ_big_endian=false
  targ_extra_big_endian=true
-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 3/4] Gold/MIPS: Drop mips*le triple pattern
  2023-08-20 14:58 [PATCH v2 1/4] MIPS: Use 64-bit ABIs by default for `mipsisa64*-*-linux*' targets YunQiang Su
  2023-08-20 14:58 ` [PATCH v2 2/4] Gold/MIPS: Use EM_MIPS instead of EM_MIPS_RS3_LE for little endian YunQiang Su
@ 2023-08-20 14:58 ` YunQiang Su
  2023-08-20 14:58 ` [PATCH v2 4/4] Gold/MIPS: Add MIPS64 support for --eanble-targets option YunQiang Su
  2 siblings, 0 replies; 4+ messages in thread
From: YunQiang Su @ 2023-08-20 14:58 UTC (permalink / raw)
  To: macro; +Cc: binutils, YunQiang Su

Only mips*el triples are supported by binutils, and mips*le may
cause some problem with other components of binutils, since
they will consider them as big endian.
---
 gold/configure.tgt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gold/configure.tgt b/gold/configure.tgt
index 751c8fd06c6..03e33f32baf 100644
--- a/gold/configure.tgt
+++ b/gold/configure.tgt
@@ -153,7 +153,7 @@ aarch64*-*)
  targ_big_endian=false
  targ_extra_big_endian=true
  ;;
-mips*el*-*-*|mips*le*-*-*)
+mips*el-*-*)
  targ_obj=mips
  targ_machine=EM_MIPS
  targ_size=32
-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 4/4] Gold/MIPS: Add MIPS64 support for --eanble-targets option
  2023-08-20 14:58 [PATCH v2 1/4] MIPS: Use 64-bit ABIs by default for `mipsisa64*-*-linux*' targets YunQiang Su
  2023-08-20 14:58 ` [PATCH v2 2/4] Gold/MIPS: Use EM_MIPS instead of EM_MIPS_RS3_LE for little endian YunQiang Su
  2023-08-20 14:58 ` [PATCH v2 3/4] Gold/MIPS: Drop mips*le triple pattern YunQiang Su
@ 2023-08-20 14:58 ` YunQiang Su
  2 siblings, 0 replies; 4+ messages in thread
From: YunQiang Su @ 2023-08-20 14:58 UTC (permalink / raw)
  To: macro; +Cc: binutils, YunQiang Su

Currently, if we pass only mips64 triples to --eanble-targets,
gold itself will link fail:

/usr/bin/ld: /usr/bin/ld: mips.o: in function `gold::Output_reloc<9, true, 32, true>::sort_before(gold::Output_reloc<9, true, 32, true> const&) const':
./builddir-mips/gold/../../gold/output.h:1276:(.text+0x2b44): undefined reference to `gold::Output_reloc<9, true, 32, true>::compare(gold::Output_reloc<9, true, 32, true> const&) const'
/usr/bin/ld: mips.o: in function `gold::Output_reloc<9, true, 32, false>::sort_before(gold::Output_reloc<9, true, 32, false> const&) const':
./builddir-mips/gold/../../gold/output.h:1276:(.text+0x2bb4): undefined reference to `gold::Output_reloc<9, true, 32, false>::compare(gold::Output_reloc<9, true, 32, false> const&) const'
/usr/bin/ld: mips.o: in function `gold::Output_reloc<9, true, 32, true>::sort_before(gold::Output_reloc<9, true, 32, true> const&) const':
./builddir-mips/gold/../../gold/output.h:1276:(.text+0x2d28): undefined reference to `gold::Output_reloc<9, true, 32, true>::compare(gold::Output_reloc<9, true, 32, true> const&) const'
/usr/bin/ld: mips.o: in function `gold::Output_reloc<9, true, 32, false>::sort_before(gold::Output_reloc<9, true, 32, false> const&) const':
./builddir-mips/gold/../../gold/output.h:1276:(.text+0x2df8): undefined reference to `gold::Output_reloc<9, true, 32, false>::compare(gold::Output_reloc<9, true, 32, false> const&) const'

Here, we add:
  mips64*el-*-* | mipsisa64*el-linux* for MIPS64 little endian;
  mips64*-*-* | mipsisa64*-linux* for MIPS64 big endian.
---
 gold/configure.tgt | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gold/configure.tgt b/gold/configure.tgt
index 03e33f32baf..1e6dc18d4b6 100644
--- a/gold/configure.tgt
+++ b/gold/configure.tgt
@@ -153,6 +153,13 @@ aarch64*-*)
  targ_big_endian=false
  targ_extra_big_endian=true
  ;;
+mips64*el-*-* | mipsisa64*el-linux*)
+ targ_obj=mips
+ targ_machine=EM_MIPS
+ targ_size=64
+ targ_big_endian=false
+ targ_extra_big_endian=true
+ ;;
 mips*el-*-*)
  targ_obj=mips
  targ_machine=EM_MIPS
@@ -160,6 +167,13 @@ mips*el-*-*)
  targ_big_endian=false
  targ_extra_big_endian=true
  ;;
+mips64*-*-* | mipsisa64*-linux*)
+ targ_obj=mips
+ targ_machine=EM_MIPS
+ targ_size=64
+ targ_big_endian=true
+ targ_extra_big_endian=false
+ ;;
 mips*-*-*)
  targ_obj=mips
  targ_machine=EM_MIPS
-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-20 14:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-20 14:58 [PATCH v2 1/4] MIPS: Use 64-bit ABIs by default for `mipsisa64*-*-linux*' targets YunQiang Su
2023-08-20 14:58 ` [PATCH v2 2/4] Gold/MIPS: Use EM_MIPS instead of EM_MIPS_RS3_LE for little endian YunQiang Su
2023-08-20 14:58 ` [PATCH v2 3/4] Gold/MIPS: Drop mips*le triple pattern YunQiang Su
2023-08-20 14:58 ` [PATCH v2 4/4] Gold/MIPS: Add MIPS64 support for --eanble-targets option YunQiang Su

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).