diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 451a21c..8a9d756 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -3033,8 +3033,8 @@ int main(int argc, char *argv[]) struct lookup_table *lookup; struct section *sec, *symtab; struct symbol *sym; - char *hint = NULL, *objname, *pos; - char *mod_symvers_path, *pmod_name; + char *hint = NULL, *objname, *pos, *orig_obj, *patched_obj; + char *parent_kobj, *mod_symvers, *patch_name, *output_obj; struct sym_compare_type *base_locals; arguments.debug = 0; @@ -3044,13 +3044,17 @@ int main(int argc, char *argv[]) elf_version(EV_CURRENT); - childobj = basename(arguments.args[0]); + orig_obj = arguments.args[0]; + patched_obj = arguments.args[1]; + parent_kobj = arguments.args[2]; + output_obj = arguments.args[3]; + mod_symvers = arguments.args[4]; + patch_name = arguments.args[5]; - mod_symvers_path = arguments.args[4]; - pmod_name = arguments.args[5]; + childobj = basename(orig_obj); - kelf_base = kpatch_elf_open(arguments.args[0]); - kelf_patched = kpatch_elf_open(arguments.args[1]); + kelf_base = kpatch_elf_open(orig_obj); + kelf_patched = kpatch_elf_open(patched_obj); kpatch_bundle_symbols(kelf_base); kpatch_bundle_symbols(kelf_patched); @@ -3070,7 +3074,7 @@ int main(int argc, char *argv[]) /* create symbol lookup table */ base_locals = kpatch_elf_locals(kelf_base); - lookup = lookup_open(arguments.args[2], mod_symvers_path, hint, base_locals); + lookup = lookup_open(parent_kobj, mod_symvers, hint, base_locals); free(base_locals); kpatch_mark_grouped_sections(kelf_patched); @@ -3129,7 +3133,7 @@ int main(int argc, char *argv[]) kpatch_elf_teardown(kelf_patched); /* extract module name (destructive to arguments.modulefile) */ - objname = basename(arguments.args[2]); + objname = basename(parent_kobj); if (!strncmp(objname, "vmlinux-", 8)) objname = "vmlinux"; else { @@ -3146,7 +3150,7 @@ int main(int argc, char *argv[]) /* create strings, patches, and dynrelas sections */ kpatch_create_strings_elements(kelf_out); kpatch_create_patches_sections(kelf_out, lookup, objname); - kpatch_create_intermediate_sections(kelf_out, lookup, objname, pmod_name); + kpatch_create_intermediate_sections(kelf_out, lookup, objname, patch_name); kpatch_create_kpatch_arch_section(kelf_out, objname); kpatch_create_callbacks_objname_rela(kelf_out, objname); kpatch_build_strings_section_data(kelf_out); @@ -3182,7 +3186,7 @@ int main(int argc, char *argv[]) kpatch_create_strtab(kelf_out); kpatch_create_symtab(kelf_out); kpatch_dump_kelf(kelf_out); - kpatch_write_output_elf(kelf_out, kelf_patched->elf, arguments.args[3]); + kpatch_write_output_elf(kelf_out, kelf_patched->elf, output_obj); kpatch_elf_free(kelf_patched); kpatch_elf_teardown(kelf_out);