Please consider the attached changes. * apply the attached ada-verbose.diff I fail to understand why anyone ever silents errors or command lines nowadays.
* append the attached howto-test-path-with-cross-build to the README of gcc-*-cross, or more experienced advices for beginners like me. * replace debian/patches/ada-gcc-name.diff with the attached version. It ensures in Osint.Program_Name that: * arguments breaking implicit assertions trigger an immediate failure. * if present in the program name, the suffix repeats the linked libgnat version. * the executed subcommand *always* carries exactly one suffix. It will hopefully close 903694 and friends. With gcc-7 in unstable, the reproducer_in_tree script called after a patched build works as expected for * 903694: all *gnatmake* recursive subcommands carry exactly one -7 suffix. * 856274: all *gnatchop* succeed. I suggest that we leave the bug open as a reminder to forward the changes once the dust has settled. Also, it would be nice to suggest that gnatchop should now behaves like the other tools.
Description: simplifiy detection of machine and version in command name The previous algorithm wrongly tests "End_Of_Prefix > 1", which may happen even if a match has been found. . This version reports problems, and always add the suffix to ensure that the gcc called has the same version than the calling tool. . Log for bug 903694 carries regression tests for both bugs. . Note: for historical reasons, gnatchop carries its own version of the old algorithm, which seems to work in our case. Bugs-Debian: https://bugs.debian.org/903694 Bugs-Debian: https://bugs.debian.org/856274 Author: Ludovic Brenta <lbre...@debian.org> Author: Nicolas Boulenguez <nico...@debian.org> --- a/src/gcc/ada/osint.adb +++ b/src/gcc/ada/osint.adb @@ -2199,22 +2199,15 @@ ------------------ function Program_Name (Nam : String; Prog : String) return String_Access is - End_Of_Prefix : Natural := 0; Start_Of_Prefix : Positive := 1; - Start_Of_Suffix : Positive; + Suffix : constant String := '-' & Gnatvsn.Library_Version; begin -- Get the name of the current program being executed Find_Program_Name; - Start_Of_Suffix := Name_Len + 1; - - -- Find the target prefix if any, for the cross compilation case. - -- For instance in "powerpc-elf-gcc" the target prefix is - -- "powerpc-elf-" - -- Ditto for suffix, e.g. in "gcc-4.1", the suffix is "-4.1" - + -- Find directory part if any, and ignore it from now on. for J in reverse 1 .. Name_Len loop if Name_Buffer (J) = '/' or else Name_Buffer (J) = Directory_Separator @@ -2225,25 +2218,28 @@ end if; end loop; - -- Find End_Of_Prefix - + -- Find the target prefix if any, for the cross compilation case. + -- For instance in "powerpc-elf-gcc" the target prefix is + -- "powerpc-elf-" + -- Ditto for suffix, e.g. in "gcc-4.1", the suffix is "-4.1" + -- In other terms, search and replace Prog with Nam. for J in Start_Of_Prefix .. Name_Len - Prog'Length + 1 loop if Name_Buffer (J .. J + Prog'Length - 1) = Prog then - End_Of_Prefix := J - 1; - exit; + + -- If suffix is present, it must match our version. + if J + Prog'Length < Name_Len + and then Name_Buffer (J + Prog'Length .. Name_Len) /= Suffix + then + Fail ("Osint.Program_Name: version mismatch in Debian"); + end if; + + -- Require our version, as gcc default may differ. + return new String'(Name_Buffer (Start_Of_Prefix .. J - 1) + & Nam & Suffix); + end if; end loop; - - if End_Of_Prefix > 1 then - Start_Of_Suffix := End_Of_Prefix + Prog'Length + 1; - end if; - - -- Create the new program name - - return new String' - (Name_Buffer (Start_Of_Prefix .. End_Of_Prefix) - & Nam - & Name_Buffer (Start_Of_Suffix .. Name_Len)); + Fail ("Osint.Program_Name: no match. Please report to Debian."); end Program_Name; ------------------------------
Description: Display subprocess command lines when building Ada. The log can be a page longer if it helps debugging. Author: Nicolas Boulenguez <nico...@debian.org> --- a/src/gcc/ada/Make-generated.in +++ b/src/gcc/ada/Make-generated.in @@ -28,21 +28,21 @@ -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/treeprs $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/treeprs/,$(notdir $^)) $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/treeprs - (cd $(ADA_GEN_SUBDIR)/bldtools/treeprs; gnatmake -q xtreeprs ; ./xtreeprs treeprs.ads ) + cd $(ADA_GEN_SUBDIR)/bldtools/treeprs && gnatmake -v xtreeprs && ./xtreeprs treeprs.ads $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/treeprs/treeprs.ads $(ADA_GEN_SUBDIR)/treeprs.ads $(ADA_GEN_SUBDIR)/einfo.h : $(ADA_GEN_SUBDIR)/einfo.ads $(ADA_GEN_SUBDIR)/einfo.adb $(ADA_GEN_SUBDIR)/xeinfo.adb $(ADA_GEN_SUBDIR)/ceinfo.adb -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/einfo $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/einfo/,$(notdir $^)) $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/einfo - (cd $(ADA_GEN_SUBDIR)/bldtools/einfo; gnatmake -q xeinfo ; ./xeinfo einfo.h ) + cd $(ADA_GEN_SUBDIR)/bldtools/einfo && gnatmake -v xeinfo && ./xeinfo einfo.h $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/einfo/einfo.h $(ADA_GEN_SUBDIR)/einfo.h $(ADA_GEN_SUBDIR)/sinfo.h : $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/sinfo.adb $(ADA_GEN_SUBDIR)/xsinfo.adb $(ADA_GEN_SUBDIR)/csinfo.adb -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/sinfo $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/sinfo/,$(notdir $^)) $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/sinfo - (cd $(ADA_GEN_SUBDIR)/bldtools/sinfo; gnatmake -q xsinfo ; ./xsinfo sinfo.h ) + cd $(ADA_GEN_SUBDIR)/bldtools/sinfo && gnatmake -v xsinfo && ./xsinfo sinfo.h $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/sinfo/sinfo.h $(ADA_GEN_SUBDIR)/sinfo.h $(ADA_GEN_SUBDIR)/snames.h $(ADA_GEN_SUBDIR)/snames.ads $(ADA_GEN_SUBDIR)/snames.adb : $(ADA_GEN_SUBDIR)/stamp-snames ; @true @@ -50,7 +50,7 @@ -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/snamest $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/snamest/,$(notdir $^)) $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/snamest - (cd $(ADA_GEN_SUBDIR)/bldtools/snamest; gnatmake -q xsnamest ; ./xsnamest ) + cd $(ADA_GEN_SUBDIR)/bldtools/snamest && gnatmake -v xsnamest && ./xsnamest $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.ns $(ADA_GEN_SUBDIR)/snames.ads $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.nb $(ADA_GEN_SUBDIR)/snames.adb $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.nh $(ADA_GEN_SUBDIR)/snames.h @@ -61,7 +61,7 @@ -$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/nmake $(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/nmake/,$(notdir $^)) $(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/nmake - (cd $(ADA_GEN_SUBDIR)/bldtools/nmake; gnatmake -q xnmake ; ./xnmake -b nmake.adb ; ./xnmake -s nmake.ads) + cd $(ADA_GEN_SUBDIR)/bldtools/nmake && gnatmake -v xnmake && ./xnmake -b nmake.adb && ./xnmake -s nmake.ads $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/nmake/nmake.ads $(ADA_GEN_SUBDIR)/nmake.ads $(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/nmake/nmake.adb $(ADA_GEN_SUBDIR)/nmake.adb touch $(ADA_GEN_SUBDIR)/stamp-nmake --- a/src/gcc/ada/gcc-interface/Makefile.in +++ b/src/gcc/ada/gcc-interface/Makefile.in @@ -612,7 +612,7 @@ -$(MKDIR) ./bldtools/oscons $(RM) $(addprefix ./bldtools/oscons/,$(notdir $^)) $(CP) $^ ./bldtools/oscons - (cd ./bldtools/oscons ; gnatmake -q xoscons) + cd ./bldtools/oscons && gnatmake -v xoscons $(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons $(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s
How to test a patch with gcc-BV-cross. Edit ~/candidate.diff. echo apply-candidate.diff >> debian/patches/gcc-BV/series cat > debian/patches/gcc-7/apply-candidate.diff <<EOF --- gcc/debian/rules.patch +++ gcc/debian/rules.patch @@ -384,8 +384,10 @@ done # -$(srcdir)/move-if-change pxxx $@ mv pxxx $@ + patch -p1 < ~/candidate.diff unpatch: + patch -R -p1 < ~/candidate.diff QUILT_PATCHES=$(patchdir) \ quilt --quiltrc /dev/null pop -a -R || test $$? = 2 rm -rf .pc EOF debian/rules build