Blame SOURCES/gcc10-pr97524.patch

00b2fc
commit 6fade5a6044b7102758f4ca66c8715ebc12a6306
00b2fc
Author: Martin Liska <mliska@suse.cz>
00b2fc
Date:   Thu Oct 22 14:07:29 2020 +0200
00b2fc
00b2fc
    LTO: check that make command works
00b2fc
    
00b2fc
    gcc/ChangeLog:
00b2fc
    
00b2fc
            PR lto/97524
00b2fc
            * lto-wrapper.c (make_exists): New function.
00b2fc
            (run_gcc): Use it to check that make is present and working
00b2fc
            for parallel execution.
00b2fc
00b2fc
--- gcc/lto-wrapper.c
00b2fc
+++ gcc/lto-wrapper.c
00b2fc
@@ -1321,6 +1321,26 @@ jobserver_active_p (void)
00b2fc
 	  && is_valid_fd (wfd));
00b2fc
 }
00b2fc
 
00b2fc
+/* Test that a make command is present and working, return true if so.  */
00b2fc
+
00b2fc
+static bool
00b2fc
+make_exists (void)
00b2fc
+{
00b2fc
+  const char *make = "make";
00b2fc
+  char **make_argv = buildargv (getenv ("MAKE"));
00b2fc
+  if (make_argv)
00b2fc
+    make = make_argv[0];
00b2fc
+  const char *make_args[] = {make, "--version", NULL};
00b2fc
+
00b2fc
+  int exit_status = 0;
00b2fc
+  int err = 0;
00b2fc
+  const char *errmsg
00b2fc
+    = pex_one (PEX_SEARCH, make_args[0], CONST_CAST (char **, make_args),
00b2fc
+	       "make", NULL, NULL, &exit_status, &err;;
00b2fc
+  freeargv (make_argv);
00b2fc
+  return errmsg == NULL && exit_status == 0 && err == 0;
00b2fc
+}
00b2fc
+
00b2fc
 /* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */
00b2fc
 
00b2fc
 static void
00b2fc
@@ -1541,6 +1561,10 @@ run_gcc (unsigned argc, char *argv[])
00b2fc
       jobserver = 1;
00b2fc
     }
00b2fc
 
00b2fc
+  /* We need make working for a parallel execution.  */
00b2fc
+  if (parallel && !make_exists ())
00b2fc
+    parallel = 0;
00b2fc
+
00b2fc
   if (linker_output)
00b2fc
     {
00b2fc
       char *output_dir, *base, *name;