Subject: Re: USE_NEW_TOOLCHAIN toolchain build not parallel-safe
To: Havard Eidnes <>
From: Todd Vierling <>
List: tech-toolchain
Date: 10/08/2001 18:54:16
On Thu, 27 Sep 2001, Havard Eidnes wrote:

: The reason appears to be that "backend" needs to be built before "cc1"
: can be descended into, i.e. a missing .WAIT between those two in

I've added the needed .WAIT, giving as much parallelism as possible...

: However, that is far from enough; I next fell over an error which I
: don't have the build log for (sorry), but it was one of the gcc host
: programs (gen-something -- gengenrtl?) in the gcc build which was
: being linked on one line and run on the next, and since the executable
: was already lying around from an earlier attempt, the link step got an
: error trying to write to the already-executing file.

I don't understand why it was trying to compile an "already-executing file";
the compile-link step is meant to be atomic so as not to trip over itself in
a parallel build.  I'd need to see an error log for this one.

: --- print-rtl.lo ---
: cc -O -I. -I/usr/src/gnu/usr.bin/gcc/backend/../arch/i386 -DIN_GCC -DHAVE_CONFIG_H -I/usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc -I/usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc/config -I/usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc/../include -c -o print-rtl.lo /usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc/print-rtl.c
: cc -O -I. -I/usr/src/gnu/usr.bin/gcc/backend/../arch/i386 -DIN_GCC -DHAVE_CONFIG_H -I/usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc -I/usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc/config -I/usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc/../include  -o genattr /usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc/genattr.c obstack.lo rtl.lo bitmap.lo print-rtl.lo
: cc: obstack.lo: No such file or directory
: cc: rtl.lo: No such file or directory
: cc: bitmap.lo: No such file or directory
: cc: print-rtl.lo: No such file or directory
: In file included from /usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc/genattr.c:25:
: /usr/src/gnu/usr.bin/gcc/backend/../../../dist/toolchain/gcc/rtl.h:1173: genrtl.h: No such file or directory

This is a tangly mess, and my only guaranteed way to make this work "right"
is to compile all the host objects over and over again.  One of the
fundamental problems here is that make(1) has no notion of a rule that
builds more than one target simultaneously (genrtl.c/genrtl.h) -- Solaris's
parallel make uses the '+' operator for this, i.e.:

genrtl.c + genrtl.h: foo

Anyway, I've added some changes that should accomodate this.  The changes do
increase build time a little (noticeable only on slow platforms), but it's
the only way to guarantee no race conditions in the build.  This will be
revisited at a later date.

-- Todd Vierling <>  *  Wasabi NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support --