Message ID | 2309088.oEMsn2bZxl@polaris |
---|---|
State | New |
Headers | show |
On 09/16/2016 03:54 PM, Eric Botcazou wrote: > Hi, > > 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/ - > B/azun.a/gnatmail/sandbox/gnatcross-cont/x86-linux/gcc/pkg/i686-pc-linux- > 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 > /azun.a/gnatmail/sandbox/gnatcross-cont/x86-linux/gcc/pkg/i686-pc-linux- > 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 - > DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_TLS -o _negdi2_s.o -MT > _negdi2_s.o -MD -MP -MF _negdi2_s.dep -DSHARED -DL_negdi2 -c > ../../../src/libgcc/libgcc2.c > config.status: linking ../../../src/libgcc/unwind-generic.h to unwind.h > config.status: linking ../../../src/libgcc/config/i386/linux-unwind.h to md- > unwind-support.h > config.status: linking ../../../src/libgcc/config/i386/sfp-machine.h to sfp- > machine.h > 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 <ebotcazou@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. OK. jeff
Index: Makefile.in =================================================================== --- Makefile.in (revision 240142) +++ Makefile.in (working copy) @@ -43,6 +43,11 @@ enable_vtable_verify = @enable_vtable_ve enable_decimal_float = @enable_decimal_float@ fixed_point = @fixed_point@ with_aix_soname = @with_aix_soname@ +enable_execute_stack = @enable_execute_stack@ +unwind_header = @unwind_header@ +md_unwind_header = @md_unwind_header@ +sfp_machine_header = @sfp_machine_header@ +thread_header = @thread_header@ host_noncanonical = @host_noncanonical@ real_host_noncanonical = @real_host_noncanonical@ @@ -345,6 +350,21 @@ SHLIBUNWIND_INSTALL = tmake_file = @tmake_file@ include $(srcdir)/empty.mk $(tmake_file) +# Create links to files specified in config.host. +LIBGCC_LINKS = enable-execute-stack.c unwind.h md-unwind-support.h \ + sfp-machine.h gthr-default.h + +enable-execute-stack.c: $(srcdir)/$(enable_execute_stack) + -$(LN_S) $< $@ +unwind.h: $(srcdir)/$(unwind_header) + -$(LN_S) $< $@ +md-unwind-support.h: $(srcdir)/config/$(md_unwind_header) + -$(LN_S) $< $@ +sfp-machine.h: $(srcdir)/config/$(sfp_machine_header) + -$(LN_S) $< $@ +gthr-default.h: $(srcdir)/$(thread_header) + -$(LN_S) $< $@ + # Collect target defines and headers from config.host. libgcc_tm_defines = @tm_defines@ libgcc_tm_file = @tm_file@ @@ -1069,10 +1089,10 @@ all: $(extra-parts) $(libgcc-objects) $(libgcc-s-objects) $(libgcc-eh-objects) \ $(libgcov-objects) \ $(libunwind-objects) $(libunwind-s-objects) \ - $(EXTRA_PARTS): libgcc_tm.h + $(EXTRA_PARTS): $(LIBGCC_LINKS) libgcc_tm.h # Copy unwind.h to the place where gcc will look for it at build-time -install-unwind_h-forbuild: +install-unwind_h-forbuild: unwind.h dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \ cp unwind.h $$dest; \ chmod a+r $$dest; \ Index: configure.ac =================================================================== --- configure.ac (revision 240142) +++ configure.ac (working copy) @@ -548,11 +548,11 @@ GCC_AC_THREAD_HEADER([$target_thread_fil AC_SUBST(cpu_type) AC_SUBST(extra_parts) AC_SUBST(asm_hidden_op) -AC_CONFIG_LINKS([enable-execute-stack.c:$enable_execute_stack]) -AC_CONFIG_LINKS([unwind.h:$unwind_header]) -AC_CONFIG_LINKS([md-unwind-support.h:config/$md_unwind_header]) -AC_CONFIG_LINKS([sfp-machine.h:config/$sfp_machine_header]) -AC_CONFIG_LINKS([gthr-default.h:$thread_header]) +AC_SUBST(enable_execute_stack) +AC_SUBST(unwind_header) +AC_SUBST(md_unwind_header) +AC_SUBST(sfp_machine_header) +AC_SUBST(thread_header) # We need multilib support. AC_CONFIG_FILES([Makefile])