@@ -81,6 +81,7 @@ modpost = scripts/mod/modpost \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
+ $(if $(CONFIG_SECTION_MISMATCH_FATAL),,-f) \
$(if $(cross_build),-c)
quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
@@ -42,6 +42,7 @@ static int warn_unresolved = 0;
/* How a symbol is exported */
static int sec_mismatch_count = 0;
static int sec_mismatch_verbose = 1;
+static int sec_mismatch_fatal = 0;
enum export {
export_plain, export_unused, export_gpl,
@@ -2127,7 +2128,7 @@ int main(int argc, char **argv)
struct ext_sym_list *extsym_iter;
struct ext_sym_list *extsym_start = NULL;
- while ((opt = getopt(argc, argv, "i:I:e:cmsSo:awM:K:")) != -1) {
+ while ((opt = getopt(argc, argv, "i:I:e:cmsSo:awM:K:f")) != -1) {
switch (opt) {
case 'i':
kernel_read = optarg;
@@ -2165,6 +2166,9 @@ int main(int argc, char **argv)
case 'w':
warn_unresolved = 1;
break;
+ case 'f':
+ sec_mismatch_fatal = 1;
+ break;
default:
exit(1);
}
@@ -2211,14 +2215,20 @@ int main(int argc, char **argv)
sprintf(fname, "%s.mod.c", mod->name);
write_if_changed(&buf, fname);
}
-
if (dump_write)
write_dump(dump_write);
- if (sec_mismatch_count && !sec_mismatch_verbose)
- warn("modpost: Found %d section mismatch(es).\n"
- "To see full details build your kernel with:\n"
- "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
- sec_mismatch_count);
+ if (sec_mismatch_count) {
+ if (!sec_mismatch_verbose) {
+ warn("modpost: Found %d section mismatch(es).\n"
+ "To see full details build your kernel with:\n"
+ "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
+ sec_mismatch_count);
+ }
+ if (sec_mismatch_fatal) {
+ fatal("modpost: Section mismatches detected.\n"
+ "Unset CONFIG_SECTION_MISMATCH_FATAL to allow them.\n");
+ }
+ }
return err;
}
The section mismatch warning can be easy to miss during the kernel build process. Allow it to be marked as fatal to be easily caught and prevent mismatches from slipping in. Signed-off-by: Jonathan Kliegman <kliegs@chromium.org> --- scripts/Makefile.modpost | 1 + scripts/mod/modpost.c | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-)