diff mbox series

[v6,09/20] modpost: pass struct module pointer to check_section_mismatch()

Message ID 20230521160426.1881124-10-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
The next commit will use it.

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

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

Comments

Nick Desaulniers May 25, 2023, 5:23 p.m. UTC | #1
On Sun, May 21, 2023 at 9:05 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> The next commit will use it.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>
>  scripts/mod/modpost.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
> index 40fac4f64fcd..378fb9649545 100644
> --- a/scripts/mod/modpost.c
> +++ b/scripts/mod/modpost.c
> @@ -1229,7 +1229,7 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf,
>         }
>  }
>
> -static void check_section_mismatch(const char *modname, struct elf_info *elf,
> +static void check_section_mismatch(struct module *mod, struct elf_info *elf,
>                                    Elf_Sym *sym,
>                                    unsigned int fsecndx, const char *fromsec,
>                                    Elf_Addr faddr, Elf_Addr taddr)
> @@ -1240,7 +1240,7 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf,
>         if (!mismatch)
>                 return;
>
> -       default_mismatch_handler(modname, elf, mismatch, sym,
> +       default_mismatch_handler(mod->name, elf, mismatch, sym,
>                                  fsecndx, fromsec, faddr,
>                                  tosec, taddr);
>  }
> @@ -1358,7 +1358,7 @@ static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
>  #define R_LARCH_SUB32          55
>  #endif
>
> -static void section_rela(const char *modname, struct elf_info *elf,
> +static void section_rela(struct module *mod, struct elf_info *elf,
>                          Elf_Shdr *sechdr)
>  {
>         Elf_Rela *rela;
> @@ -1404,12 +1404,12 @@ static void section_rela(const char *modname, struct elf_info *elf,
>                         break;
>                 }
>
> -               check_section_mismatch(modname, elf, elf->symtab_start + r_sym,
> +               check_section_mismatch(mod, elf, elf->symtab_start + r_sym,
>                                        fsecndx, fromsec, r.r_offset, r.r_addend);
>         }
>  }
>
> -static void section_rel(const char *modname, struct elf_info *elf,
> +static void section_rel(struct module *mod, struct elf_info *elf,
>                         Elf_Shdr *sechdr)
>  {
>         Elf_Rel *rel;
> @@ -1459,7 +1459,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
>                         fatal("Please add code to calculate addend for this architecture\n");
>                 }
>
> -               check_section_mismatch(modname, elf, elf->symtab_start + r_sym,
> +               check_section_mismatch(mod, elf, elf->symtab_start + r_sym,
>                                        fsecndx, fromsec, r.r_offset, r.r_addend);
>         }
>  }
> @@ -1476,19 +1476,19 @@ static void section_rel(const char *modname, struct elf_info *elf,
>   * to find all references to a section that reference a section that will
>   * be discarded and warns about it.
>   **/
> -static void check_sec_ref(const char *modname, struct elf_info *elf)
> +static void check_sec_ref(struct module *mod, struct elf_info *elf)
>  {
>         int i;
>         Elf_Shdr *sechdrs = elf->sechdrs;
>
>         /* Walk through all sections */
>         for (i = 0; i < elf->num_sections; i++) {
> -               check_section(modname, elf, &elf->sechdrs[i]);
> +               check_section(mod->name, elf, &elf->sechdrs[i]);
>                 /* We want to process only relocation sections and not .init */
>                 if (sechdrs[i].sh_type == SHT_RELA)
> -                       section_rela(modname, elf, &elf->sechdrs[i]);
> +                       section_rela(mod, elf, &elf->sechdrs[i]);
>                 else if (sechdrs[i].sh_type == SHT_REL)
> -                       section_rel(modname, elf, &elf->sechdrs[i]);
> +                       section_rel(mod, elf, &elf->sechdrs[i]);
>         }
>  }
>
> @@ -1659,7 +1659,7 @@ static void read_symbols(const char *modname)
>                                              sym_get_data(&info, sym));
>         }
>
> -       check_sec_ref(modname, &info);
> +       check_sec_ref(mod, &info);
>
>         if (!mod->is_vmlinux) {
>                 version = get_modinfo(&info, "version");
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 40fac4f64fcd..378fb9649545 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1229,7 +1229,7 @@  static void default_mismatch_handler(const char *modname, struct elf_info *elf,
 	}
 }
 
-static void check_section_mismatch(const char *modname, struct elf_info *elf,
+static void check_section_mismatch(struct module *mod, struct elf_info *elf,
 				   Elf_Sym *sym,
 				   unsigned int fsecndx, const char *fromsec,
 				   Elf_Addr faddr, Elf_Addr taddr)
@@ -1240,7 +1240,7 @@  static void check_section_mismatch(const char *modname, struct elf_info *elf,
 	if (!mismatch)
 		return;
 
-	default_mismatch_handler(modname, elf, mismatch, sym,
+	default_mismatch_handler(mod->name, elf, mismatch, sym,
 				 fsecndx, fromsec, faddr,
 				 tosec, taddr);
 }
@@ -1358,7 +1358,7 @@  static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
 #define R_LARCH_SUB32		55
 #endif
 
-static void section_rela(const char *modname, struct elf_info *elf,
+static void section_rela(struct module *mod, struct elf_info *elf,
 			 Elf_Shdr *sechdr)
 {
 	Elf_Rela *rela;
@@ -1404,12 +1404,12 @@  static void section_rela(const char *modname, struct elf_info *elf,
 			break;
 		}
 
-		check_section_mismatch(modname, elf, elf->symtab_start + r_sym,
+		check_section_mismatch(mod, elf, elf->symtab_start + r_sym,
 				       fsecndx, fromsec, r.r_offset, r.r_addend);
 	}
 }
 
-static void section_rel(const char *modname, struct elf_info *elf,
+static void section_rel(struct module *mod, struct elf_info *elf,
 			Elf_Shdr *sechdr)
 {
 	Elf_Rel *rel;
@@ -1459,7 +1459,7 @@  static void section_rel(const char *modname, struct elf_info *elf,
 			fatal("Please add code to calculate addend for this architecture\n");
 		}
 
-		check_section_mismatch(modname, elf, elf->symtab_start + r_sym,
+		check_section_mismatch(mod, elf, elf->symtab_start + r_sym,
 				       fsecndx, fromsec, r.r_offset, r.r_addend);
 	}
 }
@@ -1476,19 +1476,19 @@  static void section_rel(const char *modname, struct elf_info *elf,
  * to find all references to a section that reference a section that will
  * be discarded and warns about it.
  **/
-static void check_sec_ref(const char *modname, struct elf_info *elf)
+static void check_sec_ref(struct module *mod, struct elf_info *elf)
 {
 	int i;
 	Elf_Shdr *sechdrs = elf->sechdrs;
 
 	/* Walk through all sections */
 	for (i = 0; i < elf->num_sections; i++) {
-		check_section(modname, elf, &elf->sechdrs[i]);
+		check_section(mod->name, elf, &elf->sechdrs[i]);
 		/* We want to process only relocation sections and not .init */
 		if (sechdrs[i].sh_type == SHT_RELA)
-			section_rela(modname, elf, &elf->sechdrs[i]);
+			section_rela(mod, elf, &elf->sechdrs[i]);
 		else if (sechdrs[i].sh_type == SHT_REL)
-			section_rel(modname, elf, &elf->sechdrs[i]);
+			section_rel(mod, elf, &elf->sechdrs[i]);
 	}
 }
 
@@ -1659,7 +1659,7 @@  static void read_symbols(const char *modname)
 					     sym_get_data(&info, sym));
 	}
 
-	check_sec_ref(modname, &info);
+	check_sec_ref(mod, &info);
 
 	if (!mod->is_vmlinux) {
 		version = get_modinfo(&info, "version");