- Enable verbose reporting from modpost in order to help resolve
            the section mismatches that are reported.
 
+config SECTION_MISMATCH_WARN_ONLY
+       bool "Make section mismatch errors non-fatal"
+       default y
+       help
+         If you say N here, the build process will fail if there are any
+         section mismatch, instead of just throwing warnings.
+
+         If unsure, say Y.
+
 #
 # Select this config option from the architecture Kconfig, if it
 # is preferred to always offer frame pointers as a config
 
  $(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
  $(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)
 
 MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS)))
 
 /* How a symbol is exported */
 static int sec_mismatch_count = 0;
 static int sec_mismatch_verbose = 1;
+static int sec_mismatch_fatal = 0;
 /* ignore missing files */
 static int ignore_missing_files;
 
        struct ext_sym_list *extsym_iter;
        struct ext_sym_list *extsym_start = NULL;
 
-       while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:")) != -1) {
+       while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:E")) != -1) {
                switch (opt) {
                case 'i':
                        kernel_read = optarg;
                case 'w':
                        warn_unresolved = 1;
                        break;
+               case 'E':
+                       sec_mismatch_fatal = 1;
+                       break;
                default:
                        exit(1);
                }
                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"
+                             "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
+               }
+       }
 
        return err;
 }