public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] loongarch: support new -mabi= and -mfpu= values
@ 2021-11-27 23:58 Xi Ruoyao
  2021-11-28  0:01 ` Xi Ruoyao
  0 siblings, 1 reply; 2+ messages in thread
From: Xi Ruoyao @ 2021-11-27 23:58 UTC (permalink / raw)
  To: binutils, Chenghua Xu

LoongArch Toolchain Conventions [1] has updated the definition of -mabi
and -mfpu.  Now the GCC port for LoongArch [2] under reviewing has already
adapted for those changes, and fails to build with current binutils.

[1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html
[2]: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585555.html

gas/
	* config/tc-loongarch.c (md_parse_option): Recognize new -mabi=
	  and -mfpu= values defined in LoongArch Toolchain Conventions.
---
 gas/config/tc-loongarch.c | 35 +++++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c
index f7235a18864..7ef0d53a06a 100644
--- a/gas/config/tc-loongarch.c
+++ b/gas/config/tc-loongarch.c
@@ -138,23 +138,43 @@ size_t md_longopts_size = sizeof (md_longopts);
 int
 md_parse_option (int c, const char *arg)
 {
-  int ret = 1;
+  int ret = 1, len, frspec = 0;
   switch (c)
     {
     case OPTION_ABI:
-      if (strcasecmp (arg, "lp64") == 0)
+      len = strlen (arg);
+      if (strncasecmp (arg, "lp64", 4) == 0)
 	{
 	  LARCH_opts.ase_abi |= EF_LOONGARCH_ABI_LP64;
 	  LARCH_opts.ase_ilp32 = 1;
 	  LARCH_opts.ase_lp64 = 1;
+
+	  if (len == 5)
+	    frspec = tolower(arg[4]);
+	  else if (len != 4)
+	    ret = 0;
 	}
-      else if (strcasecmp (arg, "ilp32") == 0)
+      else if (strncasecmp (arg, "ilp32", 5) == 0)
 	{
 	  LARCH_opts.ase_abi |= EF_LOONGARCH_ABI_ILP32;
 	  LARCH_opts.ase_ilp32 = 1;
+
+	  if (len == 6)
+	    frspec = tolower(arg[5]);
+	  else if (len != 5)
+	    ret = 0;
 	}
       else
 	ret = 0;
+
+      if (frspec == 's')
+	LARCH_opts.ase_abi |= EF_LOONGARCH_FLOAT_ABI_SOFT;
+      else if (frspec == 'f')
+	LARCH_opts.ase_abi |= EF_LOONGARCH_FLOAT_ABI_SINGLE;
+      else if (frspec == 'd')
+	LARCH_opts.ase_abi |= EF_LOONGARCH_FLOAT_ABI_DOUBLE;
+      else if (frspec)
+	ret = 0;
       break;
 
     case OPTION_FLOAT_ABI:
@@ -169,11 +189,14 @@ md_parse_option (int c, const char *arg)
       break;
 
     case OPTION_FLOAT_ISA:
-      if (strcasecmp (arg, "soft") == 0)
+      if (strcasecmp (arg, "soft") == 0 ||
+	  strcasecmp (arg, "none") == 0)
 	LARCH_opts.ase_nf = 1;
-      else if (strcasecmp (arg, "single") == 0)
+      else if (strcasecmp (arg, "single") == 0 ||
+	       strcmp (arg, "32") == 0)
 	LARCH_opts.ase_sf = 1;
-      else if (strcasecmp (arg, "double") == 0)
+      else if (strcasecmp (arg, "double") == 0 ||
+	       strcmp (arg, "64") == 0)
 	{
 	  LARCH_opts.ase_sf = 1;
 	  LARCH_opts.ase_df = 1;
-- 
2.34.1


-- 
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University

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

* Re: [PATCH] loongarch: support new -mabi= and -mfpu= values
  2021-11-27 23:58 [PATCH] loongarch: support new -mabi= and -mfpu= values Xi Ruoyao
@ 2021-11-28  0:01 ` Xi Ruoyao
  0 siblings, 0 replies; 2+ messages in thread
From: Xi Ruoyao @ 2021-11-28  0:01 UTC (permalink / raw)
  To: binutils, Chenghua Xu

On Sun, 2021-11-28 at 07:58 +0800, Xi Ruoyao wrote:
> LoongArch Toolchain Conventions [1] has updated the definition of -mabi
> and -mfpu.  Now the GCC port for LoongArch [2] under reviewing has already
> adapted for those changes, and fails to build with current binutils.
> 
> [1]: https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html
> [2]: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585555.html

Please ignore my noise: there is already
https://github.com/loongson/binutils-gdb/commit/aacb0bf860f02aa5a7dcb76dd0e392bf871c7586
(which will be submitted here soon).  I somehow didn't find it...

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

end of thread, other threads:[~2021-11-28  0:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 23:58 [PATCH] loongarch: support new -mabi= and -mfpu= values Xi Ruoyao
2021-11-28  0:01 ` Xi Ruoyao

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).