diff mbox series

[v6,17/20] modpost: merge bad_tosec=ALL_EXIT_SECTIONS entries in sectioncheck table

Message ID 20230521160426.1881124-18-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series Unify <linux/export.h> and <asm/export.h>, remove EXPORT_DATA_SYMBOL(), faster TRIM_UNUSED_KSYMS | expand

Commit Message

Masahiro Yamada May 21, 2023, 4:04 p.m. UTC
There is no distinction between TEXT_TO_ANY_EXIT and DATA_TO_ANY_EXIT.
Just merge them.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/mod/modpost.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Comments

Nick Desaulniers May 25, 2023, 6:36 p.m. UTC | #1
On Sun, May 21, 2023 at 9:05 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> There is no distinction between TEXT_TO_ANY_EXIT and DATA_TO_ANY_EXIT.
> Just merge them.

Can something similar be done for ALL_PCI_INIT_SECTIONS and
ALL_XXXINIT_SECTIONS? (as a follow up)

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  scripts/mod/modpost.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index aea9d6cd243d..b5f7f4811c39 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -844,8 +844,7 @@ static const char *const optim_symbols[] = { "*.constprop.*", NULL };
>  enum mismatch {
>         TEXT_TO_ANY_INIT,
>         DATA_TO_ANY_INIT,
> -       TEXT_TO_ANY_EXIT,
> -       DATA_TO_ANY_EXIT,
> +       TEXTDATA_TO_ANY_EXIT,
>         XXXINIT_TO_SOME_INIT,
>         XXXEXIT_TO_SOME_EXIT,
>         ANY_INIT_TO_ANY_EXIT,
> @@ -888,14 +887,9 @@ static const struct sectioncheck sectioncheck[] = {
>         .mismatch = DATA_TO_ANY_INIT,
>  },
>  {
> -       .fromsec = { TEXT_SECTIONS, NULL },
> +       .fromsec = { TEXT_SECTIONS, DATA_SECTIONS, NULL },
>         .bad_tosec = { ALL_EXIT_SECTIONS, NULL },
> -       .mismatch = TEXT_TO_ANY_EXIT,
> -},
> -{
> -       .fromsec = { DATA_SECTIONS, NULL },
> -       .bad_tosec = { ALL_EXIT_SECTIONS, NULL },
> -       .mismatch = DATA_TO_ANY_EXIT,
> +       .mismatch = TEXTDATA_TO_ANY_EXIT,
>  },
>  /* Do not reference init code/data from meminit code/data */
>  {
> @@ -1162,8 +1156,7 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
>         switch (mismatch->mismatch) {
>         case TEXT_TO_ANY_INIT:
>         case DATA_TO_ANY_INIT:
> -       case TEXT_TO_ANY_EXIT:
> -       case DATA_TO_ANY_EXIT:
> +       case TEXTDATA_TO_ANY_EXIT:
>         case XXXINIT_TO_SOME_INIT:
>         case XXXEXIT_TO_SOME_EXIT:
>         case ANY_INIT_TO_ANY_EXIT:
> --
> 2.39.2
>
Masahiro Yamada May 28, 2023, 4:43 p.m. UTC | #2
On Fri, May 26, 2023 at 3:36 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Sun, May 21, 2023 at 9:05 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > There is no distinction between TEXT_TO_ANY_EXIT and DATA_TO_ANY_EXIT.
> > Just merge them.
>
> Can something similar be done for ALL_PCI_INIT_SECTIONS and
> ALL_XXXINIT_SECTIONS? (as a follow up)


Yes, I think so.


BTW, the enum does not have a sensible name.

Commit bb15d8db7cce7 should have added
PCI_INIT_TO_ANY_INIT instead of
ANY_INIT_TO_ANY_EXIT.
diff mbox series

Patch

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index aea9d6cd243d..b5f7f4811c39 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -844,8 +844,7 @@  static const char *const optim_symbols[] = { "*.constprop.*", NULL };
 enum mismatch {
 	TEXT_TO_ANY_INIT,
 	DATA_TO_ANY_INIT,
-	TEXT_TO_ANY_EXIT,
-	DATA_TO_ANY_EXIT,
+	TEXTDATA_TO_ANY_EXIT,
 	XXXINIT_TO_SOME_INIT,
 	XXXEXIT_TO_SOME_EXIT,
 	ANY_INIT_TO_ANY_EXIT,
@@ -888,14 +887,9 @@  static const struct sectioncheck sectioncheck[] = {
 	.mismatch = DATA_TO_ANY_INIT,
 },
 {
-	.fromsec = { TEXT_SECTIONS, NULL },
+	.fromsec = { TEXT_SECTIONS, DATA_SECTIONS, NULL },
 	.bad_tosec = { ALL_EXIT_SECTIONS, NULL },
-	.mismatch = TEXT_TO_ANY_EXIT,
-},
-{
-	.fromsec = { DATA_SECTIONS, NULL },
-	.bad_tosec = { ALL_EXIT_SECTIONS, NULL },
-	.mismatch = DATA_TO_ANY_EXIT,
+	.mismatch = TEXTDATA_TO_ANY_EXIT,
 },
 /* Do not reference init code/data from meminit code/data */
 {
@@ -1162,8 +1156,7 @@  static void default_mismatch_handler(const char *modname, struct elf_info *elf,
 	switch (mismatch->mismatch) {
 	case TEXT_TO_ANY_INIT:
 	case DATA_TO_ANY_INIT:
-	case TEXT_TO_ANY_EXIT:
-	case DATA_TO_ANY_EXIT:
+	case TEXTDATA_TO_ANY_EXIT:
 	case XXXINIT_TO_SOME_INIT:
 	case XXXEXIT_TO_SOME_EXIT:
 	case ANY_INIT_TO_ANY_EXIT: