Hi!

As reported by Matthias, --enable-link-serialization=1 can currently start
two concurrent links first (e.g. gnat1 and cc1).
The problem is that make var = value values seem to work differently between
dependencies and actual rules (where it was tested).
As the language make fragments can be in different order, we can have:
# Part of Makefile added by configure
ada.prev = ... magic that will become $(c.serial) under 
--enable-link-serialization=1
# ada/gcc-interface/Make-lang.in
gnat1$(exe): ..... $(ada.prev)
        ...
# c/Make-lang.in
c.serial = cc1$(exe)
and while if I add echo $(ada.prev) in the gnat1 rule's command, it prints
cc1, the dependencies are actually evaluated during reading of the goal or
when.
The configure creates (and puts into Makefile) some serialization order of
the languages and in that order c always comes first, and the rest is
actually sorted the way the all_lang_makefrags are already sorted,
so just by forcing c/Make-lang.in first we achieve that X.serial variable
is always defined before some other Y.prev will use it in its goal
dependencies.

Bootstrapped/regtested on x86_64-linux and i686-linux, without
--enable-link-serialization altogether, with =1 and with =3, all results
look good.  Ok for trunk?

2021-01-12  Jakub Jelinek  <ja...@redhat.com>

        * configure.ac: Ensure c/Make-lang.in comes first in 
@all_lang_makefrags@.
        * configure: Regenerated.

--- gcc/configure.ac.jj 2021-01-05 13:57:59.911905006 +0100
+++ gcc/configure.ac    2021-01-11 14:49:22.878218318 +0100
@@ -6975,7 +6975,12 @@ changequote([,])dnl
        $ok || continue
 
        all_lang_configurefrags="$all_lang_configurefrags 
\$(srcdir)/$gcc_subdir/config-lang.in"
-       all_lang_makefrags="$all_lang_makefrags 
\$(srcdir)/$gcc_subdir/Make-lang.in"
+       if test "x$language" = xc && test -n "$all_lang_makefrags"; then
+           # Put c/Make-lang.in fragment first to match serialization 
languages order.
+           all_lang_makefrags="\$(srcdir)/$gcc_subdir/Make-lang.in 
$all_lang_makefrags"
+       else
+           all_lang_makefrags="$all_lang_makefrags 
\$(srcdir)/$gcc_subdir/Make-lang.in"
+       fi
        if test -f $srcdir/$gcc_subdir/lang.opt; then
            lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt"
            all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt"
--- gcc/configure.jj    2021-01-06 22:17:07.275967932 +0100
+++ gcc/configure       2021-01-11 14:49:29.708140555 +0100
@@ -31174,7 +31174,12 @@ do
        $ok || continue
 
        all_lang_configurefrags="$all_lang_configurefrags 
\$(srcdir)/$gcc_subdir/config-lang.in"
-       all_lang_makefrags="$all_lang_makefrags 
\$(srcdir)/$gcc_subdir/Make-lang.in"
+       if test "x$language" = xc && test -n "$all_lang_makefrags"; then
+           # Put c/Make-lang.in fragment first to match serialization 
languages order.
+           all_lang_makefrags="\$(srcdir)/$gcc_subdir/Make-lang.in 
$all_lang_makefrags"
+       else
+           all_lang_makefrags="$all_lang_makefrags 
\$(srcdir)/$gcc_subdir/Make-lang.in"
+       fi
        if test -f $srcdir/$gcc_subdir/lang.opt; then
            lang_opt_files="$lang_opt_files $srcdir/$gcc_subdir/lang.opt"
            all_opt_files="$all_opt_files $srcdir/$gcc_subdir/lang.opt"

        Jakub

Reply via email to