diff options
author | Andi Kleen <ak@linux.intel.com> | 2010-08-31 16:58:46 +0000 |
---|---|---|
committer | Andi Kleen <ak@gcc.gnu.org> | 2010-08-31 16:58:46 +0000 |
commit | a478ffff9550d91bf85532b2c6bf66d3051016c5 (patch) | |
tree | 1a55d621cc882fdcee8205efa2e197b4379a4ddd /gcc/lto-wrapper.c | |
parent | 7d2c38c0b9ae835080e7273bf61884e54b875961 (diff) | |
download | gcc-a478ffff9550d91bf85532b2c6bf66d3051016c5.tar.gz |
common.opt (fwhopr=): Update for -fwhopr=jobserver
* common.opt (fwhopr=): Update for -fwhopr=jobserver
* doc/invoke.texi (fwhopr): Document -fwhopr=jobserver.
* lto-wrapper.c (run_gcc): Add jobserver mode.
* opts.c (common_handle_option): Fix OPT_fwhopr for non numeric
argument.
From-SVN: r163680
Diffstat (limited to 'gcc/lto-wrapper.c')
-rw-r--r-- | gcc/lto-wrapper.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index da120b38e58..0ef8b8729ae 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -303,6 +303,7 @@ run_gcc (unsigned argc, char *argv[]) struct obstack env_obstack; bool seen_o = false; int parallel = 0; + int jobserver = 0; /* Get the driver and options. */ collect_gcc = getenv ("COLLECT_GCC"); @@ -373,9 +374,17 @@ run_gcc (unsigned argc, char *argv[]) lto_mode = LTO_MODE_WHOPR; if (option[7] == '=') { - parallel = atoi (option+8); - if (parallel <= 1) - parallel = 0; + if (!strcmp (option + 8, "jobserver")) + { + jobserver = 1; + parallel = 1; + } + else + { + parallel = atoi (option+8); + if (parallel <= 1) + parallel = 0; + } } } else @@ -567,23 +576,32 @@ cont: { struct pex_obj *pex; char jobs[32]; + fprintf (mstream, "all:"); for (i = 0; i < nr; ++i) fprintf (mstream, " \\\n\t%s", output_names[i]); fprintf (mstream, "\n"); fclose (mstream); - /* Avoid passing --jobserver-fd= and similar flags. */ - putenv (xstrdup ("MAKEFLAGS=")); - putenv (xstrdup ("MFLAGS=")); + if (!jobserver) + { + /* Avoid passing --jobserver-fd= and similar flags + unless jobserver mode is explicitly enabled. */ + 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; - snprintf (jobs, 31, "-j%d", parallel); - new_argv[3] = jobs; - new_argv[4] = "all"; - new_argv[5] = NULL; + i = 3; + if (!jobserver) + { + snprintf (jobs, 31, "-j%d", parallel); + new_argv[i++] = jobs; + } + new_argv[i++] = "all"; + new_argv[i++] = NULL; pex = collect_execute (CONST_CAST (char **, new_argv)); collect_wait (new_argv[0], pex); maybe_unlink_file (makefile); |