Move lookup_open() call to a later stage

Sometimes due to config-dependency issues or other reasons whole
object-files would get optimized out from final vmlinux/module, in cases
like this create-diff-object would fail during symbol lookup table
creation in lookup_open(). Because lookup_open() call is situated before
we established that objectfile has changed this triggers not only on
real problems, but also during mass-rebulds caused by changes to
header-files. While it usually indicates a real issue with config this
should not prevent kpatch from building.

Move lookup_open() call so that it is called only for changed
object-files.

Fixes #910

Signed-off-by: Artem Savkov <asavkov@redhat.com>
This commit is contained in:
Artem Savkov 2018-10-16 10:48:31 +02:00
parent c46191028e
commit f959edecdb

View File

@ -3272,14 +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);
for (sym_comp = base_locals; sym_comp->name; sym_comp++) {
free(sym_comp->name);
}
free(base_locals);
free(hint);
kpatch_mark_grouped_sections(kelf_patched);
kpatch_replace_sections_syms(kelf_base);
@ -3336,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);