modpost: Make section mismatches an error

If any section mismatches are detected the compilation will fail.
Section mismatches can go back to being warnings with
CONFIG_NO_ERROR_ON_MISMATCH=y.

Change-Id: I44f01f348703d2fdda77f2930bc290f6867b5b08
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit d34cd35c3aacb219de789a61a140e7f095794a3f)
This commit is contained in:
Laura Abbott 2010-12-02 11:20:32 -08:00 committed by Stephen Boyd
parent e89b006a72
commit 1bf41f8a12
2 changed files with 23 additions and 6 deletions

View File

@ -80,6 +80,7 @@ modpost = scripts/mod/modpost \
$(if $(KBUILD_EXTRA_SYMBOLS), $(patsubst %, -e %,$(KBUILD_EXTRA_SYMBOLS))) \
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
$(if $(CONFIG_NO_ERROR_ON_MISMATCH),,-E) \
$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
$(if $(cross_build),-c)

View File

@ -37,6 +37,8 @@ static int all_versions = 0;
static int external_module = 0;
/* Warn about section mismatch in vmlinux if set to 1 */
static int vmlinux_section_warnings = 1;
/* Exit with an error when there is a section mismatch if set to 1 */
static int section_error_on_mismatch;
/* Only warn about unresolved symbols */
static int warn_unresolved = 0;
/* How a symbol is exported */
@ -2113,7 +2115,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:E")) != -1) {
switch (opt) {
case 'i':
kernel_read = optarg;
@ -2151,6 +2153,9 @@ int main(int argc, char **argv)
case 'w':
warn_unresolved = 1;
break;
case 'E':
section_error_on_mismatch = 1;
break;
default:
exit(1);
}
@ -2200,11 +2205,22 @@ int main(int argc, char **argv)
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 && !sec_mismatch_verbose) {
merror(
"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 (section_error_on_mismatch) {
err |= 1;
printf(
"To build the kernel despite the mismatches, "
"build with:\n'make CONFIG_NO_ERROR_ON_MISMATCH=y'\n"
"(NOTE: This is not recommended)\n");
}
}
return err;
}