-flto=jobserver does not use all CPU cores

R. Diez via gcc-help gcc-help@gcc.gnu.org
Wed Feb 19 10:10:00 GMT 2020

>> If I run GCC with -flto=jobserver, only 2 cores are apparently used,
>> even if the top-level makefile runs with -j 40. The increased linking
>> time also corroborates this.
> Can you show us the relevant parts of your makefile?

I think I know what is going on. It is easy to forget that you need to add a '+' character in front of the makefile recipe, in order for GNU 
Make to let the child processes inherit the jobserver file descriptors.

The trouble is, there does not seem to be a way to prepend that '+' special character with Autoconf/Automake. I posted a question about it here:

   Prepending '+' to the recipe line when linking with GCC's -flto=jobserve

But GCC's behaviour is probably still not quite right. If it is not getting those file descriptors, how come it uses 2 cores instead of 1, 
and how come it does not complain about not being able to open those file descriptors or properly contact the jobserver?

GNU Make does try to help in this scenario with the following warning:

make[1]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.


More information about the Gcc-help mailing list