Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp774178ybx; Wed, 6 Nov 2019 08:14:42 -0800 (PST) X-Google-Smtp-Source: APXvYqxPwDpq2vt7YpYkjUgwzdx0Fv1/aNxntPMymqVCzHLVkooVX5T+Vy5XZV5wlHsBumh7zdMw X-Received: by 2002:aa7:c3d0:: with SMTP id l16mr3633587edr.18.1573056882093; Wed, 06 Nov 2019 08:14:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573056882; cv=none; d=google.com; s=arc-20160816; b=dTyLxmJTBa49GOVdclN3Rm4TsPCe8r65tjJ7TbDeQp1YrvDeTl1lADX52YDWv8R+Hq V71nO0J6dPLJz7Tu3Yijpraw6WaQrHqiAyZA2BeCCy/+J+kAqw8Vcw69sJvCGcNYiZ/j nnvMwvAuLyd+oj7oQCqBrqvEU3suSzq7E3LEMVWlXF7qbHTvV6ifVtMsNpdaht9tWPQ/ cG3Yp5nlwNsvgxS1qLj9KUxdI2ZayRQVgFIETXRntH/HEQnt8M3jPVGYg/gnxr1I5rCB fbUGgaMC2ngLBu70hUS6ZO7PzBznyXij+UcRJxGaZ3fAIUqTpTHsnplqKE0nYHBvNQJO AnTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1KzRnMH55iNF2+p95RAsnTdJw/GC1Gd3D087wCrTJsE=; b=HBcr4ZVmAjUNxQ9VGWUqdvFOi6jtjv4oW68A2o9B8gJhLRf4veDUtVDMR+vxzY6IYm P34tk/+IuO4YFqCS1ugYZ19fOpD0LNcqI+r3ytcJCucPPP0jc+O3fwF+QR8FFtTBZgcM x6EPBkxxLhYYMHXAEfuUZPKvHglTlU063IEwNSoxnbQNlCJGBJRC1hFCkyAZSjn9c6mR RtoeBoKfg0onipHJxHb76g18m4QmXjaINPTgFAb3uYHO9GgaITfQ3fXAa/msd6XbTrUJ Bpgn1ESf30B0KZ8IFkIscnLj9ptoCFuvPdhrFBysKTK+9q0MtofD9b5wWvp2nugTcCBG ksyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JbPvNMig; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oq2si3189853ejb.402.2019.11.06.08.14.16; Wed, 06 Nov 2019 08:14:42 -0800 (PST) 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=@google.com header.s=20161025 header.b=JbPvNMig; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728779AbfKFQMK (ORCPT + 99 others); Wed, 6 Nov 2019 11:12:10 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35742 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727285AbfKFQMK (ORCPT ); Wed, 6 Nov 2019 11:12:10 -0500 Received: by mail-wr1-f68.google.com with SMTP id p2so1313730wro.2 for ; Wed, 06 Nov 2019 08:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1KzRnMH55iNF2+p95RAsnTdJw/GC1Gd3D087wCrTJsE=; b=JbPvNMigLGbF2aRlJmh7roildZkpRTH0HmKUbzD0MpncGM+PFJ9Dxf3CpD+w3MvJzo NVuj9nCNWxukoTVo7ajSqAxADVl7BcfyyszdjPprlZNvQKdWG/2TmGwI1zR7cuBaPCGa 4pnIjgNEN6Z+ONR4kUT5/MUKQOEk8uyVHK9t6MjMMSQshNij3OqXDiRWinGJ7x5eLjzn H7SfrET9hvmajGBm4P3GEL9oEwpnntdddYnBB9c30cprHbEIOVuJXwKt3GwbeDYD/yjf 84vYrW0woBueYI+QkG9iIEhhiWtIi4186vnMTX3OUAQJcHmCsLbnOpjSQYCHH+j2I08A bYJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=1KzRnMH55iNF2+p95RAsnTdJw/GC1Gd3D087wCrTJsE=; b=XT8yyMRYCxiUdJ4HevE1gnxoyUK//PjO+T7vg8/mNgVPMHHhwAw33fbeS1vS9EEN0D z1eKTI1FBa/XptQ9a0FUUdxjUP4cvAAjO+62kJ6Zli09I2ZagWv6lNchVBKAx4kaz4Zs DvtMtA6fToypJ8nXEkNlKwf2Twg+y+5U61vkzf5KhB+rCtw8CLfku9d8iWSXD+UslUZp DsFwNlJ6S1Fmh+1ZYU+OtEtWe/KZ/27E9HZYBfaCpHc8FDshw9ObynO+/XXHs0ApZjUO bUqylorfmSLO5yyyJkRaqgGgvrDbbHzsVjmQ/XZsvOzaegVJWJ8Kw5J4iKkDKaMljlpk GsNg== X-Gm-Message-State: APjAAAWZSI0zCT4NkZopxWZbYZoPKytUg7fdmuGjrSEIuGDQ4J4uC7kI E1UBXXvtIff02F/M5yzDcqHfMA== X-Received: by 2002:a5d:6947:: with SMTP id r7mr3556903wrw.129.1573056727073; Wed, 06 Nov 2019 08:12:07 -0800 (PST) Received: from google.com ([2a00:79e0:d:210:e8f7:125b:61e9:733d]) by smtp.gmail.com with ESMTPSA id q25sm29781143wra.3.2019.11.06.08.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2019 08:12:06 -0800 (PST) Date: Wed, 6 Nov 2019 16:12:05 +0000 From: Matthias Maennich To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, Jessica Yu , Matthias Kaehlcke , Jonathan Corbet , Michal Marek , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/4] scripts/nsdeps: support nsdeps for external module builds Message-ID: <20191106161205.GB1243@google.com> References: <20191029123809.29301-1-yamada.masahiro@socionext.com> <20191029123809.29301-4-yamada.masahiro@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20191029123809.29301-4-yamada.masahiro@socionext.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 29, 2019 at 09:38:08PM +0900, Masahiro Yamada wrote: >Apparently, scripts/nsdeps is written to take care of only in-tree >modules. Perhaps, this is not a bug, but just a design. At least, >Documentation/core-api/symbol-namespaces.rst focuses on in-tree modules: > > Again, `make nsdeps` will eventually add the missing namespace imports for > in-tree modules:: > ^^^^^^^ > >Having said that, I already saw at least two people trying nsdeps for >external module builds. So, it would be nice to support it. > >Reported-by: Steve French >Reported-by: Jessica Yu >Signed-off-by: Masahiro Yamada >--- > Reviewed-by: Matthias Maennich Tested-by: Matthias Maennich Cheers, Matthias > Documentation/core-api/symbol-namespaces.rst | 3 +++ > Makefile | 1 + > scripts/Makefile.modpost | 2 +- > scripts/nsdeps | 10 ++++++++-- > 4 files changed, 13 insertions(+), 3 deletions(-) > >diff --git a/Documentation/core-api/symbol-namespaces.rst b/Documentation/core-api/symbol-namespaces.rst >index 982ed7b568ac..9b76337f6756 100644 >--- a/Documentation/core-api/symbol-namespaces.rst >+++ b/Documentation/core-api/symbol-namespaces.rst >@@ -152,3 +152,6 @@ in-tree modules:: > - notice the warning of modpost telling about a missing import > - run `make nsdeps` to add the import to the correct code location > >+You can also run nsdeps for external module builds. A typical usage is:: >+ >+ $ make -C M=$PWD nsdeps >diff --git a/Makefile b/Makefile >index 1e3f307bd49b..780a65493866 100644 >--- a/Makefile >+++ b/Makefile >@@ -1007,6 +1007,7 @@ endif > PHONY += prepare0 > > export MODORDER := $(extmod-prefix)modules.order >+export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps > > ifeq ($(KBUILD_EXTMOD),) > core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/ >diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost >index da37128c3f9f..8359f8af5ee6 100644 >--- a/scripts/Makefile.modpost >+++ b/scripts/Makefile.modpost >@@ -66,7 +66,7 @@ __modpost: > else > > MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - \ >- $(if $(KBUILD_NSDEPS),-d modules.nsdeps) >+ $(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS)) > > ifeq ($(KBUILD_EXTMOD),) > MODPOST += $(wildcard vmlinux) >diff --git a/scripts/nsdeps b/scripts/nsdeps >index 08db427a7fe5..3b8a9e173ebf 100644 >--- a/scripts/nsdeps >+++ b/scripts/nsdeps >@@ -21,6 +21,12 @@ if [ "$SPATCH_VERSION_NUM" -lt "$SPATCH_REQ_VERSION_NUM" ] ; then > exit 1 > fi > >+if [ "$KBUILD_EXTMOD" ]; then >+ src_prefix= >+else >+ src_prefix=$srctree/ >+fi >+ > generate_deps_for_ns() { > $SPATCH --very-quiet --in-place --sp-file \ > $srctree/scripts/coccinelle/misc/add_namespace.cocci -D ns=$1 $2 >@@ -32,7 +38,7 @@ generate_deps() { > local namespaces="$*" > local mod_source_files=`cat $mod.mod | sed -n 1p \ > | sed -e 's/\.o/\.c/g' \ >- | sed "s|[^ ]* *|${srctree}/&|g"` >+ | sed "s|[^ ]* *|${src_prefix}&|g"` > for ns in $namespaces; do > echo "Adding namespace $ns to module $mod.ko." > generate_deps_for_ns $ns $mod_source_files >@@ -54,4 +60,4 @@ generate_deps() { > while read line > do > generate_deps $line >-done < modules.nsdeps >+done < $MODULES_NSDEPS >-- >2.17.1 >