lto-wrapper: split arguments of getenv ("MAKE").
authorMartin Liska <mliska@suse.cz>
Thu, 7 May 2020 07:38:16 +0000 (09:38 +0200)
committerMartin Liska <mliska@suse.cz>
Thu, 7 May 2020 07:38:16 +0000 (09:38 +0200)
* lto-wrapper.c: Split arguments of MAKE environment
variable.

gcc/ChangeLog
gcc/lto-wrapper.c

index e11bbcedb65f886f74f9a5a0cfb3a6b73c78f5a5..89d4ea348e9878005625f63f3fa678946b956add 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-07  Martin Liska  <mliska@suse.cz>
+
+       * lto-wrapper.c: Split arguments of MAKE environment
+       variable.
+
 2020-05-07  Uroš Bizjak  <ubizjak@gmail.com>
 
        * config/alpha/alpha.c (alpha_atomic_assign_expand_fenv): Use
index 19d0c224dadadaab2e0e6b9bdd7cf5809a4d64ca..e34b6979d1f6824f8a8449a4358b73f62e540d47 100644 (file)
@@ -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)