# Otherwise $(SELFTEST_DEPS) is empty when used from <LANG>/Make-lang.in.
SELFTEST_DEPS = $(GCC_PASSES) stmp-int-hdrs $(srcdir)/testsuite/selftests
+DO_LINK_SERIALIZATION = @DO_LINK_SERIALIZATION@
+
# Language makefile fragments.
# The following targets define the interface between us and the languages.
# language hooks, generated by configure
@language_hooks@
+ifeq ($(DO_LINK_SERIALIZATION),)
+LINK_PROGRESS = :
+else
+LINK_PROGRESS = msg="Linking |"; cnt=0; if test "$(2)" = start; then \
+ idx=0; cnt2=$(DO_LINK_SERIALIZATION); \
+ while test $$cnt2 -le $(1); do msg="$${msg}=="; cnt2=`expr $$cnt2 + 1`; idx=`expr $$idx + 1`; done; \
+ cnt=$$idx; \
+ while test $$cnt -lt $(1); do msg="$${msg}>>"; cnt=`expr $$cnt + 1`; done; \
+ msg="$${msg}--"; cnt=`expr $$cnt + 1`; \
+ else \
+ idx=`expr $(1) + 1`; \
+ while test $$cnt -le $(1); do msg="$${msg}=="; cnt=`expr $$cnt + 1`; done; \
+ fi; \
+ while test $$cnt -lt $(SERIAL_COUNT); do msg="$${msg} "; cnt=`expr $$cnt + 1`; done; \
+ msg="$${msg}| `expr 100 \* $$idx / $(SERIAL_COUNT)`%"; echo "$$msg"
+endif
+
# Wire in install-gnatlib invocation with `make install' for a configuration
# with top-level libada disabled.
gnat_install_lib = @gnat_install_lib@
# Define the names for selecting Ada in LANGUAGES.
ada: gnat1$(exeext) gnatbind$(exeext)
+ada.serial: gnat1$(exeext)
# Tell GNU Make to ignore these, if they exist.
-.PHONY: ada
+.PHONY: ada ada.serial ada.prev
# 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.
# Needs to be built with CC=gcc
# 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)
+gnat1$(exeext): $(TARGET_ADA_SRCS) $(GNAT1_OBJS) $(ADA_BACKEND) libcommon-target.a \
+ $(LIBDEPS) ada.prev
+ @$(call LINK_PROGRESS,$(INDEX.ada),start)
+$(GCC_LLINK) -o $@ $(GNAT1_OBJS) $(ADA_BACKEND) \
libcommon-target.a $(LIBS) $(SYSLIBS) $(BACKENDLIBS) $(CFLAGS)
$(RM) stamp-gnatlib2-rts stamp-tools
+ @$(call LINK_PROGRESS,$(INDEX.ada),end)
gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBDEPS)
+$(GCC_LINK) -o $@ ada/b_gnatb.o $(GNATBIND_OBJS) ggc-none.o libcommon-target.a $(LIBS) $(SYSLIBS) $(CFLAGS)
# The name for selecting brig in LANGUAGES.
brig: brig1$(exeext)
+brig.serial: brig
-.PHONY: brig
+.PHONY: brig brig.serial brig.prev
CFLAGS-brig/brigspec.o += $(DRIVER_DEFINES)
brig_OBJS = $(BRIG_OBJS) brig/brigspec.o
-# brig1$(exeext): $(BRIG_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
-# +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
-# $(BRIG_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
-
-
-brig1$(exeext): $(BRIG_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
+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) \
$(BACKENDLIBS)
+ @$(call LINK_PROGRESS,$(INDEX.brig),end)
# Documentation.
#\f
# Define the names for selecting c in LANGUAGES.
c: cc1$(exeext)
+c.serial: c
# Tell GNU make to ignore these if they exist.
-.PHONY: c gcc
+.PHONY: c gcc c.serial
# 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
fi
cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
+ @$(call LINK_PROGRESS,$(INDEX.c),start)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
cc1-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
+ @$(call LINK_PROGRESS,$(INDEX.c),end)
cc1.fda: ../stage1-gcc/cc1$(exeext) ../prev-gcc/$(PERF_DATA)
$(CREATE_GCOV) -binary ../stage1-gcc/cc1$(exeext) -gcov cc1.fda -profile ../prev-gcc/$(PERF_DATA) -gcov_version 1
dollar
gcc_tooldir
enable_lto
+DO_LINK_SERIALIZATION
DO_LINK_MUTEX
MAINT
zlibinc
with_system_zlib
enable_maintainer_mode
enable_link_mutex
+enable_link_serialization
enable_version_specific_runtime_libs
enable_plugin
enable_host_shared
sometimes confusing) to the casual installer
--enable-link-mutex avoid linking multiple front-ends at once to avoid
thrashing on the build machine
+ --enable-link-serialization
+ avoid linking multiple GCC front-ends at once using
+ make dependencies to avoid thrashing on the build
+ machine
--enable-version-specific-runtime-libs
specify that runtime libraries should be installed
in a compiler-specific directory
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19033 "configure"
+#line 19039 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19139 "configure"
+#line 19145 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to serialize linking of multiple front-ends" >&5
+$as_echo_n "checking whether to serialize linking of multiple front-ends... " >&6; }
+ # Check whether --enable-link-serialization was given.
+if test "${enable_link_serialization+set}" = set; then :
+ enableval=$enable_link_serialization; do_link_serialization=$enableval
+else
+ do_link_serialization=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $do_link_serialization" >&5
+$as_echo "$do_link_serialization" >&6; }
+
+case "$do_link_serialization" in
+ yes)
+ DO_LINK_SERIALIZATION=1;;
+ [1-9] | [1-9][0-9] | [1-9][0-9][0-9])
+ DO_LINK_SERIALIZATION=$do_link_serialization;;
+ no)
+ DO_LINK_SERIALIZATION=;;
+ *)
+ as_fn_error $? "bad value ${do_link_serialization} given for --enable-link-serialization" "$LINENO" 5 ;;
+esac
+
+
# --------------
# Language hooks
# --------------
echo "lang.$t: $x" >> Make-hooks
done
+echo "ifeq (\$(DO_LINK_SERIALIZATION),)" >> Make-hooks
+echo "SERIAL_LIST =" >> Make-hooks
+echo else >> Make-hooks
+lang_cnt=0
+lang_list=
+prev=c.serial
+serialization_languages=c
+for lang in $all_selected_languages
+do
+ test $lang = c && continue
+ if test $lang = lto; then
+ serialization_languages="$serialization_languages lto1 lto2"
+ else
+ serialization_languages="$serialization_languages $lang"
+ fi
+done
+for lang in $serialization_languages
+do
+ test $lang = c && continue
+ lang_cnt=`expr $lang_cnt + 1`
+ lang_list=" $prev$lang_list"
+ prev=${lang}.serial
+done
+echo "SERIAL_LIST = \$(wordlist \$(DO_LINK_SERIALIZATION),$lang_cnt,$lang_list)" >> Make-hooks
+echo endif >> Make-hooks
+echo "SERIAL_COUNT = `expr $lang_cnt + 1`" >> Make-hooks
+echo "INDEX.c = 0" >> Make-hooks
+lang_idx=1
+for lang in $serialization_languages
+do
+ test $lang = c && continue
+ echo "$lang.prev: \$(word $lang_cnt,\$(SERIAL_LIST))" >> Make-hooks
+ echo "INDEX.$lang = $lang_idx" >> Make-hooks
+ lang_cnt=`expr $lang_cnt - 1`
+ lang_idx=`expr $lang_idx + 1`
+done
+
# --------
# Option include files
# --------
fi
AC_SUBST(DO_LINK_MUTEX)
+dnl Whether to prevent multiple GCC front-ends from linking at the same time
+
+AC_MSG_CHECKING([whether to serialize linking of multiple front-ends])
+ AC_ARG_ENABLE(link-serialization,
+[AS_HELP_STRING([--enable-link-serialization],
+ [avoid linking multiple GCC front-ends at once using make
+ dependencies to avoid thrashing on the build machine])],
+ do_link_serialization=$enableval,
+ do_link_serialization=no)
+AC_MSG_RESULT($do_link_serialization)
+
+case "$do_link_serialization" in
+ yes)
+ DO_LINK_SERIALIZATION=1;;
+ [[1-9]] | [[1-9]][[0-9]] | [[1-9]][[0-9]][[0-9]])
+ DO_LINK_SERIALIZATION=$do_link_serialization;;
+ no)
+ DO_LINK_SERIALIZATION=;;
+ *)
+ AC_MSG_ERROR(bad value ${do_link_serialization} given for --enable-link-serialization) ;;
+esac
+AC_SUBST(DO_LINK_SERIALIZATION)
+
# --------------
# Language hooks
# --------------
echo "lang.$t: $x" >> Make-hooks
done
+echo "ifeq (\$(DO_LINK_SERIALIZATION),)" >> Make-hooks
+echo "SERIAL_LIST =" >> Make-hooks
+echo else >> Make-hooks
+lang_cnt=0
+lang_list=
+prev=c.serial
+serialization_languages=c
+for lang in $all_selected_languages
+do
+ test $lang = c && continue
+ if test $lang = lto; then
+ serialization_languages="$serialization_languages lto1 lto2"
+ else
+ serialization_languages="$serialization_languages $lang"
+ fi
+done
+for lang in $serialization_languages
+do
+ test $lang = c && continue
+ lang_cnt=`expr $lang_cnt + 1`
+ lang_list=" $prev$lang_list"
+ prev=${lang}.serial
+done
+echo "SERIAL_LIST = \$(wordlist \$(DO_LINK_SERIALIZATION),$lang_cnt,$lang_list)" >> Make-hooks
+echo endif >> Make-hooks
+echo "SERIAL_COUNT = `expr $lang_cnt + 1`" >> Make-hooks
+echo "INDEX.c = 0" >> Make-hooks
+lang_idx=1
+for lang in $serialization_languages
+do
+ test $lang = c && continue
+ echo "$lang.prev: \$(word $lang_cnt,\$(SERIAL_LIST))" >> Make-hooks
+ echo "INDEX.$lang = $lang_idx" >> Make-hooks
+ lang_cnt=`expr $lang_cnt - 1`
+ lang_idx=`expr $lang_idx + 1`
+done
+
# --------
# Option include files
# --------
# 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++
# Tell GNU make to ignore these if they exist.
-.PHONY: c++
+.PHONY: c++ c++.serial c++.prev
CFLAGS-cp/g++spec.o += $(DRIVER_DEFINES)
$(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c; \
fi
-cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
+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)
+ @$(call LINK_PROGRESS,$(INDEX.c++),end)
ifeq ($(ENABLE_MAINTAINER_RULES), true)
# Special build rule. This is a maintainer rule, that is only
# The name for selecting d in LANGUAGES.
d: d21$(exeext)
+d.serial: d
# Tell GNU make to ignore these if they exist.
-.PHONY: d
+.PHONY: d d.serial d.prev
# Create the compiler driver for D.
CFLAGS-d/d-spec.o += $(DRIVER_DEFINES) $(D_LIBPHOBOS)
d_OBJS = $(D_ALL_OBJS) d/d-spec.o
-d21$(exeext): $(D_ALL_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
+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)
+ @$(call LINK_PROGRESS,$(INDEX.d),end)
# Documentation.
multiple languages at the same time, to avoid thrashing on build
systems with limited free memory. The default is not to use such a mutex.
+@item --enable-link-serialization
+When building GCC, use make dependencies to serialize linking the compilers for
+multiple languages, to avoid thrashing on build
+systems with limited free memory. The default is not to add such
+dependencies and thus with parallel make potentially link different
+compilers concurrently. If the argument is a positive integer, allow
+that number of concurrent link processes for the large binaries.
+
@item --enable-maintainer-mode
The build rules that regenerate the Autoconf and Automake output files as
well as the GCC master message catalog @file{gcc.pot} are normally
#\f
# Define the names for selecting gfortran in LANGUAGES.
fortran: f951$(exeext)
+fortran.serial: fortran
# Tell GNU make to ignore files by these names if they exist.
-.PHONY: fortran
+.PHONY: fortran fortran.serial fortran.prev
CFLAGS-fortran/gfortranspec.o += $(DRIVER_DEFINES)
cp gfortran$(exeext) gfortran-cross$(exeext)
# The compiler itself is called f951.
-f951$(exeext): $(F95_OBJS) \
- $(BACKEND) $(LIBDEPS) attribs.o
+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 \
$(BACKENDLIBS)
+ @$(call LINK_PROGRESS,$(INDEX.fortran),end)
gt-fortran-trans.h : s-gtype; @true
#\f
# The name for selecting go in LANGUAGES.
go: go1$(exeext)
+go.serial: go
-.PHONY: go
+.PHONY: go go.serial go.prev
CFLAGS-go/gospec.o += $(DRIVER_DEFINES)
go_OBJS = $(GO_OBJS) go/gospec.o
-go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
+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)
+ @$(call LINK_PROGRESS,$(INDEX.go),end)
# Documentation.
$(FULL_DRIVER_NAME)
endif
+jit.serial: $(LIBGCCJIT_FILENAME)
+
# Tell GNU make to ignore these if they exist.
-.PHONY: jit
+.PHONY: jit jit.serial jit.prev
jit_OBJS = attribs.o \
jit/dummy-frontend.o \
libbackend.a libcommon-target.a libcommon.a \
$(CPPLIB) $(LIBDECNUMBER) \
$(LIBDEPS) $(srcdir)/jit/libgccjit.map \
- $(EXTRA_GCC_OBJS)
+ $(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 \
$(CPPLIB) $(LIBDECNUMBER) $(EXTRA_GCC_LIBS) $(LIBS) $(BACKENDLIBS) \
$(EXTRA_GCC_OBJS) \
$(LIBGCCJIT_EXTRA_OPTS)
+ @$(call LINK_PROGRESS,$(INDEX.jit),end)
# Create symlinks when not building for Windows
ifeq (,$(findstring mingw,$(target)))
# Rules
+lto: $(LTO_EXE) $(LTO_DUMP_EXE)
+lto1.serial: $(LTO_EXE)
+lto2.serial: $(LTO_DUMP_EXE)
+
+.PHONY: lto lto1.serial lto1.prev lto2.serial lto2.prev
+
# These hooks are used by the main GCC Makefile. Consult that
# Makefile for documentation.
-lto.all.cross: $(LTO_EXE) $(LTO_DUMP_EXE)
-lto.start.encap: $(LTO_EXE) $(LTO_DUMP_EXE)
+lto.all.cross:
+lto.start.encap:
lto.rest.encap:
lto.tags:
lto.install-common: installdirs
# Use strict warnings for this front end.
lto-warn = $(STRICT_WARN)
-$(LTO_EXE): $(LTO_OBJS) $(BACKEND) $(LIBDEPS)
+$(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)
+$(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)
+ @$(call LINK_PROGRESS,$(INDEX.lto2),end)
lto/lto-dump.o: $(LTO_OBJS)
#\f
# Define the names for selecting Objective-C in LANGUAGES.
objc: cc1obj$(exeext)
+objc.serial: objc
# Tell GNU make to ignore these if they exist.
-.PHONY: objc
+.PHONY: objc objc.serial objc.prev
# Use maximal warnings for this front end.
objc-warn = $(STRICT_WARN)
$(BACKEND) $(LIBDEPS) checksum-options > cc1obj-checksum.c.tmp && \
$(srcdir)/../move-if-change cc1obj-checksum.c.tmp cc1obj-checksum.c
-cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o $(BACKEND) $(LIBDEPS)
+cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o $(BACKEND) \
+ $(LIBDEPS) objc.prev
+ @$(call LINK_PROGRESS,$(INDEX.objc),start)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o \
$(BACKEND) $(LIBS) $(BACKENDLIBS)
+ @$(call LINK_PROGRESS,$(INDEX.objc),end)
objc.srcextra:
#\f
# Define the names for selecting Objective-C++ in LANGUAGES.
obj-c++: cc1objplus$(exeext)
+obj-c++.serial: obj-c++
# Tell GNU make to ignore these if they exist.
-.PHONY: obj-c++
+.PHONY: obj-c++ obj-c++.serial obj-c++.prev
# Use maximal warnings for this front end. Also, make ObjC and C++
# headers accessible.
$(srcdir)/../move-if-change cc1objplus-checksum.c.tmp \
cc1objplus-checksum.c
-cc1objplus$(exeext): $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBDEPS)
+cc1objplus$(exeext): $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) \
+ $(LIBDEPS) obj-c++.prev
+ @$(call LINK_PROGRESS,$(INDEX.obj-c++),start)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
+ @$(call LINK_PROGRESS,$(INDEX.obj-c++),end)
# Objective C++ language specific files.