From patchwork Sun Aug 31 14:51:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 384542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D7AB0140187 for ; Mon, 1 Sep 2014 00:53:13 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=bztFduDWRflcJpwaTpOCbfGdci3/dNxYhUwVFtf5MqI3+2+CLS3ae 7Fape4BbU9Y+cnqn4h7dOP++X5s6O8RERK83OzmE0GG5HLsNKhU/NBkgquYpDmVC Dj+4vGXUyYoCAuA1zRkSCtpeTJoiV2zRaLVBNggmkIiU2njKu1iESg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=Ms+8KqQ6LFcemJJ7ISXY6pBOrSM=; b=T0SZ230MIKWAMfLNDqm8 SKo45bORXOs3SZCk7ZmI+uanGUSzqjl84fUPR/WOLxRnwBpAZtK0HhdrpckgaHjr zYdhqfHqI7ola9tjNZe5dkksghHdkkI4JmHcLByJnbv+HNDI+BDSpn4hjwFulSHV m6Pl2xa7RqBb2d2ZeS5OBu4= Received: (qmail 1897 invoked by alias); 31 Aug 2014 14:52:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 1814 invoked by uid 89); 31 Aug 2014 14:52:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: one.firstfloor.org Received: from one.firstfloor.org (HELO one.firstfloor.org) (193.170.194.197) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sun, 31 Aug 2014 14:52:36 +0000 Received: from basil.firstfloor.org (184-100-237-164.ptld.qwest.net [184.100.237.164]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by one.firstfloor.org (Postfix) with ESMTPSA id D2F9686A02; Sun, 31 Aug 2014 16:52:31 +0200 (CEST) Received: by basil.firstfloor.org (Postfix, from userid 1000) id AB1B3A1C9A; Sun, 31 Aug 2014 07:51:30 -0700 (PDT) From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH 2/2] Support slim LTO bootstrap Date: Sun, 31 Aug 2014 07:51:26 -0700 Message-Id: <1409496686-14681-3-git-send-email-andi@firstfloor.org> In-Reply-To: <1409496686-14681-2-git-send-email-andi@firstfloor.org> References: <1409496686-14681-1-git-send-email-andi@firstfloor.org> <1409496686-14681-2-git-send-email-andi@firstfloor.org> From: Andi Kleen Change the bootstrap-lto config file to use slim (non fat) LTO.. Speeds up the LTO bootstrap by ~18% on a 4 core system. This requires using gcc-ar/ranlib in post stage 1 builds, so these are passed to all sub builds. v2: Change existing config file as requested by Honza. config/: 2014-08-31 Andi Kleen * bootstrap-lto.mk: Implement slim bootstrap. /: 2014-08-31 Andi Kleen * Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Add LTO_EXPORTS. POSTSTAGE1_FLAGS_TO_PASS): Add LTO_FLAGS_TO_PASS. * Makefile.in: Regenerate. --- Makefile.in | 2 ++ Makefile.tpl | 2 ++ config/bootstrap-lto-slim.mk | 13 +++++++++++++ config/bootstrap-lto.mk | 16 +++++++++++----- 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 config/bootstrap-lto-slim.mk diff --git a/Makefile.in b/Makefile.in index add8cf6..d6105b3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -257,6 +257,7 @@ POSTSTAGE1_HOST_EXPORTS = \ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \ CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ + $(LTO_EXPORTS) \ GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \ LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \ HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS; @@ -828,6 +829,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ GNATBIND="$${GNATBIND}" \ LDFLAGS="$${LDFLAGS}" \ HOST_LIBS="$${HOST_LIBS}" \ + $(LTO_FLAGS_TO_PASS) \ "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" # Flags to pass down to makes which are built with the target environment. diff --git a/Makefile.tpl b/Makefile.tpl index 00dba36..f7c7e38 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -260,6 +260,7 @@ POSTSTAGE1_HOST_EXPORTS = \ $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \ CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \ $(POSTSTAGE1_CXX_EXPORT) \ + $(LTO_EXPORTS) \ GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \ LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \ HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS; @@ -633,6 +634,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ GNATBIND="$${GNATBIND}" \ LDFLAGS="$${LDFLAGS}" \ HOST_LIBS="$${HOST_LIBS}" \ + $(LTO_FLAGS_TO_PASS) \ "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" # Flags to pass down to makes which are built with the target environment. diff --git a/config/bootstrap-lto-slim.mk b/config/bootstrap-lto-slim.mk new file mode 100644 index 0000000..9e065e1 --- /dev/null +++ b/config/bootstrap-lto-slim.mk @@ -0,0 +1,13 @@ +# This option enables LTO for stage2 and stage3 in slim mode + +STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGEprofile_CFLAGS += -fno-lto + +# assumes the host supports the linker plugin +LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ +LTO_RANLIB = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ranlib$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ + +LTO_EXPORTS = AR="$(LTO_AR)"; export AR; \ + RANLIB="$(LTO_RANLIB)"; export RANLIB; +LTO_FLAGS_TO_PASS = AR="$(LTO_AR)" RANLIB="$(LTO_RANLIB)" diff --git a/config/bootstrap-lto.mk b/config/bootstrap-lto.mk index 27bad15..9e065e1 100644 --- a/config/bootstrap-lto.mk +++ b/config/bootstrap-lto.mk @@ -1,7 +1,13 @@ -# This option enables LTO for stage2 and stage3. -# FIXME: Our build system is not yet able to use gcc-ar wrapper, so we need -# to go with -ffat-lto-objects. +# This option enables LTO for stage2 and stage3 in slim mode -STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects -STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects +STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 +STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 STAGEprofile_CFLAGS += -fno-lto + +# assumes the host supports the linker plugin +LTO_AR = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ar$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ +LTO_RANLIB = $$r/$(HOST_SUBDIR)/prev-gcc/gcc-ranlib$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ + +LTO_EXPORTS = AR="$(LTO_AR)"; export AR; \ + RANLIB="$(LTO_RANLIB)"; export RANLIB; +LTO_FLAGS_TO_PASS = AR="$(LTO_AR)" RANLIB="$(LTO_RANLIB)"