All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Gorski <jonas.gorski@gmail.com>
To: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <mmarek@suse.com>
Subject: [PATCH] kbuild: allow making undefined symbols fatal for external modules
Date: Mon,  2 Oct 2017 12:50:04 +0200	[thread overview]
Message-ID: <20171002105004.32426-1-jonas.gorski@gmail.com> (raw)

By passing appropriate values in KBUILD_EXTRA_SYMBOLS it is possible to
make modpost be able to resolve all symbols for external modules, even
between to other external modules.

Because of this, it might be desirable to make unresolved symbols an
error on external module builds as well, to catch missing exports there
as well.

So add a new flag KBUILD_MODPOST_ERROR which can be set to enable this
behaviour. It has no effect on non external module builds.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
The main target is to allow distributions (like LEDE) that make use of
kernel backports and other out of tree drivers to be able to catch
errors like missing EXPORT_SYMBOLs in the kernel early.

 scripts/Makefile.modpost | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 16923ba4b5b1..29f787bf8c3a 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -34,6 +34,8 @@
 
 # KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined
 # symbols in the final module linking stage
+# KBUILD_MODPOST_ERROR can be set to error out in case of undefined
+# symbols in the final module linking stage for external modules
 # KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
 # This is solely useful to speed up test compiles
 PHONY := _modpost
@@ -49,6 +51,8 @@ ifneq ($(KBUILD_EXTMOD),)
 obj := $(KBUILD_EXTMOD)
 src := $(obj)
 
+KBUILD_MODPOST_WARN = $(if $(KBUILD_MODPOST_ERROR),,1)
+
 # Include the module's Makefile to find KBUILD_EXTRA_SYMBOLS
 include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
              $(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
@@ -78,7 +82,7 @@ modpost = scripts/mod/modpost                    \
  $(if $(KBUILD_EXTMOD),-o $(modulesymfile))      \
  $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S)      \
  $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E)  \
- $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
+ $(if $(KBUILD_MODPOST_WARN),-w)
 
 MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS)))
 
-- 
2.13.2

             reply	other threads:[~2017-10-02 10:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-02 10:50 Jonas Gorski [this message]
2017-10-09 16:25 ` [PATCH] kbuild: allow making undefined symbols fatal for external modules Masahiro Yamada
2017-10-10  9:04   ` Jonas Gorski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171002105004.32426-1-jonas.gorski@gmail.com \
    --to=jonas.gorski@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.