8sa1-gcc/gcc/lto/Make-lang.in
Jakub Jelinek a774a6a2fb 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  <jakub@redhat.com>

	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.
2020-11-20 08:45:11 +01:00

115 lines
3.3 KiB
Makefile

# Top level -*- makefile -*- fragment for LTO
# Copyright (C) 2009-2020 Free Software Foundation, Inc.
#This file is part of GCC.
#GCC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 3, or (at your option)
#any later version.
#GCC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# Variables
# The name of the LTO compiler.
LTO_EXE = lto1$(exeext)
LTO_DUMP_EXE = lto-dump$(exeext)
LTO_DUMP_INSTALL_NAME := $(shell echo lto-dump|sed '$(program_transform_name)')
# The LTO-specific object files inclued in $(LTO_EXE).
LTO_OBJS = lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o lto/lto-common.o
lto_OBJS = $(LTO_OBJS)
LTO_DUMP_OBJS = lto/lto-lang.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o lto/lto-dump.o lto/lto-common.o
lto_dump_OBJS = $(LTO_DUMP_OBJS)
# this is only useful in a LTO bootstrap, but this does not work right
# now. Should reenable after this is fixed, but only when LTO bootstrap
# is enabled.
#ifeq ($(if $(wildcard ../stage_current),$(shell cat \
# ../stage_current)),stageautofeedback)
#$(LTO_OBJS): CFLAGS += -fauto-profile=lto1.fda
#$(LTO_OBJS): lto1.fda
#endif
# Rules
lto: $(LTO_EXE) $(LTO_DUMP_EXE)
lto1.serial = $(LTO_EXE)
lto2.serial = $(LTO_DUMP_EXE)
.PHONY: lto
# These hooks are used by the main GCC Makefile. Consult that
# Makefile for documentation.
lto.all.cross:
lto.start.encap:
lto.rest.encap:
lto.tags:
lto.install-common: installdirs
$(INSTALL_PROGRAM) $(LTO_DUMP_EXE) \
$(DESTDIR)$(bindir)/$(LTO_DUMP_INSTALL_NAME)$(exeext)
lto.install-man:
lto.install-info:
lto.dvi:
lto.pdf:
lto.install-pdf:
lto.html:
lto.install-html:
lto.uninstall:
lto.info:
lto.man:
lto.srcextra:
lto.srcman:
lto.srcinfo:
lto.install-plugin:
lto.mostlyclean:
rm -f $(LTO_OBJS) $(LTO_EXE) lto1.fda $(LTO_DUMP_OBJS) $(LTO_DUMP_EXE) lto-dump.fda
lto.clean:
lto.distclean:
lto.maintainer-clean:
lto.stage1:
lto.stage2:
lto.stage3:
lto.stage4:
lto.stageprofile:
lto.stagefeedback:
# LTO rules.
# Use strict warnings for this front end.
lto-warn = $(STRICT_WARN)
$(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)
@$(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)
lto1.fda: ../prev-gcc/lto1$(exeext) ../prev-gcc/$(PERF_DATA)
$(CREATE_GCOV) -binary ../prev-gcc/lto1$(exeext) -gcov lto1.fda -profile ../prev-gcc/$(PERF_DATA) -gcov_version 1
# LTO testing is done as part of C/C++/Fortran etc. testing.
check-lto:
# No LTO-specific selftests
selftest-lto: