Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab96d59f authored by Laura Abbott's avatar Laura Abbott Committed by Matt Wagantall
Browse files

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: default avatarLaura Abbott <lauraa@codeaurora.org>
(cherry picked from commit d34cd35c3aacb219de789a61a140e7f095794a3f)
[stepanm@codeaurora.org: resolve minor conflict]
Signed-off-by: default avatarStepan Moskovchenko <stepanm@codeaurora.org>
parent 9620edfd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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)

MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS)))
+23 −6
Original line number Diff line number Diff line
@@ -33,6 +33,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 */
@@ -2140,7 +2142,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: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;
@@ -2181,6 +2183,9 @@ int main(int argc, char **argv)
		case 'w':
			warn_unresolved = 1;
			break;
		case 'E':
			section_error_on_mismatch = 1;
			break;
		default:
			exit(1);
		}
@@ -2233,11 +2238,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"

	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;
}