From patchwork Thu Sep 12 16:22:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 173718 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp2360803ilq; Thu, 12 Sep 2019 09:23:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzbaJJpTllH9wAFBAnUJtAK6otoR/ImQTy6dYQCa1EdRB+JRZyWOnpPkZzkWyGoW+HZZFT X-Received: by 2002:a50:9f42:: with SMTP id b60mr44006001edf.192.1568305394214; Thu, 12 Sep 2019 09:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568305394; cv=none; d=google.com; s=arc-20160816; b=wdAVFrRgrAqCp5zoDrgeVlM8MN4C3HIn2cehaa6+lKreC80Rloys1ugfi5tGRaHzVl AYXUGKD7DgPlXQlp5VY6Cp539i5osUm8cpw4+HkxXcVxNONX4CnrdnzwB5p58OhBipPW DSywNatVLtsMwRNY/xCjPLHBTmPe0LDUaaUzq1lKPwJTNZBAlYvjT8OeLDs3tVx41m/d uNqbbB5Z+Ix2RRGmsycpNIu6TvSJ2/6CWuWV+vOKLA6jSZxTXMcFydcXIyQIqSK487nS NWxDaAYSdoWqIW0mipiY0MDtGdzIDUkCzMXW2DXNszjd5hCjjHEX7WWC1qxNBdJUiqsn 8Ktg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=BmLOVqV59Vde6VCUiKEZh8rSQkSRAqH6r3P6Fy5+ico=; b=FPiZZsHnaaq9SCBnPQrLtEzUJNBUi1WEx8JedWZptTdeXdP4Mje5mvWqskbHJ0AuHm mBrbeCU6TN2vyTkcu93KNqG+K0KCz3kd1Wh/zBnwL53ob/KpDUWolh3gFPliwD3vNMH8 e/I35pKaqsGY0/5G2xof3kOsgI0ugWzy20Hgf1ROG+jCLd5EcV/sOIISen60A/YvgSbG f2BE3tTAktFjrfM6r2UNM6uHQhudbMTTqk2eivRXv1dEf45QDHeNKZsmYXWAI2Z7YKV2 VLunBoGNUMXVGqdtxKHXYbT1Y2CU3nVr6yp1pYldZDTxYGnQoddSXUX9oEw1rCc45eLf NZ9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GnQyqTru; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si13274195ejr.238.2019.09.12.09.23.13; Thu, 12 Sep 2019 09:23:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GnQyqTru; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733172AbfILQXK (ORCPT + 27 others); Thu, 12 Sep 2019 12:23:10 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:42379 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbfILQXJ (ORCPT ); Thu, 12 Sep 2019 12:23:09 -0400 Received: from grover.flets-west.jp (softbank126125143222.bbtec.net [126.125.143.222]) (authenticated) by conuserg-07.nifty.com with ESMTP id x8CGMu1a021030; Fri, 13 Sep 2019 01:22:56 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x8CGMu1a021030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1568305377; bh=BmLOVqV59Vde6VCUiKEZh8rSQkSRAqH6r3P6Fy5+ico=; h=From:To:Cc:Subject:Date:From; b=GnQyqTruc2er6tX9zm3L1Y8mJnaZMNKoOWR/d2UdtM6d2gyz+Pau5nORNcdL02lRv 4k/JzXU3PCw05eKfBmeIca8gG+UyhW8NbP0vjSaiMgPDTk05pp5hhsJ1zu9RAc3U9a 4747NrEfj8fvjq/pF7rJuc50NtedlcNgZUohOGvWFNqLBmt9wEAag4P8a7PLxcfXCW +WvYTw7Hr9k+vRSVcdg+wgtXuutPKe/cQVBTNH2GBLuDNErcl+jIcKUPMfAH65Pjck y8B/+PP7wz3s/UNrTCjzj0MekA112JwcvbJysyZiCPAC7PMGOfsYZ2Zqpjgxxi+9w7 drF3nnfsDCz1A== X-Nifty-SrcIP: [126.125.143.222] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] kbuild: do not create built-in.a that is never linked to vmlinux Date: Fri, 13 Sep 2019 01:22:51 +0900 Message-Id: <20190912162254.9603-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Both 'obj-y += foo/' and 'obj-m += foo/' requrest Kbuild to visit the sub-directory foo/, but the difference is that only the former combines foo/built-in.a into the built-in.a of the current directory because everything in sub-directories visited by obj-m is supposed to be modular. So, it makes sense to create built-in.a only if that sub-directory is reachable by the chain of obj-y. Otherwise, useless orphan built-in.a files are generated. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.build | 2 +- scripts/Makefile.lib | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f72aba64d611..6c3e6cb0c0af 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -66,7 +66,7 @@ lib-target := $(obj)/lib.a real-obj-y += $(obj)/lib-ksyms.o endif -ifneq ($(strip $(real-obj-y) $(need-builtin)),) +ifdef need-builtin builtin-target := $(obj)/built-in.a endif diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 4a0cdd6f5909..26ac638525cb 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -35,7 +35,11 @@ __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) subdir-m += $(__subdir-m) +ifdef need-builtin obj-y := $(patsubst %/, %/built-in.a, $(obj-y)) +else +obj-y := $(filter-out %/, $(obj-y)) +endif obj-m := $(filter-out %/, $(obj-m)) # Subdirectories we need to descend into