create-diff-object: Avoid unnecessary parent symbol inclusion

When a child symbol has changed, the parent symbol is only needed
in the output object if the child symbol is unpatchable on its own.
This is the case when the child symbol does not have its own profiling
call.

Only include unchanged parent symbols if their child has changed and
the child does not have a function profiling call.

Signed-off-by: Julien Thierry <jthierry@redhat.com>
This commit is contained in:
Julien Thierry 2019-10-31 07:37:52 +00:00
parent 421df07ffa
commit af1fe267c5
1 changed files with 4 additions and 2 deletions

View File

@ -692,7 +692,8 @@ static void kpatch_compare_sections(struct list_head *seclist)
sym->status = sec->status;
if (sym && sym->child && sym->status == SAME &&
sym->child->sec->status == CHANGED)
sym->child->sec->status == CHANGED &&
!sym->child->has_func_profiling)
sym->status = CHANGED;
}
}
@ -1402,7 +1403,8 @@ static void kpatch_check_func_profiling_calls(struct kpatch_elf *kelf)
int errs = 0;
list_for_each_entry(sym, &kelf->symbols, list) {
if (sym->type != STT_FUNC || sym->status != CHANGED || sym->parent)
if (sym->type != STT_FUNC || sym->status != CHANGED ||
(sym->parent && sym->parent->status == CHANGED))
continue;
if (!sym->twin->has_func_profiling) {
log_normal("function %s has no fentry/mcount call, unable to patch\n",