[PATCH] Enable parallel ltrans stage with -fwhopr=N

Richard Guenther rguenther@suse.de
Tue Jun 8 08:21:00 GMT 2010


On Mon, 7 Jun 2010, NightStrike wrote:

> On Wed, Jun 2, 2010 at 6:27 AM, Richard Guenther <rguenther@suse.de> wrote:
> > On Tue, 1 Jun 2010, Ralf Wildenhues wrote:
> >
> >> * Richard Guenther wrote on Thu, May 27, 2010 at 11:12:19AM CEST:
> >> > On Wed, 26 May 2010, Ralf Wildenhues wrote:
> >> > > * Richard Guenther wrote on Wed, May 26, 2010 at 10:50:24AM CEST:
> >> > > > On Tue, 25 May 2010, Ralf Wildenhues wrote:
> >> > > > > * Richard Guenther wrote on Tue, May 25, 2010 at 03:03:23PM CEST:
> >> > > > > > On Sun, 23 May 2010, Richard Guenther wrote:
> >> > > > > > > On Sun, May 23, 2010 at 9:16 AM, Ralf Wildenhues wrote:
> >> > > > > > > > I further noted that when interrupted with C^c, -fwhopr= may leave a
> >> > > > > > > > number of files matching *.wpa.o and *.wpa.ltrans.o around in the build
> >> > > > > > > > tree (not sure if only the current directory or also subdirs).  Besides
> >> > > > > > > > the missing cleanup issue (interrupted make only removes incompletely
> >> > > > > > > > updated targets), are these files suitably named so that they won't
> >> > > > > > > > interfere with, say, toplevel parallel make generating prog1 and prog2
> >> > > > > > > > from the same (or an overlapping) set of *.o files but with possibly
> >> > > > > > > > different link flags?  These names don't look random to me.
> >> > > > > > > >
> >> > > > > > > > I get some leftover files even if 'make' for some reason doesn't run at
> >> > > > > > > > all or doesn't comprehend -j.
> >> > > > > > >
> >> > > > > > > Yeah, that's easily fixed - I can look at it.
> >> > > > > >
> >> > > > > > I have posted a patch to fix that.
> >> > > > >
> >> > > > > What exactly is "that"?  The patch you posted does not fix all the
> >> > > > > issues I described in the above two paragraphs.  There are still
> >> > > > > leftover *.wpa.o files after interrupt of failed 'make', and the file
> >> > > > > names still are not parallel-safe.  (That doesn't mean the patch is
> >> > > > > bad, nor that I expect you to fix the other issues.) Should I open a PR?
> >> > > >
> >> > > > Hm, that would be a bug (the leftover *.wpa.o files).  It should
> >> > > > detect a failed make in collect_execute and end up calling
> >> > > > lto_wrapper_exit which in turn should unlink those files.
> >> > >
> >> > > Except that it doesn't work right yet with r159853.  I can still
> >> > > easily get leftover *.wpa.o as well as *.wpa.ltrans.o files with C^c.
> >> > > Would you like me to create a reproducer?
> >> >
> >> > Yes, that would be nice.
> >>
> >> Well, the easiest thing that I can come up is: in an up to date GCC
> >> build tree,
> >>
> >>   cd gcc
> >>   rm -f *.o
> >>   make CFLAGS='-g -O2 -fwhopr=3' xgcc cc1
> >>   rm -f xgcc cc1
> >>
> >> Now, just interrupt the link after a couple of seconds (don't do this in
> >> a shell where %1 is another job):
> >>
> >>   make CFLAGS='-g -O2 -fwhopr=3' xgcc cc1 & sleep 2; kill -INT %1
> >>
> >> You will see a number of leftover files, now with names matching
> >> *.ltrans$N.o and *.ltrans$N.ltrans.o in $TMPDIR.  These files are not
> >> removed upon SIGINT.
> >>
> >> You might decide to declare this intentional, but with users having
> >> their twitchy finger near C^c, it can quickly fill /tmp.
> >
> > It's not intentional.  I will have a look.
> >
> > Richard.
> 
> Ping

This has been fixed meanwhile by

2010-06-02  Richard Guenther  <rguenther@suse.de>

        * lto-wrapper.c (lto_wrapper_exit): Rename to ...
        (lto_wrapper_cleanup): ... this.  Do not exit.
        (fatal): Adjust.  Exit here.
        (fatal_perror): Likewise.
        (fatal_signal): New function.
        (main): Set up signal handlers to cleanup temporary files.
        * Makefile.in (lto-wrapper.o): Adjust dependencies.

Richard.


More information about the Gcc-patches mailing list