From patchwork Tue Nov 1 01:56:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 9406829 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3DBD460721 for ; Tue, 1 Nov 2016 01:56:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F6B229398 for ; Tue, 1 Nov 2016 01:56:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24252293A1; Tue, 1 Nov 2016 01:56:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6077A29398 for ; Tue, 1 Nov 2016 01:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161358AbcKAB4g (ORCPT ); Mon, 31 Oct 2016 21:56:36 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:32870 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161313AbcKAB4f (ORCPT ); Mon, 31 Oct 2016 21:56:35 -0400 Received: by mail-pf0-f193.google.com with SMTP id a136so6781039pfa.0 for ; Mon, 31 Oct 2016 18:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lcnpkgAFuKIh0hFMPKHVa6bxedwAA94U6sFH8txF44A=; b=ybjUucwq0NG25JntHv5ZurmKiiCZu6Tqq0rPjvk5NOg5jCBU0GPfRWlvDtM/Kpjo8R w61pkbsJ6SkINUvZF0m0y2qyqOp+XrMI6Uf/NXbApL82HpzWPUhyJLl5L4/ktzD8IP+N G8TIlWkjRdUlJt9gAPUg9+tn2Yf/F+Sty4+cqOZ8SoYxxMPyFTGt9M66ix6kT4RIKVc8 5mhGeeIZgpXpuCRFuTWwGnxrNJJZReQqIGwu21Sc7LvBUsIBBD5luqVxA0VAM5Gox844 86Y59M/H95Kwr3Inthw1AlbtwSdOAyUM2VtyQFKgbi4gTbwhXIkWOTAPTWd+63MkEwHG AZCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lcnpkgAFuKIh0hFMPKHVa6bxedwAA94U6sFH8txF44A=; b=Ups518C8p1yNlY+wZITkqNaUYkTELe1hcKGquie6qBFJgWTyhL17cxyF+swm4QwsPQ Dql+cyZugKc6cTECoRF2XBuq5T/3z+A44UOTQja7LcqQMddQ98PsjMBVHoblUlRAA9QH +b61PjWLbY1SabWEHTufshU1RaS0E4B7ISxOT4PasbnmruElJ3awTnaUWA7zJzFxmNTK tsjJpNFabulvi+f760MeZWR4A5DlFd2mo3ZxqpGCnBivIS4orZ5I8MfC3HUvwWUbIwSu KLm4CExR2i6jXhMksm9npfUNHOeLThisv2okGBd4av6A6xyNVYSdXA2JjN89WhC9Tjmx 6ZMA== X-Gm-Message-State: ABUngvegkAjDCL8qC21FcfqppAVVdZqlmV5mSa3q/GFdfYSCrQimBdvDPl6Q7KB3AM7kQQ== X-Received: by 10.98.211.135 with SMTP id z7mr2549925pfk.109.1477965394305; Mon, 31 Oct 2016 18:56:34 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id yx8sm38278189pac.29.2016.10.31.18.56.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Oct 2016 18:56:33 -0700 (PDT) From: Nicholas Piggin To: Michal Marek Cc: Nicholas Piggin , linux-kbuild@vger.kernel.org, Stephen Rothwell Subject: [PATCH 1/2] kbuild: thin archives for multi-y targets Date: Tue, 1 Nov 2016 12:56:13 +1100 Message-Id: <20161101015614.1546-2-npiggin@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161101015614.1546-1-npiggin@gmail.com> References: <20161101015614.1546-1-npiggin@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP THIN_ARCHIVES builds archives for built-in.o targets, have it build multi-y targets as archives as well. This saves another ~15% of the size of intermediate artifacts in the build tree. After this patch, the linker is only used in final link, and special cases like vdsos. Signed-off-by: Nicholas Piggin --- scripts/Makefile.build | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 6312e14..6990932 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -514,11 +514,18 @@ $($(subst $(obj)/,,$(@:.o=-objs))) \ $($(subst $(obj)/,,$(@:.o=-y))) \ $($(subst $(obj)/,,$(@:.o=-m)))), $^) -quiet_cmd_link_multi-y = LD $@ -cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) +cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis) + +ifdef CONFIG_THIN_ARCHIVES + quiet_cmd_link_multi-y = AR $@ + cmd_link_multi-y = rm -f $@; $(AR) rcST$(KBUILD_ARFLAGS) $@ $(link_multi_deps) +else + quiet_cmd_link_multi-y = LD $@ + cmd_link_multi-y = $(cmd_link_multi-link) +endif quiet_cmd_link_multi-m = LD [M] $@ -cmd_link_multi-m = $(cmd_link_multi-y) +cmd_link_multi-m = $(cmd_link_multi-link) $(multi-used-y): FORCE $(call if_changed,link_multi-y)