From patchwork Mon Mar 19 09:01:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 132025 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2475795ljb; Mon, 19 Mar 2018 02:02:31 -0700 (PDT) X-Google-Smtp-Source: AG47ELsbkw+/xDvfiRbyhqGWs/UJ6+fOSDbTwtl2C+1IFle+WqzSXTmFpTYXz0BT1uTmP5GSQPQU X-Received: by 2002:a17:902:b703:: with SMTP id d3-v6mr11453071pls.209.1521450151751; Mon, 19 Mar 2018 02:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521450151; cv=none; d=google.com; s=arc-20160816; b=ABMwmFqfAFye+pLS8mhHhZ4W7PK95ATcP84dck52dz2thtKWkuf0BgQTQtrWk0HGms L9Zxmb5zkZmFAPynxINYXXOmvR97xR7pkmz9n30uy27tdu23NoM8GsTXPrBj+bgHChP/ BKetJOkxq64eq4NoXwk/Tp8NQ03SEOIMd/rz7139h8hIIC1c1MOOCOYF/upJqk0X3Pf+ FdowTt8+p7mXPvbcI6mVy5xGamA1VvMnJRSZO0MHhNbCsjBxK6BeujW6EsSDvo8Tg2nl +6Zb5ex0puLfsrXq5xJfuoy4OIwaTm1h+GgS1LNyg2juqAUYA5kd2lEQi5PmOO+YdZBn wsXQ== 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:arc-authentication-results; bh=R/dt7DPdeAApIvBijveYnZMKaqzomizzWysvoVtGnGs=; b=qJScOxA71fQSuCZjJvVagGic/cei3YnFwdWSZxnqfYHETM6K3lbD3+/TXaHHIU17lr ryO2jtJ3czUFmbbMMrdaSbk8l3viUfEq5PfQfwNEvpRvoataj/phvTFITIMVfadUFh5Y TWVTs6CuCOcPDNelv5gMFYRM3tvlhwP9rTx2pnBOoTHMw5nR53tUlBjylIiEr3VlFmb/ ledExvrSGPSnbGKkimYrpQLe4AG3gIYqtoMEUXDDt28W1FY09JHx72XfYaIsoREjs3Tp QlMNT8/b8BxaQ8vKvD0bqdDS/D7S4tv6u64aQ6YD+4fJQNt1zgniz9QJT6/UlJTwK5/R H9cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=OCS6fi/a; 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 v5-v6si10887690ply.427.2018.03.19.02.02.31; Mon, 19 Mar 2018 02:02:31 -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=OCS6fi/a; 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 S932858AbeCSJC1 (ORCPT + 28 others); Mon, 19 Mar 2018 05:02:27 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:50217 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932387AbeCSJCU (ORCPT ); Mon, 19 Mar 2018 05:02:20 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w2J91Vk5014340; Mon, 19 Mar 2018 18:01:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w2J91Vk5014340 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521450091; bh=R/dt7DPdeAApIvBijveYnZMKaqzomizzWysvoVtGnGs=; h=From:To:Cc:Subject:Date:From; b=OCS6fi/aD+vJ5UEfzWJ0JrIqnMBfMNvK2go50FjthuyJiMq8oTzKjmWkqdvqOyulx UaWe2qCPOnPRUQvfNZNXsW8J8dWnOGjJ4uWDRJqMbLAyEZNhE9CS6zg+qPa5Civf8B Au/RLeg8D6yJjL/UIdUgcYvkRuUvB804ppcs/mAgWusl1wTiVxT94yfUqRAnYBFgJo PrzSBqbWA3RmFObamlnUCylR1i3WjgD2gdV7e/EJkpgMfT6c9Nvwu0si5AIKK+3y0u 2l/pcgXtus2ND4x005hPv3aeAptGRe1OL0OmIKewru33fkZdMqbCVdpOQxEKZJN7aO YAvGlJDVubVgg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Cao jin , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH v2 1/5] kbuild: remove unnecessary $(subst $(obj)/, , ...) in modname-multi Date: Mon, 19 Mar 2018 18:01:23 +0900 Message-Id: <1521450087-27291-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the context ... $(obj)/%.s: $(src)/%.c FORCE $(call if_changed_dep,cc_s_c) $(obj)/%.i: $(src)/%.c FORCE $(call if_changed_dep,cpp_i_c) $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) $(obj)/%.lst: $(src)/%.c FORCE $(call if_changed_dep,cc_lst_c) '$*' returns the stem of the target (the part of '%'), so $(obj)/ has already been ripped off. $(subst $(obj)/,,$*.o) is the same as $*.o Signed-off-by: Masahiro Yamada Reviewed-by: Cao jin --- Changes in v2: None scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 5fd60af..4eedd6e 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -175,7 +175,7 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ # Finds the multi-part object the current object will be linked into modname-multi = $(sort $(foreach m,$(multi-used),\ - $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) + $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) # Useful for describing the dependency of composite objects # Usage: From patchwork Mon Mar 19 09:01:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 132027 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2476017ljb; Mon, 19 Mar 2018 02:02:46 -0700 (PDT) X-Google-Smtp-Source: AG47ELujp/ylpeAEx8sB7gFDgnK4wMKv7S6Z42msR5XOdRHfOCm+UzEvlfnEv9CyA25YPHToI4T0 X-Received: by 2002:a17:902:6bc1:: with SMTP id m1-v6mr11716907plt.303.1521450166237; Mon, 19 Mar 2018 02:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521450166; cv=none; d=google.com; s=arc-20160816; b=TXa2RH0QenG6B1zQa80XPcvMMXZvQoFiazibtbk8YpmbA9TSME+bXli/mBdSJN95kg 07k1dc50zpUmXk87CdCGfOWbAfHQs9ZIgYnqWuSW6gle3mL8IXVvesDiVjDUT4PIET2i EPbDY1BaEEFrvzfXHPk3dvAUoKSYbwrYL/B+HbgfjvTCmUPgDGYmN0gdP191XuMGAzNb i3bYkxJl0jqpxytz7bZz83TZ57mTqrHTYrLLg4e9pNaGXXqiCdhHOR4mU2FGlK1iL5dm 2IwYMFnndpNfNvw3Xzj4gWA+0oFv28n1omLMQDms97fjJir1uneiJTKZ9wmNKk67M9Q6 1dkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=FMYkrRtcw40ThDSxNw+8i2XtQSBoeeABpm1A0EPSLSE=; b=JjbvtPJWfRxCytAXrHFOFve2F7aEfDaXq3AZkbiDUPLjpbe6vFPBn7OGiZU5ZXAtM0 Q+MvlBzuemWK1nDYfg9hy6n7Q3qncm8H5RY/hZwtGcB1e44cXWIdjUWtKSCO7eBP7eOC RWvFCXRCOM63oYgStXOcR0BoS+TBBpu7LvMtPLcrKuDYyVbGhY4PlhPxB+ufY7svx5+y DD2wtOlh16j510u1CIClmLO8bGYE7Vm4NvjFS0KYGlrFkqPlSfz27ARQfwof78EqOUtm FdCYVzEBA+LfwVUz29MmsZvnf+8gItsCLMViMHHrgRFHq1uhoTs5uhrqxD3DphZnNFhb vx0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=hap6KvJd; 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 p3si10075416pfh.84.2018.03.19.02.02.45; Mon, 19 Mar 2018 02:02:46 -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=hap6KvJd; 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 S932899AbeCSJCm (ORCPT + 28 others); Mon, 19 Mar 2018 05:02:42 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:50351 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932805AbeCSJCZ (ORCPT ); Mon, 19 Mar 2018 05:02:25 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w2J91Vk6014340; Mon, 19 Mar 2018 18:01:32 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w2J91Vk6014340 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521450092; bh=FMYkrRtcw40ThDSxNw+8i2XtQSBoeeABpm1A0EPSLSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hap6KvJd001Vr17+dQxQuzEGD8fat4ZNm7+WmycoxhkbK7Hv6Dks/IkU/p12xkeQf wZanjoD7TcU8iLXktfn+lhtgiYRRHEV7i36tOB6wS7H6j4qHV1p3QDA2N1GZfQ6lKp 3muY6gd1Qd+IuXpDDxViCVSz9hvW2ffKPY0zqiMFQ1HAdQHEXY+6KwMduquY3rjOPB akRPkS0LXaksAdgu8Fp89e0E8y/sVy6JmFrNIxmgqCyMj4mU5BFTlVmc5IUP2EEvvj bD9oO9SOcSpjXOD41rn4Y+E3X4cIWoPLkurHwrgqCDksgD6MK1mSE2v7pNRg4pZXWC TT9edKmEIxz1Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Cao jin , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH v2 2/5] kbuild: define KBUILD_MODNAME even if multiple modules share objects Date: Mon, 19 Mar 2018 18:01:24 +0900 Message-Id: <1521450087-27291-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521450087-27291-1-git-send-email-yamada.masahiro@socionext.com> References: <1521450087-27291-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, KBUILD_MODNAME is defined only when $(modname) contains just one word. If an object is shared among multiple modules, undefined KBUILD_MODNAME could cause a build error. For example, if CONFIG_DYNAMIC_DEBUG is enabled, any call of printk() populates .modname, then fails to build due to undefined KBUILD_MODNAME. Take the following code as an example: obj-m += foo.o obj-m += bar.o foo-objs := foo-bar-common.o foo-main.o bar-objs := foo-bar-common.o bar-main.o In this case, there is room for argument what to define for KBUILD_MODNAME when foo-bar-common.o is being compiled. "foo", "bar", or what else? One idea is to define colon-separated modules that share the object, in this case, "bar:foo" (modules are sorted alphabetically by $(sort ...). Signed-off-by: Masahiro Yamada Reviewed-by: Cao jin --- Changes in v2: - Remove comments that will be no longer true scripts/Makefile.lib | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 4eedd6e..7feb960 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -87,13 +87,9 @@ subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) # These flags are needed for modversions and compiling, so we define them here # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will # end up in (or would, if it gets compiled in) -# Note: Files that end up in two or more modules are compiled without the -# KBUILD_MODNAME definition. The reason is that any made-up name would -# differ in different configs. name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) -modname_flags = $(if $(filter 1,$(words $(modname))),\ - -DKBUILD_MODNAME=$(call name-fix,$(modname))) +modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ $(ccflags-y) $(CFLAGS_$(basetarget).o) @@ -174,8 +170,10 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ -undef -D__DTS__ # Finds the multi-part object the current object will be linked into -modname-multi = $(sort $(foreach m,$(multi-used),\ - $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))) +# If the object belongs to two or more multi-part objects, all of them are +# concatenated with a colon separator. +modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ + $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))) # Useful for describing the dependency of composite objects # Usage: From patchwork Mon Mar 19 09:01:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 132024 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2475600ljb; Mon, 19 Mar 2018 02:02:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELtKoI1yCrNEMIGxEAmS/QxXQmR2s9y4OsKcPRcyjXtvhEtO3kF10awfxH3khjCk+0bI5zc3 X-Received: by 2002:a17:902:343:: with SMTP id 61-v6mr5613910pld.252.1521450140614; Mon, 19 Mar 2018 02:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521450140; cv=none; d=google.com; s=arc-20160816; b=OGSTszSuWr/j7NjiV34CK+gyUNO/u0acfFs6FOtK/aYc+iNm69Tpzz5pjSo35k5bsc Lvv1h73m/////tE7Dmn1P5UENxWBfEDYiwZTOHvDBV/S2yL3UdWzv0BsaPhxkn8I4owx qOEUkS0uj8Qceu50wlCd8V1jQtcft8L7++bFzGLumGseb11xpyU5hGMkqU1LP1bh5pW7 TEFOg902mGj7Dm+lH6at7xxmRwx+XcIXIbP4PSNcankIzbovUCVCCEjOzQlEdrZfLvR5 V2NKa7GMJkjyMxdUlEFqpmCMOeO0p09JcW3Bh6XU/Jj0IgWRyz25EqArzlQvdto5aJxN fW5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=TfBOFH2Z253AvMeYNTDvsYN/I0Ick7ZfDD/TjrKUatc=; b=zNPIOncFnIE+/eO+XGbFHEC0ZymMebYCdI8iYB+P2yHDiLmOu3lTgcLE1OwdtuAIeq S6r8+DoVFWPIrVDOX7ukIz3CsYkdOlKtM5Vz/4zFLxDzp8pgyS0zNzgtjse8bfgyTJor MFsY84ZlEay17H5TuPWkPXt5K6Z71IX4aQJWs5ujHlI1xS1NDpcvod7U7aIx5RTK5YPL PcGofutWa4YkpkmuKD/pB/kKqW1/ssjC1tIIpz/KF3kRI8fljFNHzLOQ8Mi4znIIaMjd XiHpLRBxZ1IC0DgRxmMN9ePK4j2wQDcAwDaWsAKmbpqjWfOsxUlkIf3O7SHdfQFtzTCX 1iRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Epgd0fnQ; 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 r26si3968626pgu.422.2018.03.19.02.02.20; Mon, 19 Mar 2018 02:02:20 -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=Epgd0fnQ; 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 S932794AbeCSJCP (ORCPT + 28 others); Mon, 19 Mar 2018 05:02:15 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:49938 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932387AbeCSJCL (ORCPT ); Mon, 19 Mar 2018 05:02:11 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w2J91Vk7014340; Mon, 19 Mar 2018 18:01:32 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w2J91Vk7014340 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521450093; bh=TfBOFH2Z253AvMeYNTDvsYN/I0Ick7ZfDD/TjrKUatc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Epgd0fnQXCly+oAkqg+8UyMpvyPMhb8I7Oxuddh83fXAxI9dRuwZ5WuhehZw0cH4H MPrZxGS9N4OQgbUb8iFqQeci2ZYznG/Uvm0ATTu9YhmIjSkax/8EYgo8ZoZbV1E6q1 EyDO6TFRPfa3KiJaOq2Tebij0ascNC1my/lbYdvcfDwNhZ/lzgJ8COxDZQ5wNznsyG +4vHzIcEqfOlLW9G9h/NpwLGHSesyuE4O0IFlHmAlHirLxRFvKm49axu4EW1rkB/Jl mkuOs3fW6Zd5i+O9ZPe6IYz/CbZsf5b+hrhBoCKETS5M4MPolkoeWfWT8dFKxnMkVX gH21ht6ZFIwAw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Cao jin , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH v2 3/5] kbuild: fix modname for composite modules Date: Mon, 19 Mar 2018 18:01:25 +0900 Message-Id: <1521450087-27291-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521450087-27291-1-git-send-email-yamada.masahiro@socionext.com> References: <1521450087-27291-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cao jin Commit cf4f21938e13 ("kbuild: Allow to specify composite modules with modname-m") added modname-m support, but missed to update the corresponding multi-objs-m & modname-multi definition. Signed-off-by: Cao jin Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.lib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7feb960..35c868f 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -50,7 +50,7 @@ single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) # Build list of the parts of our composite objects, our composite # objects depend on those (obviously) multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y))) -multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y))) +multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))) # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to # tell kbuild to descend @@ -173,7 +173,7 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ # If the object belongs to two or more multi-part objects, all of them are # concatenated with a colon separator. modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ - $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))) + $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) # Useful for describing the dependency of composite objects # Usage: From patchwork Mon Mar 19 09:01:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 132026 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2475985ljb; Mon, 19 Mar 2018 02:02:44 -0700 (PDT) X-Google-Smtp-Source: AG47ELuLORIe0r4pItsU9m38JWEEpgFuMfhsptvPlX+j6a+VwWd4fts/OiZPEF0zFsiONDI9O+2M X-Received: by 10.101.69.133 with SMTP id o5mr8533592pgq.156.1521450164002; Mon, 19 Mar 2018 02:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521450163; cv=none; d=google.com; s=arc-20160816; b=ohrZ5iHi+PrAs1EjaV2Hrw0lQ5gZd0ifj3N2EV4/WNlu5HxIOxFW0+BiVDVrswtDVW SGTIxt6NK08WS0N8McgzeyUQLVqGWzyFJmgn8cBy8yCXhMnBmPP1KjTkcInr9kXzUtyO zNvq+0Fyi9YHMS0Du27EHeYcepFG1w8Kr/BSYbconXoCuS0MfpMfMbLAFm42he6PAWqw 8G6eDHmbAEYLQs52bhTrlW7a+SMFF0WvnWKfdeZB/xXfbdRNdSCJYHkQ/Ai0zk+HvYKp BrG5lyNsmr8ueY6BBV79QAhe9PTVOO0bLjsgeNdLdw1GkVMF6H4Z16IYnrfRpSyHJ8zR ikLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=CE8U11DENlrWCBJOcsn9uX0nAsdREoZzuG70ZAOVF90=; b=LSO7MpOYz6487nXxHK7FcHHB6AHLBnyjYe76V0A9f0CXUxazLcdLeF4PIlKRGkgdPp GKbZpkXzbLTyMJI+GN4jwXO7Wd1x22LsuGqgQLR7LeKbDOVhvHU4KwGHIntau+aCNMyN kOVP8i+Sw2e53sfUowIprkQ094nzt8GmGm6z/coC5cWGGACGnGWx3MyhU+ZY5zcnFrwh dE70Q1sgYSgM5x/IhgdOUgH8mXtMdQpOqxw/xpw2eGhi2cf8cjSbOuC+lx+ZPayyHRnG m770ZmBW5kt9SUE/AvJm+KU9Weew2zS+CsUZ15DNiI4WUDqcgNYf3qXfdxBzRL9BTQxA treg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=1uTU+yEQ; 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 p3si10075416pfh.84.2018.03.19.02.02.43; Mon, 19 Mar 2018 02:02:43 -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=1uTU+yEQ; 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 S932881AbeCSJCi (ORCPT + 28 others); Mon, 19 Mar 2018 05:02:38 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:50352 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932808AbeCSJCZ (ORCPT ); Mon, 19 Mar 2018 05:02:25 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w2J91Vk8014340; Mon, 19 Mar 2018 18:01:33 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w2J91Vk8014340 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521450094; bh=CE8U11DENlrWCBJOcsn9uX0nAsdREoZzuG70ZAOVF90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1uTU+yEQcIYoBAHCh1Gmkyh8GWYMP++t+0z3+HJXFtNyuAO4kANGMN9w0i3INQhQG O1iSuoT9vr1ae2RmkNXZzb3S/IRmxuTeteWrq3WzAalOnha2JFHCXed4qiTR5B9WO0 HBdOGnxGQjlm+aLAs/526EuB+JmDRgjNQLvxXKe1Di4dkBhTSzwCpYfbQUeP1+qxLS wxezZOHCB7mJKWEkFJ5zltdJM7ewJ0PCYKua6iBblSUv6xa2VKDzx9hHn704/cdVX8 8RmynxpA8gzs1ZUosg3VgCBN70tSHspzu/ISa47lyk0jCYskSjtRXZRZsIJQl9bmjU z7bEclyeMHSVw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Cao jin , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH v2 4/5] kbuild: simplify modname calculation Date: Mon, 19 Mar 2018 18:01:26 +0900 Message-Id: <1521450087-27291-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521450087-27291-1-git-send-email-yamada.masahiro@socionext.com> References: <1521450087-27291-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org modname can be calculated much more simply. If modname-multi is empty, it is a single-used object. So, modname = $(basetarget). Otherwise, modname = $(modname-multi). Signed-off-by: Masahiro Yamada Reviewed-by: Cao jin --- Changes in v2: None scripts/Makefile.build | 12 +----------- scripts/Makefile.lib | 7 ------- 2 files changed, 1 insertion(+), 18 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 7cd2f4a..f5858f6 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -131,17 +131,7 @@ $(real-objs-m:.o=.lst): quiet_modtag := [M] $(obj-m) : quiet_modtag := [M] -# Default for not multi-part modules -modname = $(basetarget) - -$(multi-objs-m) : modname = $(modname-multi) -$(multi-objs-m:.o=.i) : modname = $(modname-multi) -$(multi-objs-m:.o=.s) : modname = $(modname-multi) -$(multi-objs-m:.o=.lst) : modname = $(modname-multi) -$(multi-objs-y) : modname = $(modname-multi) -$(multi-objs-y:.o=.i) : modname = $(modname-multi) -$(multi-objs-y:.o=.s) : modname = $(modname-multi) -$(multi-objs-y:.o=.lst) : modname = $(modname-multi) +modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 35c868f..537629f 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -47,11 +47,6 @@ multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m multi-used := $(multi-used-y) $(multi-used-m) single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) -# Build list of the parts of our composite objects, our composite -# objects depend on those (obviously) -multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y))) -multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))) - # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to # tell kbuild to descend subdir-obj-y := $(filter %/built-in.a, $(obj-y)) @@ -80,8 +75,6 @@ real-objs-m := $(addprefix $(obj)/,$(real-objs-m)) single-used-m := $(addprefix $(obj)/,$(single-used-m)) multi-used-y := $(addprefix $(obj)/,$(multi-used-y)) multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) -multi-objs-y := $(addprefix $(obj)/,$(multi-objs-y)) -multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) # These flags are needed for modversions and compiling, so we define them here From patchwork Mon Mar 19 09:01:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 132028 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2476294ljb; Mon, 19 Mar 2018 02:03:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELt4fnxHLinyF9xBl3fHQovVLh3Nywf4GoKXMG0Jeee+66DIWJ9tFiwAZPTcQ/8wtyKPMVXB X-Received: by 10.98.233.3 with SMTP id j3mr9670933pfh.38.1521450186868; Mon, 19 Mar 2018 02:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521450186; cv=none; d=google.com; s=arc-20160816; b=aDf/MTE/lX05+nCPBzzHV9z7zJZt3MMlbjPy9YcjQ30At928kCYIdwT5FMVs+sV6Z4 AbsUiNdPrz8EQF4VhYls89K6D/zZmwpmf4cIA1mn4xKO7eiyJbyJ1iR3O2qOGoqLznQP YeJ68RHfxeN7QhzyIGtWylD+R2JQvz6g9sVbj71jYZYeb5YxZS1WjBTNniZBDJdUfTWK LKGxjWZ64ZYLIR3U15vWPVImmKWqq5TJuQBekfJb52kNa8MXQwQbt9SX/9oEdRkxi5Fr Fm7nTYPw7iQVibOxAKNlcen2GVezCa1T8K8K7+CG+f8nWivV9gNsENT8hdK0hkAMSypa nlVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=D+jVwI2EBdHqWOrvY1VMQhEfGs0vHMiXqtnNe/x2ZEI=; b=uvv4yMNIXR9YaXNkEr/gOciAbxcjN+r/RBg9200dLPpiLf8ZDjxQ7udChzq9F32zB1 KwZm5krAOF9OWZsEL3xij5XtjzDGDTB3loKYEtuLS1OflVKLAB38OHGIowj3IipLv8y+ zgScOHiGmWYkii8YtOU0O3PJINvY51azd0b5lfjNl/CEZSzAdbxrHNH+1NLAZCwoP6/W CCR2rLpqDq6LMsxfQuN6IrsJBa7Yktdxb4g5iuijftaUUbOZGMt7IarSoD4omVZbx7Ms EbVzFBVve7C3FyA6aiaHF7XguLmMkfb/Bb+jUAZdv6rwvFtJo9JxfDmuflFkDjjFSGBE fbdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=RqCkVZEv; 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 b63si5932800pgc.72.2018.03.19.02.03.06; Mon, 19 Mar 2018 02:03:06 -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=RqCkVZEv; 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 S932923AbeCSJDD (ORCPT + 28 others); Mon, 19 Mar 2018 05:03:03 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:51364 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932274AbeCSJC6 (ORCPT ); Mon, 19 Mar 2018 05:02:58 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w2J91Vk9014340; Mon, 19 Mar 2018 18:01:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w2J91Vk9014340 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1521450095; bh=D+jVwI2EBdHqWOrvY1VMQhEfGs0vHMiXqtnNe/x2ZEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RqCkVZEvgrOm/obCAj0aF5ezFIWdziS9gerHcFGGmQFJeCgKwtw5bfPB32I1iSq// XEUGy/PF1lmenOP+AuI7GNSJc/ApYP242K9fFanMxiC/UbEUxe7cbu/bD9tBTW5Gan H7N826hC1KBGjbM8QItIfuzCJf+KIcMxvrjKEMKOnTyYYqs5mZ/cpbT7lwQcZ7MCcO 1EruV2hMcIHU3QzlgqKVXTK+/qKRIldYcU+/YNXV8i9wafHJdW2IVS/90cgo/55oJ3 7iaNdlROOSGdjqOBW0ZiAVTfcsTW7TIkksJG/NLCMV5kOLtUymptw07O4dz2bE3GBc 80d0mda1TPQRw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Cao jin , linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek Subject: [PATCH v2 5/5] kbuild: move modname and modname-multi close to modname_flags Date: Mon, 19 Mar 2018 18:01:27 +0900 Message-Id: <1521450087-27291-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521450087-27291-1-git-send-email-yamada.masahiro@socionext.com> References: <1521450087-27291-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Just a cosmetic change to put related code close together. Signed-off-by: Masahiro Yamada Reviewed-by: Cao jin --- Changes in v2: None scripts/Makefile.build | 2 -- scripts/Makefile.lib | 14 ++++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f5858f6..93d05e3 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -131,8 +131,6 @@ $(real-objs-m:.o=.lst): quiet_modtag := [M] $(obj-m) : quiet_modtag := [M] -modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) - quiet_cmd_cc_s_c = CC $(quiet_modtag) $@ cmd_cc_s_c = $(CC) $(c_flags) $(DISABLE_LTO) -fverbose-asm -S -o $@ $< diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 537629f..33af8d4 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -77,6 +77,14 @@ multi-used-y := $(addprefix $(obj)/,$(multi-used-y)) multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) +# Finds the multi-part object the current object will be linked into. +# If the object belongs to two or more multi-part objects, all of them are +# concatenated with a colon separator. +modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ + $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) + +modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) + # These flags are needed for modversions and compiling, so we define them here # $(modname_flags) defines KBUILD_MODNAME as the name of the module it will # end up in (or would, if it gets compiled in) @@ -162,12 +170,6 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \ $(addprefix -I,$(DTC_INCLUDE)) \ -undef -D__DTS__ -# Finds the multi-part object the current object will be linked into -# If the object belongs to two or more multi-part objects, all of them are -# concatenated with a colon separator. -modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ - $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) - # Useful for describing the dependency of composite objects # Usage: # $(call multi_depend, multi_used_targets, suffix_to_remove, suffix_to_add)