From c8a32f62c78fdb6cccb04ccfa321c239bde006e3 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 26 Nov 2020 09:58:51 +0100 Subject: [PATCH] debian: use -flto=jobserver. * debian/rules: Adjust to use the jobserver, don't pass 'u' to ar, and fix typo introduced by fe694e2ba. --- debian/rules | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/debian/rules b/debian/rules index 4a522c0d9..0193e9a62 100755 --- a/debian/rules +++ b/debian/rules @@ -26,23 +26,29 @@ LTOPLUG := $(shell gcc -v 2>&1 | \ # ARFLAGS is for Automake # AR_FLAGS is for Libtool +# These activate the LTO pluggin, but also remove the 'u' option +# from ar, since its now ignored with Debian's default to 'D'. LTOSETUP = \ LDFLAGS='-fuse-linker-plugin' \ NM='nm --plugin $(LTOPLUG)' \ - ARFLAGS='cru --plugin $(LTOPLUG)' \ - AR_FLAGS='cru --plugin $(LTOPLUG)' \ - RANLIB='ranlib --plugin $(LTOPLUG)' + ARFLAGS='cr --plugin $(LTOPLUG)' \ + AR_FLAGS='cr --plugin $(LTOPLUG)' \ + RANLIB='ranlib --plugin $(LTOPLUG)' \ VALGRIND=false GCDADIR := $(shell pwd)/gcda -PROFW = -Wno-error=coverage-mismatch -PRO1SETUP = \ - CFLAGS='-flto -fprofile-generate=$(GCDADIR) $(PROFW)' \ - CXXFLAGS='-flto -fprofile-generate=$(GCDADIR) $(PROFW)' -PRO2SETUP = \ - CFLAGS='-flto -fprofile-use=$(GCDADIR) $(PROFW) -fprofile-correction' \ - CXXFLAGS='-flto -fprofile-use=$(GCDADIR) $(PROFW) -fprofile-correction' + +FLTO = -flto=jobserver -Wno-error=coverage-mismatch +PRO1SETUP = \ + CFLAGS="$(FLTO) -fprofile-generate=$(GCDADIR)" \ + CXXFLAGS="$(FLTO) -fprofile-generate=$(GCDADIR)" +PRO2SETUP = \ + CFLAGS="$(FLTO) -fprofile-use=$(GCDADIR) -fprofile-correction" \ + CXXFLAGS="$(FLTO) -fprofile-use=$(GCDADIR) -fprofile-correction" PYDEFAULT=$(shell py3versions --default) PYOTHERS=$(filter-out $(PYDEFAULT), $(shell py3versions --supported)) +# This hack causes + to appear in front of the link step, so that +# LTO can be done using GNU Make's job server. +MAKEOVERRIDES += AM_V_CXXLD=+ AM_V_CCLD=+ # We want to build Spot twice: once to get profile data, and a second # time to use it. @@ -53,7 +59,7 @@ override_dh_auto_configure: --disable-static PYTHON=/usr/bin/$(PYDEFAULT) dh_auto_build dh_auto_test - make clean + $(MAKE) clean dh_auto_configure -- $(PRO2SETUP) $(LTOSETUP) \ --disable-devel --enable-optimizations \ --disable-static PYTHON=/usr/bin/$(PYDEFAULT)