From: Martin Liska Date: Thu, 7 May 2020 07:38:16 +0000 (+0200) Subject: lto-wrapper: split arguments of getenv ("MAKE"). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b24fc8a692e3f2a8bd89d7ccb230ad3c72323e73;p=gcc.git lto-wrapper: split arguments of getenv ("MAKE"). * lto-wrapper.c: Split arguments of MAKE environment variable. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e11bbcedb65..89d4ea348e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2020-05-07 Martin Liska + + * lto-wrapper.c: Split arguments of MAKE environment + variable. + 2020-05-07 Uroš Bizjak * config/alpha/alpha.c (alpha_atomic_assign_expand_fenv): Use diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 19d0c224dad..e34b6979d1f 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -1894,23 +1894,32 @@ cont: putenv (xstrdup ("MAKEFLAGS=")); putenv (xstrdup ("MFLAGS=")); } - new_argv[0] = getenv ("MAKE"); - if (!new_argv[0]) - new_argv[0] = "make"; - new_argv[1] = "-f"; - new_argv[2] = makefile; - i = 3; + + char **make_argv = buildargv (getenv ("MAKE")); + if (make_argv) + { + for (unsigned argc = 0; make_argv[argc]; argc++) + obstack_ptr_grow (&argv_obstack, make_argv[argc]); + } + else + obstack_ptr_grow (&argv_obstack, "make"); + + obstack_ptr_grow (&argv_obstack, "-f"); + obstack_ptr_grow (&argv_obstack, makefile); if (!jobserver) { snprintf (jobs, 31, "-j%ld", auto_parallel ? nthreads_var : parallel); - new_argv[i++] = jobs; + obstack_ptr_grow (&argv_obstack, jobs); } - new_argv[i++] = "all"; - new_argv[i++] = NULL; + obstack_ptr_grow (&argv_obstack, "all"); + obstack_ptr_grow (&argv_obstack, NULL); + new_argv = XOBFINISH (&argv_obstack, const char **); + pex = collect_execute (new_argv[0], CONST_CAST (char **, new_argv), NULL, NULL, PEX_SEARCH, false); do_wait (new_argv[0], pex); + freeargv (make_argv); maybe_unlink (makefile); makefile = NULL; for (i = 0; i < nr; ++i)