public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-7117] PR target/98878 - Incorrect multilib list for riscv*-rtems
@ 2021-02-05  6:27 Kito Cheng
  0 siblings, 0 replies; only message in thread
From: Kito Cheng @ 2021-02-05  6:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:072f20c555907cce38a424da47b6c1baa8330169

commit r11-7117-g072f20c555907cce38a424da47b6c1baa8330169
Author: Kito Cheng <kito.cheng@sifive.com>
Date:   Thu Jan 28 18:29:53 2021 +0800

    PR target/98878 - Incorrect multilib list for riscv*-rtems
    
     - Multi-lib only check the default argument is appeared in the multilib
       flag list, but we didn't check the case that the flag is required but
       default argument didn't provide.
    
     - For example riscv*-rtems has a multilib set:
    
         rv32imafd/ilp32d;@march=rv32imafd@mabi=ilp32d
    
       And when we set the default argument of arch to rv32imafdc and ABI to
       ilp32d, gcc will check the ilp32d is matched, but it didn't check
       rv32imafd is not provided by default arguments, so it should not
       reuse default library.
    
     - The side effcet of this patch is csky-elf target will increase the
       number of multilib from 54 to 59, but it's because genmultilib didn't
       know the default argument for multilib, so I think it could be
       improved in future.
    
    gcc/ChangeLog:
    
            * gcc.c (print_multilib_info): Check all required argument is provided
            by default arg.

Diff:
---
 gcc/gcc.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/gcc/gcc.c b/gcc/gcc.c
index aa5774af7e7..76f1d422f9a 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -9909,12 +9909,14 @@ print_multilib_info (void)
 	  last_path_len = p - this_path;
 	}
 
-      /* If this directory requires any default arguments, we can skip
-	 it.  We will already have printed a directory identical to
-	 this one which does not require that default argument.  */
+      /* If all required arguments are default arguments, and no default
+	 arguments appear in the ! argument list, then we can skip it.
+	 We will already have printed a directory identical to this one
+	 which does not require that default argument.  */
       if (! skip)
 	{
 	  const char *q;
+	  bool default_arg_ok = false;
 
 	  q = p + 1;
 	  while (*q != ';')
@@ -9946,16 +9948,29 @@ print_multilib_info (void)
 		     list.  */
 		  if (not_arg)
 		    {
-		      skip = 0;
+		      default_arg_ok = false;
 		      break;
 		    }
-		  else
-		    skip = 1;
+
+		  default_arg_ok = true;
+		}
+	      else if (!not_arg)
+		{
+		  /* Stop checking if any required argument is not provided by
+		     default arguments.  */
+		  default_arg_ok = false;
+		  break;
 		}
 
 	      if (*q == ' ')
 		++q;
 	    }
+
+	  /* Make sure all default argument is OK for this multi-lib set.  */
+	  if (default_arg_ok)
+	    skip = 1;
+	  else
+	    skip = 0;
 	}
 
       if (! skip)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-05  6:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05  6:27 [gcc r11-7117] PR target/98878 - Incorrect multilib list for riscv*-rtems Kito Cheng

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