From a774a6a2fbeaf7cbcb7a7afe433418f2d740b45b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 20 Nov 2020 08:45:11 +0100 Subject: [PATCH] configury: Fix up --enable-link-serialization support Eric reported that the --enable-link-serialization changes seemed to cause the binaries to be always relinked, for example from the gcc/ directory of the build tree: make [relink of gnat1, brig1, cc1plus, d21, f951, go1, lto1, ...] make [relink of gnat1, brig1, cc1plus, d21, f951, go1, lto1, ...] Furthermore as reported in PR, it can cause problems during make install where make install rebuilds the binaries again. The problem is that for make .PHONY targets are just "rebuilt" always, so it is very much undesirable for the cc1plus$(exeext) etc. dependencies to include .PHONY targets, but I was using them - cc1plus.prev which would depend on some *.serial and e.g. cc1.serial depending on c and c depending on cc1$(exeext). The following patch rewrites this so that *.serial and *.prev aren't .PHONY targets, but instead just make variables. I was worried that the order in which the language makefile fragments are included (which is quite random, what order we get from the filesystem matching */config-lang.in) would be a problem but it seems to work fine - as it uses make = rather than := variables, later definitions are just fine for earlier uses as long as the uses aren't needed during the makefile parsing, but only in the dependencies of make targets and in their commands. 2020-11-20 Jakub Jelinek PR other/97911 gcc/ * configure.ac: In SERIAL_LIST use lang words without .serial suffix. Change $lang.prev from a target to variable and instead of depending on *.serial expand to the *.serial variable if the word is in the SERIAL_LIST at all, otherwise to nothing. * configure: Regenerated. gcc/c/ * Make-lang.in (c.serial): Change from goal to a variable. (.PHONY): Drop c.serial. gcc/ada/ * gcc-interface/Make-lang.in (ada.serial): Change from goal to a variable. (.PHONY): Drop ada.serial and ada.prev. (gnat1$(exeext)): Depend on $(ada.serial) rather than ada.serial. gcc/brig/ * Make-lang.in (brig.serial): Change from goal to a variable. (.PHONY): Drop brig.serial and brig.prev. (brig1$(exeext)): Depend on $(brig.serial) rather than brig.serial. gcc/cp/ * Make-lang.in (c++.serial): Change from goal to a variable. (.PHONY): Drop c++.serial and c++.prev. (cc1plus$(exeext)): Depend on $(c++.serial) rather than c++.serial. gcc/d/ * Make-lang.in (d.serial): Change from goal to a variable. (.PHONY): Drop d.serial and d.prev. (d21$(exeext)): Depend on $(d.serial) rather than d.serial. gcc/fortran/ * Make-lang.in (fortran.serial): Change from goal to a variable. (.PHONY): Drop fortran.serial and fortran.prev. (f951$(exeext)): Depend on $(fortran.serial) rather than fortran.serial. gcc/go/ * Make-lang.in (go.serial): Change from goal to a variable. (.PHONY): Drop go.serial and go.prev. (go1$(exeext)): Depend on $(go.serial) rather than go.serial. gcc/jit/ * Make-lang.in (jit.serial): Change from goal to a variable. (.PHONY): Drop jit.serial and jit.prev. ($(LIBGCCJIT_FILENAME)): Depend on $(jit.serial) rather than jit.serial. gcc/lto/ * Make-lang.in (lto1.serial, lto2.serial): Change from goals to variables. (.PHONY): Drop lto1.serial, lto2.serial, lto1.prev and lto2.prev. ($(LTO_EXE)): Depend on $(lto1.serial) rather than lto1.serial. ($(LTO_DUMP_EXE)): Depend on $(lto2.serial) rather than lto2.serial. gcc/objc/ * Make-lang.in (objc.serial): Change from goal to a variable. (.PHONY): Drop objc.serial and objc.prev. (cc1obj$(exeext)): Depend on $(objc.serial) rather than objc.serial. gcc/objcp/ * Make-lang.in (obj-c++.serial): Change from goal to a variable. (.PHONY): Drop obj-c++.serial and obj-c++.prev. (cc1objplus$(exeext)): Depend on $(obj-c++.serial) rather than obj-c++.serial. --- gcc/ada/gcc-interface/Make-lang.in | 6 +++--- gcc/brig/Make-lang.in | 6 +++--- gcc/c/Make-lang.in | 4 ++-- gcc/configure | 6 +++--- gcc/configure.ac | 6 +++--- gcc/cp/Make-lang.in | 6 +++--- gcc/d/Make-lang.in | 6 +++--- gcc/fortran/Make-lang.in | 6 +++--- gcc/go/Make-lang.in | 6 +++--- gcc/jit/Make-lang.in | 6 +++--- gcc/lto/Make-lang.in | 10 +++++----- gcc/objc/Make-lang.in | 6 +++--- gcc/objcp/Make-lang.in | 6 +++--- 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index e41465761c8..89b57505d21 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -146,10 +146,10 @@ endif # Define the names for selecting Ada in LANGUAGES. ada: gnat1$(exeext) gnatbind$(exeext) -ada.serial: gnat1$(exeext) +ada.serial = gnat1$(exeext) # Tell GNU Make to ignore these, if they exist. -.PHONY: ada ada.serial ada.prev +.PHONY: ada # Compute the FLAGS to pass for gnattools, now linked with a C++ driver as # we're linking against at least libcommon which contains C++ compiled code. @@ -669,7 +669,7 @@ ada/libgnat/s-excmac.adb: $(srcdir)/ada/libgnat/s-excmac__$(EH_MECHANISM).adb # Since the RTL should be built with the latest compiler, remove the # stamp target in the parent directory whenever gnat1 is rebuilt gnat1$(exeext): $(TARGET_ADA_SRCS) $(GNAT1_OBJS) $(ADA_BACKEND) libcommon-target.a \ - $(LIBDEPS) ada.prev + $(LIBDEPS) $(ada.prev) @$(call LINK_PROGRESS,$(INDEX.ada),start) +$(GCC_LLINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) \ libcommon-target.a $(LIBS) $(SYSLIBS) $(BACKENDLIBS) $(CFLAGS) diff --git a/gcc/brig/Make-lang.in b/gcc/brig/Make-lang.in index dffc7503c14..0141b9828a5 100644 --- a/gcc/brig/Make-lang.in +++ b/gcc/brig/Make-lang.in @@ -29,9 +29,9 @@ GCCBRIG_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gccbrig|sed \ # The name for selecting brig in LANGUAGES. brig: brig1$(exeext) -brig.serial: brig +brig.serial = brig1$(exeext) -.PHONY: brig brig.serial brig.prev +.PHONY: brig CFLAGS-brig/brigspec.o += $(DRIVER_DEFINES) @@ -82,7 +82,7 @@ BRIG_OBJS = \ brig_OBJS = $(BRIG_OBJS) brig/brigspec.o -brig1$(exeext): $(BRIG_OBJS) attribs.o $(BACKEND) $(LIBDEPS) brig.prev +brig1$(exeext): $(BRIG_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(brig.prev) @$(call LINK_PROGRESS,$(INDEX.brig),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(BRIG_OBJS) attribs.o $(BACKEND) $(LIBS) \ diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in index c776ab65f05..4b2e616eab6 100644 --- a/gcc/c/Make-lang.in +++ b/gcc/c/Make-lang.in @@ -37,10 +37,10 @@ # # Define the names for selecting c in LANGUAGES. c: cc1$(exeext) -c.serial: c +c.serial = cc1$(exeext) # Tell GNU make to ignore these if they exist. -.PHONY: c gcc c.serial +.PHONY: c gcc # The C front end driver. This is different from the drivers for other # front ends, because there is no C language specific driver (i.e. nothing diff --git a/gcc/configure b/gcc/configure index 9c70db2e6c3..3316dd72452 100755 --- a/gcc/configure +++ b/gcc/configure @@ -30913,7 +30913,7 @@ echo "SERIAL_LIST =" >> Make-hooks echo else >> Make-hooks lang_cnt=0 lang_list= -prev=c.serial +prev=c serialization_languages=c for lang in $all_selected_languages do @@ -30929,7 +30929,7 @@ do test $lang = c && continue lang_cnt=`expr $lang_cnt + 1` lang_list=" $prev$lang_list" - prev=${lang}.serial + prev=${lang} done echo "SERIAL_LIST = \$(wordlist \$(DO_LINK_SERIALIZATION),$lang_cnt,$lang_list)" >> Make-hooks echo endif >> Make-hooks @@ -30939,7 +30939,7 @@ lang_idx=1 for lang in $serialization_languages do test $lang = c && continue - echo "$lang.prev: \$(word $lang_cnt,\$(SERIAL_LIST))" >> Make-hooks + echo "$lang.prev = \$(if \$(word $lang_cnt,\$(SERIAL_LIST)),\$(\$(word $lang_cnt,\$(SERIAL_LIST)).serial))" >> Make-hooks echo "INDEX.$lang = $lang_idx" >> Make-hooks lang_cnt=`expr $lang_cnt - 1` lang_idx=`expr $lang_idx + 1` diff --git a/gcc/configure.ac b/gcc/configure.ac index 1cce371a9e1..b410428b4fc 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -6934,7 +6934,7 @@ echo "SERIAL_LIST =" >> Make-hooks echo else >> Make-hooks lang_cnt=0 lang_list= -prev=c.serial +prev=c serialization_languages=c for lang in $all_selected_languages do @@ -6950,7 +6950,7 @@ do test $lang = c && continue lang_cnt=`expr $lang_cnt + 1` lang_list=" $prev$lang_list" - prev=${lang}.serial + prev=${lang} done echo "SERIAL_LIST = \$(wordlist \$(DO_LINK_SERIALIZATION),$lang_cnt,$lang_list)" >> Make-hooks echo endif >> Make-hooks @@ -6960,7 +6960,7 @@ lang_idx=1 for lang in $serialization_languages do test $lang = c && continue - echo "$lang.prev: \$(word $lang_cnt,\$(SERIAL_LIST))" >> Make-hooks + echo "$lang.prev = \$(if \$(word $lang_cnt,\$(SERIAL_LIST)),\$(\$(word $lang_cnt,\$(SERIAL_LIST)).serial))" >> Make-hooks echo "INDEX.$lang = $lang_idx" >> Make-hooks lang_cnt=`expr $lang_cnt - 1` lang_idx=`expr $lang_idx + 1` diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 6be4678776b..52b1dba7003 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -47,10 +47,10 @@ CP_PLUGIN_HEADERS := cp-tree.h cxx-pretty-print.h name-lookup.h type-utils.h ope # into the C++ rule, but that needs a little bit of work # to do the right thing within all.cross. c++: cc1plus$(exeext) -c++.serial: c++ +c++.serial = cc1plus$(exeext) # Tell GNU make to ignore these if they exist. -.PHONY: c++ c++.serial c++.prev +.PHONY: c++ CFLAGS-cp/g++spec.o += $(DRIVER_DEFINES) @@ -117,7 +117,7 @@ cc1plus-checksum.c : build/genchecksum$(build_exeext) checksum-options \ $(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c; \ fi -cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS) c++.prev +cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS) $(c++.prev) @$(call LINK_PROGRESS,$(INDEX.c++),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS) diff --git a/gcc/d/Make-lang.in b/gcc/d/Make-lang.in index 0242c9cc04e..8c0c7535c9e 100644 --- a/gcc/d/Make-lang.in +++ b/gcc/d/Make-lang.in @@ -27,10 +27,10 @@ D_LIBPHOBOS = -DLIBPHOBOS=\"gphobos\" # The name for selecting d in LANGUAGES. d: d21$(exeext) -d.serial: d +d.serial = d21$(exeext) # Tell GNU make to ignore these if they exist. -.PHONY: d d.serial d.prev +.PHONY: d # Create the compiler driver for D. CFLAGS-d/d-spec.o += $(DRIVER_DEFINES) $(D_LIBPHOBOS) @@ -163,7 +163,7 @@ D_ALL_OBJS = $(D_FRONTEND_OBJS) $(D_GENERATED_OBJS) $(D_OBJS) $(D_TARGET_OBJS) d_OBJS = $(D_ALL_OBJS) d/d-spec.o -d21$(exeext): $(D_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS) d.prev +d21$(exeext): $(D_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(d.prev) @$(call LINK_PROGRESS,$(INDEX.d),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(D_ALL_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in index ea2e49bc086..4afd874b057 100644 --- a/gcc/fortran/Make-lang.in +++ b/gcc/fortran/Make-lang.in @@ -72,10 +72,10 @@ fortran_OBJS = $(F95_OBJS) fortran/gfortranspec.o # # Define the names for selecting gfortran in LANGUAGES. fortran: f951$(exeext) -fortran.serial: fortran +fortran.serial = f951$(exeext) # Tell GNU make to ignore files by these names if they exist. -.PHONY: fortran fortran.serial fortran.prev +.PHONY: fortran CFLAGS-fortran/gfortranspec.o += $(DRIVER_DEFINES) @@ -93,7 +93,7 @@ gfortran-cross$(exeext): gfortran$(exeext) cp gfortran$(exeext) gfortran-cross$(exeext) # The compiler itself is called f951. -f951$(exeext): $(F95_OBJS) $(BACKEND) $(LIBDEPS) attribs.o fortran.prev +f951$(exeext): $(F95_OBJS) $(BACKEND) $(LIBDEPS) attribs.o $(fortran.prev) @$(call LINK_PROGRESS,$(INDEX.fortran),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(F95_OBJS) $(BACKEND) $(ZLIB) $(LIBS) attribs.o \ diff --git a/gcc/go/Make-lang.in b/gcc/go/Make-lang.in index 7c586cbb535..a987127d3ac 100644 --- a/gcc/go/Make-lang.in +++ b/gcc/go/Make-lang.in @@ -27,9 +27,9 @@ GCCGO_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gccgo|sed '$(pr # The name for selecting go in LANGUAGES. go: go1$(exeext) -go.serial: go +go.serial = go1$(exeext) -.PHONY: go go.serial go.prev +.PHONY: go CFLAGS-go/gospec.o += $(DRIVER_DEFINES) @@ -79,7 +79,7 @@ GO_OBJS = \ go_OBJS = $(GO_OBJS) go/gospec.o -go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS) go.prev +go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS) $(go.prev) @$(call LINK_PROGRESS,$(INDEX.go),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in index 012f62d830c..1d34d2a0e4e 100644 --- a/gcc/jit/Make-lang.in +++ b/gcc/jit/Make-lang.in @@ -81,10 +81,10 @@ jit: $(LIBGCCJIT_FILENAME) \ $(FULL_DRIVER_NAME) endif -jit.serial: $(LIBGCCJIT_FILENAME) +jit.serial = $(LIBGCCJIT_FILENAME) # Tell GNU make to ignore these if they exist. -.PHONY: jit jit.serial jit.prev +.PHONY: jit jit_OBJS = attribs.o \ jit/dummy-frontend.o \ @@ -119,7 +119,7 @@ $(LIBGCCJIT_FILENAME): $(jit_OBJS) \ libbackend.a libcommon-target.a libcommon.a \ $(CPPLIB) $(LIBDECNUMBER) \ $(LIBDEPS) $(srcdir)/jit/libgccjit.map \ - $(EXTRA_GCC_OBJS) jit.prev + $(EXTRA_GCC_OBJS) $(jit.prev) @$(call LINK_PROGRESS,$(INDEX.jit),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ -shared \ $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \ diff --git a/gcc/lto/Make-lang.in b/gcc/lto/Make-lang.in index 4a03f1930c4..6e5fbac071a 100644 --- a/gcc/lto/Make-lang.in +++ b/gcc/lto/Make-lang.in @@ -42,10 +42,10 @@ lto_dump_OBJS = $(LTO_DUMP_OBJS) # Rules lto: $(LTO_EXE) $(LTO_DUMP_EXE) -lto1.serial: $(LTO_EXE) -lto2.serial: $(LTO_DUMP_EXE) +lto1.serial = $(LTO_EXE) +lto2.serial = $(LTO_DUMP_EXE) -.PHONY: lto lto1.serial lto1.prev lto2.serial lto2.prev +.PHONY: lto # These hooks are used by the main GCC Makefile. Consult that # Makefile for documentation. @@ -90,13 +90,13 @@ lto.stagefeedback: # Use strict warnings for this front end. lto-warn = $(STRICT_WARN) -$(LTO_EXE): $(LTO_OBJS) $(BACKEND) $(LIBDEPS) lto1.prev +$(LTO_EXE): $(LTO_OBJS) $(BACKEND) $(LIBDEPS) $(lto1.prev) @$(call LINK_PROGRESS,$(INDEX.lto1),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(LTO_OBJS) $(BACKEND) $(BACKENDLIBS) $(LIBS) @$(call LINK_PROGRESS,$(INDEX.lto1),end) -$(LTO_DUMP_EXE): $(LTO_DUMP_OBJS) $(BACKEND) $(LIBDEPS) lto2.prev +$(LTO_DUMP_EXE): $(LTO_DUMP_OBJS) $(BACKEND) $(LIBDEPS) $(lto2.prev) @$(call LINK_PROGRESS,$(INDEX.lto2),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(LTO_DUMP_OBJS) $(BACKEND) $(BACKENDLIBS) $(LIBS) diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in index a19befb68a0..2edf0a9553e 100644 --- a/gcc/objc/Make-lang.in +++ b/gcc/objc/Make-lang.in @@ -38,10 +38,10 @@ # # Define the names for selecting Objective-C in LANGUAGES. objc: cc1obj$(exeext) -objc.serial: objc +objc.serial = cc1obj$(exeext) # Tell GNU make to ignore these if they exist. -.PHONY: objc objc.serial objc.prev +.PHONY: objc # Use maximal warnings for this front end. objc-warn = $(STRICT_WARN) @@ -64,7 +64,7 @@ cc1obj-checksum.c : build/genchecksum$(build_exeext) checksum-options \ $(srcdir)/../move-if-change cc1obj-checksum.c.tmp cc1obj-checksum.c cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o $(BACKEND) \ - $(LIBDEPS) objc.prev + $(LIBDEPS) $(objc.prev) @$(call LINK_PROGRESS,$(INDEX.objc),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o \ diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in index 2f6954e37c0..2e3e37ecb4c 100644 --- a/gcc/objcp/Make-lang.in +++ b/gcc/objcp/Make-lang.in @@ -39,10 +39,10 @@ # # Define the names for selecting Objective-C++ in LANGUAGES. obj-c++: cc1objplus$(exeext) -obj-c++.serial: obj-c++ +obj-c++.serial = cc1objplus$(exeext) # Tell GNU make to ignore these if they exist. -.PHONY: obj-c++ obj-c++.serial obj-c++.prev +.PHONY: obj-c++ # Use maximal warnings for this front end. Also, make ObjC and C++ # headers accessible. @@ -68,7 +68,7 @@ cc1objplus-checksum.c : build/genchecksum$(build_exeext) checksum-options \ cc1objplus-checksum.c cc1objplus$(exeext): $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) \ - $(LIBDEPS) obj-c++.prev + $(LIBDEPS) $(obj-c++.prev) @$(call LINK_PROGRESS,$(INDEX.obj-c++),start) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS) -- 2.30.2