On Wed, Jul 31, 2019 at 09:20:40AM +0200, Martin Liška wrote: > One possible solution will be to adjust lto.exp: > > set LTO_OPTIONS [list \ > {-O0 -flto -flto-partition=none -fuse-linker-plugin} \ > {-O2 -flto -flto-partition=none -fuse-linker-plugin > -fno-fat-lto-objects } \ > {-O0 -flto -flto-partition=1to1 -fno-use-linker-plugin } \ > {-O2 -flto -flto-partition=1to1 -fno-use-linker-plugin } \ > > and replace all -flto with -flto=1. But still, many individual tests set > -flto by themselves. > Another solution would be to disable the auto-detection with an environment > variable: > > diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c > index 353187c6043..bb6fb2b53ff 100644 > --- a/gcc/lto-wrapper.c > +++ b/gcc/lto-wrapper.c > @@ -1423,7 +1423,7 @@ run_gcc (unsigned argc, char *argv[]) > auto_parallel = 0; > parallel = 0; > } > - else if (!jobserver && parallel) > + else if (!jobserver && parallel && !getenv ("LTO_NO_AUTO_PARALLEL")) > { > /* If there's no explicit usage of jobserver and > parallel is enabled, then automatically detect > diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp > index 25c934731df..e303894e0b0 100644 > --- a/gcc/testsuite/lib/lto.exp > +++ b/gcc/testsuite/lib/lto.exp > @@ -209,6 +209,8 @@ proc lto_init { args } { > ] > } > } > + > + setenv LTO_NO_AUTO_PARALLEL 1 > } > > # > > Can you Jakub test the patch or the s/-flto/-flto=1 solutions please?
Neither will work very well, we have thousands of -flto tests outside of lto.exp, e.g. dg-torture.exp (or libgomp and others) cycle through various options including -flto etc. Some env var would be useful I guess, though shouldn't it have GCC in the name? I mean, if we run into these fork-bomb problems in gcc, won't other projects run into those as well? Why doesn't the jobserver work in the tests? Is that because of missing + somewhere in the Makefiles or is something unsetting MFLAGS or MAKEFLAGS env vars? Though, as I said on IRC, I think we might run out of filedescriptors when using jobserver too, say if on 64 thread machine one does make -j64 -k check and each test simultaneously tries to create 64 partitions, that would be 4096 connections to the jobserver, right? Jakub