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

Showing the changes to scripts/mod (1 of 1 file). Show all

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
12031203
12041204 static void default_mismatch_handler(const char *modname, struct elf_info *elf,
12051205 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)
12071208 {
1208− const char *tosec;
12091209 Elf_Sym *to;
12101210 Elf_Sym *from;
12111211 const char *tosym;
@@ -1214,7 +1214,6 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, · 2 unmodified lines
12141214 from = find_elf_symbol2(elf, r->r_offset, fromsec);
12151215 fromsym = sym_name(elf, from);
12161216
1217− tosec = sec_name(elf, get_secindex(elf, sym));
12181217 to = find_elf_symbol(elf, r->r_addend, sym);
12191218 tosym = sym_name(elf, to);
12201219
@@ -1276,7 +1275,7 @@ static void check_section_mismatch(const char *modname, struct elf_info *elf, · 55 unmodified lines
12761275 if (!mismatch)
12771276 return;
12781277
1279− default_mismatch_handler(modname, elf, mismatch, r, sym, fromsec);
1278+ default_mismatch_handler(modname, elf, mismatch, r, sym, fromsec, tosec);
12801279 }
12811280
12821281 static unsigned int *reloc_location(struct elf_info *elf,