From: Pawel Wieczorkiewicz Date: Sun, 21 Oct 2018 14:42:11 +0000 (+0000) Subject: create-diff-object: Do not create empty .livepatch.funcs section X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9193724d69294f48dfe8064fb507649ba38e2d7c;p=people%2Fwipawel%2Flivepatch-build-tools create-diff-object: Do not create empty .livepatch.funcs section When there is no changed function in the generated payload, do not create an empty .livepatch.funcs section. Hypervisor code considers such payloads as broken and rejects to load them. Such payloads without any changed functions may appear when only hooks are specified. Signed-off-by: Pawel Wieczorkiewicz Reviewed-by: Martin Mazein Reviewed-by: Martin Pohlack --- diff --git a/create-diff-object.c b/create-diff-object.c index 4252175..41adb09 100644 --- a/create-diff-object.c +++ b/create-diff-object.c @@ -1838,6 +1838,11 @@ static void livepatch_create_patches_sections(struct kpatch_elf *kelf, if (sym->type == STT_FUNC && sym->status == CHANGED) nr++; + if (nr == 0) { + log_debug("No changed functions found. Skipping .livepatch.funcs section creation\n"); + return; + } + /* create text/rela section pair */ sec = create_section_pair(kelf, ".livepatch.funcs", sizeof(*funcs), nr); relasec = sec->rela;