Re: [PATCH] Add --jobserver/jobserver option for GCC -flto=jobserver

Zack Weinberg <[email protected]>
Newsgroups gmane.comp.sysutils.automake.patches
Message-ID <CAKCAbMj9v2WkA7JEmGk1DwnrO3VipuD00y1gsvS-a9p4Hukybg@mail.gmail.com>
On Wed, Oct 28, 2020 at 4:00 PM H.J. Lu <[email protected]> wrote:
> On Wed, Oct 28, 2020 at 11:40 AM Nick Bowler <[email protected]> wrote:
> > On 2020-10-28, Zack Weinberg <[email protected]> wrote:
> > > On Wed, Oct 28, 2020 at 2:16 PM Nick Bowler <[email protected]> wrote:
> > >> On 2020-10-28, H.J. Lu <[email protected]> wrote:
> > >> > GCC introduced some time ago option -flto=jobserver in order to use the
> > >> > GNU Make jobserver when parallelising LTO builds.  It is actually a
> > >> > similar "recursive make".  When doing a recursive make, you need to
> > >> > place a '+' character at the beginning of the recipe line in order to
> > >> > let GNU Make pass the jobserver file descriptors to the child
> > >> > processes.
> > >> >
> > >> > Add the --jobserver option to add a '+' character to the recipe line in
> > >> > program.am and ltlibrary.am.
> > > ...
> > >> Surely this needs to be a configure-time option, perhaps combined
> > >> with some sort of configure test, since otherwise users won't get
> > >> this choice, right?  As an automake option the choice made by whomever
> > >> prepares the distribution will get baked into distributed Makefile.in
> > >> files...
> > >
> > > I was going to say something very similar: there shouldn't be an
> > > option at all.  The decision of whether or not to put + at the
> > > beginning of the recipe line should be made _when make is run_, based
> > > on whether -flto=jobserver actually appears in $(LDFLAGS) or wherever.
> >
> > Since this check cannot be done inside a rule, testing LDFLAGS at make
> > time is probably impractical to do portably.

LTO_PLUS = $(if $(findstring -flto=jobserver,$(LDFLAGS)),+)

I think it's okay if this only works with GNU Make.

> "make -n" will execute the recipe with the "+" prefix.   But --jobserver
> is off by default.  People who use --jobserver prefer a working GCC
> -flto=jobserver over a broken "make -n".

What Nick is saying - and I agree with him - is that it's not okay for
the package maintainer to make that decision.

zw
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.