This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Sun, May 23, 2010 at 9:16 AM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> * Richard Guenther wrote on Fri, May 21, 2010 at 10:30:24AM CEST:
>> On Thu, 20 May 2010, Ralf Wildenhues wrote:
>> > How can we know that 'make' is a make program that accepts -j?
>> > It may not be GNU make, and gmake may exist as well. ?I suggest
>> > we could accept $MAKE as an override to plain 'make', and maybe
>> > the default could be chosen at GCC build time.
>> >
>> > If a build process causes this to be invoked which contains a parallel
>> > GNU make, your inner make may complain about --jobserver-fds= arguments
>> > in $MAKEFLAGS that don't correspond to working FDs. ?Other things like
>> > -i in $MAKEFLAGS could be problematic, too, so it might be safer to
>> > unset that variable.
>>
>> Well, I chose to not worry about all this things ;) ?I get warnings
>> about make with forced -jN and turning off the jobserver when
>> building SPEC for example.
>
> Yes, that is exactly what I meant. ?If the fds are closed then it is
> harmless, but if you happen to have valid fds with those numbers then
> "interesting" things can happen.
>
> The patch below addresses some of the concerns above; it still does not
> check whether ${MAKE-make} works and accepts -jN in the first place; not
> sure what a good logic would be for that.
>
> Bootstrapped x86_64-pc-linux-gnu, testsuite is running. ?I casually
> tested the compiler (with a project of mine) to see that the warnings
> from make are gone now, that $MAKE is honored. ?OK for trunk?
>
> For testing whether 'make -i' still influences the whopr stage, I would
> need to provoke an error from one of the spawned jobs. ?Any idea how to
> do that reliably (i.e., without relying on a PR)?
>
> 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.

Richard.

> Thanks,
> Ralf
>
> Honor $MAKE for -fwhopr=; do not honor $MAKEFLAGS, $MFLAGS.
>
> gcc/ChangeLog:
> 2010-05-23 ?Ralf Wildenhues ?<Ralf.Wildenhues@gmx.de>
>
> ? ? ? ?* lto-wrapper.c (run_gcc): Unset MAKEFLAGS and MFLAGS
> ? ? ? ?before calling make; allow override through $MAKE.
> ? ? ? ?* doc/invoke.texi (Optimize Options): Document override.
>
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 195cdfb..3fcd8d9 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -7456,7 +7456,8 @@ that otherwise would not fit in memory. ?This option enables
>
> ?If you specify the optional @var{n} the link stage is executed in
> ?parallel using @var{n} parallel jobs by utilizing an installed
> -@code{make} program.
> +@command{make} program. ?The environment variable @env{MAKE} may be
> +used to override the program used.
>
> ?Disabled by default.
>
> diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
> index 3dbd96b..f114dc6 100644
> --- a/gcc/lto-wrapper.c
> +++ b/gcc/lto-wrapper.c
> @@ -521,7 +521,12 @@ cont:
> ? ? ? ? ? ?fprintf (mstream, " \\\n\t%s", output_names[i]);
> ? ? ? ? ?fprintf (mstream, "\n");
> ? ? ? ? ?fclose (mstream);
> - ? ? ? ? new_argv[0] = "make";
> + ? ? ? ? /* Avoid passing --jobserver-fd= and similar flags. ?*/
> + ? ? ? ? putenv (xstrdup ("MAKEFLAGS="));
> + ? ? ? ? putenv (xstrdup ("MFLAGS="));
> + ? ? ? ? new_argv[0] = getenv ("MAKE");
> + ? ? ? ? if (!new_argv[0])
> + ? ? ? ? ? new_argv[0] = "make";
> ? ? ? ? ?new_argv[1] = "-f";
> ? ? ? ? ?new_argv[2] = makefile;
> ? ? ? ? ?snprintf (jobs, 31, "-j%d", parallel);
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]