Blame SOURCES/gcc10-pr97524.patch

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