[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230513204502.1593923-15-masahiroy@kernel.org>
Date: Sun, 14 May 2023 05:44:55 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Pitre <npitre@...libre.com>,
Nicolas Schier <nicolas@...sle.eu>,
Masahiro Yamada <masahiroy@...nel.org>
Subject: [PATCH v4 14/21] modpost: remove is_shndx_special() check from section_rel(a)
This check is unneeded. Without it, sec_name() will returns the null
string "", then section_mismatch() will return immediately.
Anyway, special section indices do not appear quite often in these
loops.
Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---
scripts/mod/modpost.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 43ce35377f6a..1c5dd81c0987 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1347,7 +1347,6 @@ static int addend_mips_rel(struct elf_info *elf, Elf_Shdr *sechdr, Elf_Rela *r)
static void section_rela(const char *modname, struct elf_info *elf,
Elf_Shdr *sechdr)
{
- Elf_Sym *sym;
Elf_Rela *rela;
Elf_Rela r;
unsigned int r_sym;
@@ -1390,11 +1389,8 @@ static void section_rela(const char *modname, struct elf_info *elf,
continue;
break;
}
- sym = elf->symtab_start + r_sym;
- /* Skip special sections */
- if (is_shndx_special(sym->st_shndx))
- continue;
- check_section_mismatch(modname, elf, sym,
+
+ check_section_mismatch(modname, elf, elf->symtab_start + r_sym,
fsecndx, fromsec, r.r_offset, r.r_addend);
}
}
@@ -1402,7 +1398,6 @@ static void section_rela(const char *modname, struct elf_info *elf,
static void section_rel(const char *modname, struct elf_info *elf,
Elf_Shdr *sechdr)
{
- Elf_Sym *sym;
Elf_Rel *rel;
Elf_Rela r;
unsigned int r_sym;
@@ -1449,11 +1444,8 @@ static void section_rel(const char *modname, struct elf_info *elf,
default:
fatal("Please add code to calculate addend for this architecture\n");
}
- sym = elf->symtab_start + r_sym;
- /* Skip special sections */
- if (is_shndx_special(sym->st_shndx))
- continue;
- check_section_mismatch(modname, elf, sym,
+
+ check_section_mismatch(modname, elf, elf->symtab_start + r_sym,
fsecndx, fromsec, r.r_offset, r.r_addend);
}
}
--
2.39.2
Powered by blists - more mailing lists