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 7e09887d59
commit a57bc25400
2 changed files with 24 additions and 6 deletions

View file

@ -77,6 +77,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)
# We can go over command line length here, so be careful.

View file

@ -32,6 +32,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 */
@ -2152,7 +2154,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:msST:o:awM:K:")) != -1) {
while ((opt = getopt(argc, argv, "i:I:e:msST:o:awM:K:E")) != -1) {
switch (opt) {
case 'i':
kernel_read = optarg;
@ -2190,6 +2192,9 @@ int main(int argc, char **argv)
case 'w':
warn_unresolved = 1;
break;
case 'E':
section_error_on_mismatch = 1;
break;
default:
exit(1);
}
@ -2242,11 +2247,23 @@ 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 (sec_mismatch_count && 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;
}