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.
Unified · Split
| @@ -1203,9 +1203,9 @@ static bool is_executable_section(struct elf_info *elf, unsigned int secndx) · 1202 unmodified lines | ||
| 1203 | 1203 | |
| 1204 | 1204 | static void default_mismatch_handler(const char *modname, struct elf_info *elf, |
| 1205 | 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 | 1209 | Elf_Sym *to; |
| 1210 | 1210 | Elf_Sym *from; |
| 1211 | 1211 | const char *tosym; |
| @@ -1214,7 +1214,6 @@ static void default_mismatch_handler(const char *modname, struct elf_info *elf, · 2 unmodified lines | ||
| 1214 | 1214 | from = find_elf_symbol2(elf, r->r_offset, fromsec); |
| 1215 | 1215 | fromsym = sym_name(elf, from); |
| 1216 | 1216 | |
| 1217 | − tosec = sec_name(elf, get_secindex(elf, sym)); | |
| 1218 | 1217 | to = find_elf_symbol(elf, r->r_addend, sym); |
| 1219 | 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 | 1275 | if (!mismatch) |
| 1277 | 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 | |
| 1282 | 1281 | static unsigned int *reloc_location(struct elf_info *elf, |