On 09/16/2016 03:54 PM, Eric Botcazou wrote:

we have some new machines which seem to be very good at stumbling upon race
conditions during bootstrap.  Another example with libgcc:

/azun.a/gnatmail/sandbox/gnatcross-cont/x86-linux/gcc/build/./gcc/xgcc -
B/azun.a/gnatmail/sandbox/gnatcross-cont/x86-linux/gcc/build/./gcc/ -
gnu/bin/ -B/azun.a/gnatmail/sandbox/gnatcross-cont/x86-linux/gcc/pkg/i686-pc-
linux-gnu/lib/ -isystem /azun.a/gnatmail/sandbox/gnatcross-cont/x86-
linux/gcc/pkg/i686-pc-linux-gnu/include -isystem
gnu/sys-include    -g -O2 -O2  -g -O2 -DIN_GCC    -W -Wall -Wno-narrowing -
Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-
style-definition  -isystem ./include   -fpic -mlong-double-80 -DUSE_ELF_SYMVER
-g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fpic -mlong-
double-80 -DUSE_ELF_SYMVER -I. -I. -I../.././gcc -I../../../src/libgcc -
I../../../src/libgcc/. -I../../../src/libgcc/../gcc -
I../../../src/libgcc/../include -I../../../src/libgcc/config/libbid -
_negdi2_s.o -MD -MP -MF _negdi2_s.dep -DSHARED -DL_negdi2 -c
config.status: linking ../../../src/libgcc/unwind-generic.h to unwind.h
config.status: linking ../../../src/libgcc/config/i386/linux-unwind.h to md-
config.status: linking ../../../src/libgcc/config/i386/sfp-machine.h to sfp-
config.status: linking ../../../src/libgcc/gthr-posix.h to gthr-default.h
In file included from ../../../src/libgcc/libgcov-interface.c:27:0:
../../../src/libgcc/gthr.h:148:26: fatal error: gthr-default.h: No such file
or directory
 #include "gthr-default.h"
compilation terminated.
Makefile:894: recipe for target '_gcov_reset.o' failed
make[3]: *** [_gcov_reset.o] Error 1
make[3]: *** Waiting for unfinished jobs....

So there is a race condition between the creation of (soft) links by the
libgcc configure script and the use of these links by the compilation of files
launched by the Makefile.

Tentative fix attached, tested on a bunch of machines for several native
platforms, OK for the mainline?

2016-09-16  Eric Botcazou  <ebotca...@adacore.com>

        * configure.ac: Do not create links, only substitute the filenames.
        * configure: Regenerate.
        * Makefile.in: Assign the substitution results to variables.
        (LIBGCC_LINKS): Define.
        (enable-execute-stack.c): New rule.
        (unwind.h): Likewise.
        (md-unwind-support.h): Likewise.
        (sfp-machine.h): Likewise.
        (gthr-default.h): Likewise.
        Add $(LIBGCC_LINKS) to the prerequisites of all object files and
        unwind.h as prerequisite of install-unwind_h-forbuild.

Reply via email to