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