[PATCH] kbuild: always show verbose section mismatch warnings
From: Sam Ravnborg
Date: Wed Jun 06 2012 - 17:23:30 EST
The number of section mismatch warnings are down on an acceptable level.
So lets always see the full warning - in the vain hope that
users will recognize the function names and fix them.
This patch enable section mismatch analysis for each link,
but you need to enable CONFIG_DEBUG_SECTION_MISMATCH to
have vmlinux.o analyzed.
This saves us from one time-consuming link step in the final
link of the kernel (which we hit for all changes).
Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
Steven triggered this patch with a comment on G+:
https://plus.google.com/116317370665849559569/posts/RvEpCqrWPLU
And I had in mind to do it anyway..
lib/Kconfig.debug | 14 ++++----------
scripts/Makefile.build | 4 +---
scripts/Makefile.modpost | 1 -
scripts/link-vmlinux.sh | 12 ++++++------
4 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index a42d3ae..5b03f74 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -145,16 +145,10 @@ config DEBUG_SECTION_MISMATCH
the analysis would not catch the illegal reference.
This option tells gcc to inline less (but it does result in
a larger kernel).
- - Run the section mismatch analysis for each module/built-in.o file.
- When we run the section mismatch analysis on vmlinux.o, we
- lose valueble information about where the mismatch was
- introduced.
- Running the analysis for each module/built-in.o file
- tells where the mismatch happens much closer to the
- source. The drawback is that the same mismatch is
- reported at least twice.
- - Enable verbose reporting from modpost in order to help resolve
- the section mismatches that are reported.
+ - Run the section mismatch analysis on vmlinux.o.
+ This will in most cases duplicate already reported warnings,
+ but may catch section mismatchs involving diferent parts
+ of the kernel.
config DEBUG_KERNEL
bool "Kernel debugging"
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index ff1720d..db81790 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -159,9 +159,7 @@ ifneq ($(KBUILD_CHECKSRC),0)
endif
# Do section mismatch analysis for each module/built-in.o
-ifdef CONFIG_DEBUG_SECTION_MISMATCH
- cmd_secanalysis = ; scripts/mod/modpost $@
-endif
+cmd_secanalysis = ; scripts/mod/modpost $@
# Compile C sources (.c)
# ---------------------------------------------------------------------------
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 08dce14..5dc9086 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -79,7 +79,6 @@ modpost = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
$(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
- $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
$(if $(cross_build),-c)
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index cd9c6c6..a2f89e6 100644
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -129,12 +129,12 @@ fi
# We need access to CONFIG_ symbols
. ./.config
-#link vmlinux.o
-info LD vmlinux.o
-modpost_link vmlinux.o
-
-# modpost vmlinux.o to check for section mismatches
-${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o
+# Section mismatch check on vmlinux.o
+if [ ! -n "${CONFIG_DEBUG_SECTION_MISMATCH}" ]; then
+ info LD vmlinux.o
+ modpost_link vmlinux.o
+ ${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o
+fi
# Update version
info GEN .version
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/