On 8/9/19 2:38 PM, Martin Liška wrote: > On 8/9/19 10:19 AM, Richard Biener wrote: >> OK with that. I still think that making -flto use a jobserver if detected >> (but _not_ use the number of CPU cores by default) makes >> sense as an independent change. > > In order to address that, I'm suggesting following patch that I've been > testing. > > Martin >
Hm, I take back the config changes. Martin
>From 1f9c9f74a84ec3ca930bbc9525ef2185200e0ce8 Mon Sep 17 00:00:00 2001 From: Martin Liska <mli...@suse.cz> Date: Fri, 9 Aug 2019 14:03:11 +0200 Subject: [PATCH] Automatically detect GNU jobserver with -flto. gcc/ChangeLog: 2019-08-09 Martin Liska <mli...@suse.cz> * doc/invoke.texi: Document automatic detection of jobserver. * lto-wrapper.c (run_gcc): Detect jobserver always. --- gcc/doc/invoke.texi | 3 ++- gcc/lto-wrapper.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 5b6b824bdd3..0000d358e48 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -10422,7 +10422,8 @@ job server mode to determine the number of parallel jobs. This is useful when the Makefile calling GCC is already executing in parallel. You must prepend a @samp{+} to the command recipe in the parent Makefile for this to work. This option likely only works if @env{MAKE} is -GNU make. +GNU make. Even without the option value, GCC tries to automatically +detect a running GNU make's job server. Use @option{-flto=auto} to use GNU make's job server, if available, or otherwise fall back to autodetection of the number of CPU threads diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index 84f59cf1a1f..339c379d972 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -1427,7 +1427,7 @@ run_gcc (unsigned argc, char *argv[]) auto_parallel = 0; parallel = 0; } - else if (!jobserver && auto_parallel) + else if (!jobserver) jobserver = jobserver_active_p (); if (linker_output) -- 2.22.0