summaryrefslogtreecommitdiff
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2023-05-22 01:04:13 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2023-05-28 20:35:16 +0900
commita9bb3e5d57293773d7f925dd07e45f6e13e94947 (patch)
tree24e7fddf38aeff7569da370b864577e5e129f28d /scripts/mod/modpost.c
parent04ed3b476306c1b4c6e544e40d10f477c8193435 (diff)
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 rarely appear in these loops. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index c339d9eda402..1018cd9ced71 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1372,7 +1372,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;
@@ -1415,11 +1414,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);
}
}
@@ -1427,7 +1423,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;
@@ -1474,11 +1469,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);
}
}