Blame SOURCES/gcc10-pr97524.patch

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