History

modpost: pass 'tosec' down to default_mismatch_handler()

default_mismatch_handler() does not need to compute 'tosec' because it is calculated by the caller. Pass it down to default_mismatch_handler() instead of calling sec_name() twice.

Masahiro Yamada committed 3 years ago

Commit dbf7cc21 parent 856567d1 file · +3 −4Browse files

Unified · Split

scripts/mod/modpost.c+3−4
@@ -1203,9 +1203,9 @@ static bool is_executable_section(struct elf_info *elf, unsigned int secndx) · 1202 unmodified lines
1203 1203
1204static void default_mismatch_handler(const char *modname, struct elf_info *elf,1204static void default_mismatch_handler(const char *modname, struct elf_info *elf,
1205 const struct sectioncheck* const mismatch,1205 const struct sectioncheck* const mismatch,
1206 Elf_Rela *r, Elf_Sym *sym, const char *fromsec)1206 Elf_Rela *r, Elf_Sym *sym, const char *fromsec,
1207 const char *tosec)
1207{1208{
1208 const char *tosec;
1209 Elf_Sym *to;1209 Elf_Sym *to;
1210 Elf_Sym *from;1210 Elf_Sym *from;
1211 const char *tosym;1211 const char *tosym;
@@ -1214,7 +1214,6 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, · 2 unmodified lines
1214 from = find_elf_symbol2(elf, r->r_offset, fromsec);1214 from = find_elf_symbol2(elf, r->r_offset, fromsec);
1215 fromsym = sym_name(elf, from);1215 fromsym = sym_name(elf, from);
1216 1216
1217 tosec = sec_name(elf, get_secindex(elf, sym));
1218 to = find_elf_symbol(elf, r->r_addend, sym);1217 to = find_elf_symbol(elf, r->r_addend, sym);
1219 tosym = sym_name(elf, to);1218 tosym = sym_name(elf, to);
1220 1219
@@ -1276,7 +1275,7 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf, · 55 unmodified lines
1276 if (!mismatch)1275 if (!mismatch)
1277 return;1276 return;
1278 1277
1279 default_mismatch_handler(modname, elf, mismatch, r, sym, fromsec);1278 default_mismatch_handler(modname, elf, mismatch, r, sym, fromsec, tosec);
1280}1279}
1281 1280
1282static unsigned int *reloc_location(struct elf_info *elf,1281static unsigned int *reloc_location(struct elf_info *elf,