Package: src:gcc-7 Followup-For: Bug #857831 Control: tags -1 + patch
The attached patch fixes the new race condition introduced by previous attempt.
--- a/debian/patches/ada-gnattools-cross.diff +++ b/debian/patches/ada-gnattools-cross.diff @@ -247,23 +247,28 @@ Index: b/src/gnattools/Makefile.in "exeext=$(exeext)" \ "fsrcdir=$(fsrcdir)" \ "srcdir=$(fsrcdir)" \ -@@ -192,12 +199,18 @@ +@@ -190,6 +199,10 @@ + # to be able to build gnatmake without a version of gnatmake around. Once + # everything has been compiled once, gnatmake can be recompiled with itself # (see target regnattools) ++gnattools-native: export LD_LIBRARY_PATH := \ ++ '$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(vsndir):$(rtsdir)' ++# Useful even for 1st pass, as ../../gnatmake may already be ++# dynamically linked in case this target has already been invokated. gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts # gnattools1 -+# The export is necessary in case the target is run twice. -+ LD_LIBRARY_PATH='$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(vsndir):$(rtsdir)' \ $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ - $(TOOLS_FLAGS_TO_PASS_NATIVE) \ - ../../gnatmake$(exeext) ../../gnatlink$(exeext) +@@ -198,6 +211,13 @@ # gnattools2 + $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ + $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools +# The hard-coded object lists for gnatbind/make/link contain unneeded +# objects. Use the fresh tools to recompute dependencies. -+ LD_LIBRARY_PATH='$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(vsndir):$(rtsdir)' \ - $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ -- $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools -+ $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools \ -+ gnatbind-re gnatmake-re gnatlink-re ++# A separate Make run avoids race conditions between gnatmakes ++# building the same object for common-tools and gnat*-re. ++# (parallelism is already forbidden between gnat*-re targets) ++ $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ ++ $(TOOLS_FLAGS_TO_PASS_NATIVE) gnatbind-re gnatmake-re gnatlink-re # gnatmake/link can be built with recent gnatmake/link if they are available. # This is especially convenient for building cross tools or for rebuilding