mirror of
https://github.com/dynup/kpatch
synced 2025-03-22 02:46:33 +00:00
Merge pull request #916 from sm00th/issue910
Move lookup_open() call to a later stage.
This commit is contained in:
commit
4e05697e41
@ -2482,7 +2482,7 @@ static struct sym_compare_type *kpatch_elf_locals(struct kpatch_elf *kelf)
|
||||
continue;
|
||||
|
||||
sym_array[i].type = sym->type;
|
||||
sym_array[i++].name = sym->name;
|
||||
sym_array[i++].name = strdup(sym->name);
|
||||
}
|
||||
sym_array[i].type = 0;
|
||||
sym_array[i].name = NULL;
|
||||
@ -3229,7 +3229,7 @@ int main(int argc, char *argv[])
|
||||
struct symbol *sym;
|
||||
char *hint = NULL, *orig_obj, *patched_obj, *parent_name;
|
||||
char *parent_symtab, *mod_symvers, *patch_name, *output_obj;
|
||||
struct sym_compare_type *base_locals;
|
||||
struct sym_compare_type *base_locals, *sym_comp;
|
||||
|
||||
arguments.debug = 0;
|
||||
argp_parse (&argp, argc, argv, 0, NULL, &arguments);
|
||||
@ -3263,7 +3263,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
list_for_each_entry(sym, &kelf_base->symbols, list) {
|
||||
if (sym->type == STT_FILE) {
|
||||
hint = sym->name;
|
||||
hint = strdup(sym->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3272,10 +3272,7 @@ int main(int argc, char *argv[])
|
||||
return EXIT_STATUS_NO_CHANGE;
|
||||
}
|
||||
|
||||
/* create symbol lookup table */
|
||||
base_locals = kpatch_elf_locals(kelf_base);
|
||||
lookup = lookup_open(parent_symtab, mod_symvers, hint, base_locals);
|
||||
free(base_locals);
|
||||
|
||||
kpatch_mark_grouped_sections(kelf_patched);
|
||||
kpatch_replace_sections_syms(kelf_base);
|
||||
@ -3332,6 +3329,14 @@ int main(int argc, char *argv[])
|
||||
*/
|
||||
kpatch_elf_teardown(kelf_patched);
|
||||
|
||||
/* create symbol lookup table */
|
||||
lookup = lookup_open(parent_symtab, mod_symvers, hint, base_locals);
|
||||
for (sym_comp = base_locals; sym_comp->name; sym_comp++) {
|
||||
free(sym_comp->name);
|
||||
}
|
||||
free(base_locals);
|
||||
free(hint);
|
||||
|
||||
/* create strings, patches, and dynrelas sections */
|
||||
kpatch_create_strings_elements(kelf_out);
|
||||
kpatch_create_patches_sections(kelf_out, lookup, parent_name);
|
||||
|
Loading…
Reference in New Issue
Block a user