Skip to content

Commit

Permalink
modpost: merge two similar section mismatch warnings
Browse files Browse the repository at this point in the history
In case of section mismatch, modpost shows slightly different messages.

For extable section mismatch:

 "%s(%s+0x%lx): Section mismatch in reference to the %s:%s\n"

For the other cases:

 "%s: section mismatch in reference: %s (section: %s) -> %s (section: %s)\n"

They are similar. Merge them.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
  • Loading branch information
Masahiro Yamada committed Jun 22, 2023
1 parent 5e9e95c commit 78dac1a
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,21 +1147,10 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,

sec_mismatch_count++;

switch (mismatch->mismatch) {
case TEXT_TO_ANY_INIT:
case DATA_TO_ANY_INIT:
case TEXTDATA_TO_ANY_EXIT:
case XXXINIT_TO_SOME_INIT:
case XXXEXIT_TO_SOME_EXIT:
case ANY_INIT_TO_ANY_EXIT:
case ANY_EXIT_TO_ANY_INIT:
warn("%s: section mismatch in reference: %s (section: %s) -> %s (section: %s)\n",
modname, fromsym, fromsec, tosym, tosec);
break;
case EXTABLE_TO_NON_TEXT:
warn("%s(%s+0x%lx): Section mismatch in reference to the %s:%s\n",
modname, fromsec, (long)faddr, tosec, tosym);
warn("%s: section mismatch in reference: %s (section: %s) -> %s (section: %s)\n",
modname, fromsym, fromsec, tosym, tosec);

if (mismatch->mismatch == EXTABLE_TO_NON_TEXT) {
if (match(tosec, mismatch->bad_tosec))
fatal("The relocation at %s+0x%lx references\n"
"section \"%s\" which is black-listed.\n"
Expand All @@ -1181,7 +1170,6 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
else
error("%s+0x%lx references non-executable section '%s'\n",
fromsec, (long)faddr, tosec);
break;
}
}

Expand Down

0 comments on commit 78dac1a

Please sign in to comment.