* [PATCH] LTO: check that make command works
@ 2020-10-22 12:56 Martin Liška
2020-10-22 13:48 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Martin Liška @ 2020-10-22 12:56 UTC (permalink / raw)
To: gcc-patches; +Cc: Jan Hubicka, Richard Biener
Hello.
The patch is about checking that make command exists for lto-wrapper.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
gcc/ChangeLog:
PR lto/97524
* lto-wrapper.c (make_exists): New function.
(run_gcc): Use it to check that make is present and working
for parallel execution.
---
gcc/lto-wrapper.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 9072a3cc0fe..b2af3caa021 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -1334,6 +1334,26 @@ jobserver_active_p (void)
return JS_PREFIX "cannot access %<" JS_NEEDLE "%> file descriptors";
}
+/* Test that a make command is present and working, return true if so. */
+
+static bool
+make_exists (void)
+{
+ const char *make = "make";
+ char **make_argv = buildargv (getenv ("MAKE"));
+ if (make_argv)
+ make = make_argv[0];
+ const char *make_args[] = {make, "--version", NULL};
+
+ int exit_status = 0;
+ int err = 0;
+ const char *errmsg
+ = pex_one (PEX_SEARCH, make_args[0], CONST_CAST (char **, make_args),
+ "make", NULL, NULL, &exit_status, &err);
+ freeargv (make_argv);
+ return errmsg == NULL && exit_status == 0 && err == 0;
+}
+
/* Execute gcc. ARGC is the number of arguments. ARGV contains the arguments. */
static void
@@ -1570,6 +1590,10 @@ run_gcc (unsigned argc, char *argv[])
}
}
+ /* We need make working for a parallel execution. */
+ if (parallel && !make_exists ())
+ parallel = 0;
+
if (!dumppfx)
{
if (!linker_output
--
2.28.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] LTO: check that make command works
2020-10-22 12:56 [PATCH] LTO: check that make command works Martin Liška
@ 2020-10-22 13:48 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2020-10-22 13:48 UTC (permalink / raw)
To: Martin Liška, gcc-patches; +Cc: Jan Hubicka
On 10/22/20 6:56 AM, Martin Liška wrote:
> Hello.
>
> The patch is about checking that make command exists for lto-wrapper.
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
> Â Â Â Â PR lto/97524
> Â Â Â Â * lto-wrapper.c (make_exists): New function.
> Â Â Â Â (run_gcc): Use it to check that make is present and working
> Â Â Â Â for parallel execution.
OK
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-22 13:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22 12:56 [PATCH] LTO: check that make command works Martin Liška
2020-10-22 13:48 ` Jeff Law
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).